在Linux上通过jenkins运行angular2测试时出现Karma错误

Pau*_*lan 7 karma-runner karma-jasmine angular

当使用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
Run Code Online (Sandbox Code Playgroud)

我的测试从未开始任何可能导致这种情况的想法.我看了一下业力源代码,我无法弄清楚为什么会出现问题.

  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 ...
Run Code Online (Sandbox Code Playgroud)

我正在使用PhantomJS作为测试运行器,以防本地和jenkins相关.

我很欣赏有关可能是什么问题的任何指示.

Pau*_*lan 3

回答我自己的问题。

事实证明问题出在我的业力文件部分。

  { pattern: 'node_modules/rxjs/bundles/rx.js', included: true, watched: true }
Run Code Online (Sandbox Code Playgroud)

rx 模块的文件名是 node_modules/rxjs/bundles/ Rx.js

由于 Linux 区分大小写,这就是它在 Windows 开发环境中运行但在 Linux 构建服务器上失败的原因。

rx.js 文件的 404 消息出现在日志中,但我在许多其他调试日志记录中错过了。

学过的知识 :)