运行与jenkins一起使用karma进行我的angular2单元测试时发现以下错误。在linux上运行jenkins运行angular2测试时发生Karma错误
当我在我的本地机器(Windows)上运行它们时,我的测试运行良好,但是当通过jenkins在Linux上运行测试时,出现以下错误。
Missing error handler on `socket`.
TypeError: (msg || "").replace is not a function
at /home/hudson/.hudson/jobs/workspace/pjt/node_modules/karma/lib/reporter.js:45:23
我的测试从来没有启动任何想法可能会导致这种情况。我查看了业务源代码,我无法弄清楚为什么会有问题。
return function (msg, indentation) {
// remove domain and timestamp from source files
// and resolve base path/absolute path urls into absolute path
msg = (msg || '').replace(URL_REGEXP, function (_, prefix, path, __, ___, line, ____, column) {
if (prefix === 'base') {
path = basePath + path
}
// more code here ...
我正在使用PhantomJS作为测试跑步者,以防本地和jenkins相关。
我很感激任何可能是问题的指针。
我的第一个直觉是你的本地机器有可用的东西,在Jenkins构建服务器/从属上不可用。你确定buildslave被正确设置为能够运行测试吗?你有没有尝试在该服务器上手动运行它们? – Cronax
@Cronax我还没有直接访问jenkins机器,但我正在获取它。我会尝试手动构建并保持发布。 –