【发布时间】:2016-03-05 17:50:30
【问题描述】:
我在使用 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 作为测试运行器,以防万一这在本地和 jenkins 上都相关。
我会很感激任何关于可能是什么问题的指示。
【问题讨论】:
-
我的第一直觉是,您的本地计算机具有可用的东西,而 Jenkins 构建服务器/从属服务器上不可用。您确定 buildslave 已正确设置为能够运行测试吗?您是否尝试过在该服务器上手动运行它们?
-
@Cronax 我还没有直接访问 jenkins 机器排序的权限,但我正在获取它。我会尝试手动构建并随时通知您。
标签: angular karma-runner karma-jasmine