使用 karma 和 jenkins 运行我的 angular2 单元测试时,我看到以下错误。
当我在本地计算机(Windows)上运行测试时,我的测试运行良好,但是当在 Linux 上通过 jenkins 运行测试时,我收到以下错误。
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
我的测试从未开始任何想法可能导致此问题。我查看了karma源代码,我无法弄清楚为什么会出现问题。
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 作为测试运行程序,以防万一它与本地和詹金斯相关。
如果有任何关于可能出现问题的指示,我将不胜感激。