我们有一个ASPNET MVC5 / Angular2 / Webpack应用程序,在TeamCity中构建了karma测试。它曾经工作得很好。最近它开始失败,出现错误“ERROR [karma]:TypeError:无法读取未定义的属性'log'”。 Karma测试在本地机器上传递,因此测试本身不是问题。据我们所知,我们不会更新任何npm包(例如karma,karma-teamcity-reporter,jasmine,phantomJs或typescript)。那么什么可能突然引入这个错误或如何解决它?
[10:37:04]Step 11/22: Karma tests (Node.js NPM) (2m:26s)
[10:37:04]npm test (2m:26s)
[10:37:04]Executing npm via wrapping shell script
[10:37:04]Starting: cmd /c npm test
[10:37:04]in directory: C:\BuildAgent\work\e1596ec73fa322b3\src\...
[10:37:05]
[10:37:05]> angular2-webpack@1.0.0 test C:\BuildAgent\work\e1596ec73fa322b3\src\...
[10:37:05]> karma start ./test/karma.config.js --reporters teamcity
[10:37:05]
[10:37:09]JavaScript Unit Tests (2m:21s)
[10:37:57]30 08 2017 10:37:56.617:INFO [karma]: Karma v1.5.0 server started at http://0.0.0.0:9876/
[10:37:57]30 08 2017 10:37:56.625:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
[10:37:57]30 08 2017 10:37:56.638:INFO [launcher]: Starting browser PhantomJS
[10:38:04]30 08 2017 10:38:04.077:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket OZsVoe9LOJhG5oVMAAAA with id 45606479
[10:39:30]30 08 2017 10:39:30.278:ERROR [karma]: TypeError: Cannot read property 'log' of undefined
[10:39:30] at getLog (C:\BuildAgent\work\e1596ec73fa322b3\src\...\node_modules\karma-teamcity-reporter\index.js:112:28)
[10:39:30] at specSuccess (C:\BuildAgent\work\e1596ec73fa322b3\src\...\node_modules\karma-teamcity-reporter\index.js:67:20)
[10:39:30] at onSpecComplete (C:\BuildAgent\work\e1596ec73fa322b3\src\...\node_modules\karma\lib\reporters\base.js:89:12)
[10:39:30] at .<anonymous> (C:\BuildAgent\work\e1596ec73fa322b3\src\...\node_modules\karma\lib\events.js:13:22)
[10:39:30] at emitTwo (events.js:106:13)
[10:39:30] at emit (events.js:191:7)
[10:39:30] at onResult (C:\BuildAgent\work\e1596ec73fa322b3\src\...\node_modules\karma\lib\browser.js:217:13)
[10:39:30] at Array.forEach (native)
.....
[10:39:31]npm ERR! Test failed. See above for more details.
[10:39:31]Process exited with code 1
[10:39:31]Step Karma tests (Node.js NPM) failed