IntelliJ中的业力:测试框架意外退出

时间:2019-11-13 18:10:36

标签: javascript angular intellij-idea karma-coverage

搜索此错误,没有任何用处,因此请在此处发布。

我对Angular应用程序进行了单元测试,当我运行或调试它时,它会成功完成。运行代码覆盖率时,我得到了

13 11 2019 13:01:48.249:ERROR [karma-server]: TypeError: Cannot read property 'indexOf' of undefined
    at Object.exports.arrayRemove (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\helper.js:109:26)
    at _reporters.forEach (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\reporters\multi.js:15:50)
    at Array.forEach (<anonymous>)
    at MultiReporter.removeAdapter (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\reporters\multi.js:15:21)
    at C:\Users\thehl\.IntelliJIdea2019.2\config\plugins\js-karma\js_reporter\karma-intellij\lib\intellijReporter.js:83:25
    at Array.forEach (<anonymous>)
    at C:\Users\thehl\.IntelliJIdea2019.2\config\plugins\js-karma\js_reporter\karma-intellij\lib\intellijReporter.js:81:33
    at process._tickCallback (internal/process/next_tick.js:61:11)
13 11 2019 13:01:48.626:ERROR [karma-server]: TypeError: Cannot read property 'push' of undefined
    at _reporters.forEach (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\reporters\multi.js:11:61)
    at Array.forEach (<anonymous>)
    at MultiReporter.addAdapter (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\reporters\multi.js:11:21)
    at Server.<anonymous> (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\middleware\runner.js:41:18)
    at Object.onceWrapper (events.js:277:13)
    at Server.emit (events.js:194:15)
    at Executor.schedule (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\executor.js:30:20)
    at C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\middleware\runner.js:92:22
    at tryCatcher (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:547:31)
    at Promise._settlePromise (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:604:18)
    at Promise._settlePromise0 (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:649:10)
    at Promise._settlePromises (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:729:18)
    at Promise._fulfill (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:673:18)
    at Promise._resolveCallback (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:466:57)
    at Promise._settlePromiseFromHandler (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:559:17)
Cannot read property 'success' of undefined
TypeError: Cannot read property 'success' of undefined
    at TestCommand.runSingleTarget (C:\casenet\sources\provider-portal\portal-client\node_modules\@angular\cli\models\packages\angular\cli\models\architect-command.ts:242:21)

此外,我在“测试运行”窗口中获得了此信息:

"C:\Program Files\nodejs\node.exe" C:\Users\thehl\.IntelliJIdea2019.2\config\plugins\js-karma\js_reporter\karma-intellij\lib\intellijRunner.js --serverPort=9876 --protocol=http: --urlRoot=/ "--testName=^COMPONENT/CLIENT -> DynamicInputComponent "
C:\Users\thehl\.IntelliJIdea2019.2\config\plugins\js-karma\js_reporter\karma-intellij\lib\intellijRunner.js:60
      throw e;
      ^

Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:111:27)

我尝试了完全重新启动,并将所有表示业力的内容升级到当前版本。

不知道从哪里开始调试。

1 个答案:

答案 0 :(得分:1)

问题是由最近使用karma-parallel进行的更改引起的。我们拆分了单元测试,以使用4个单独的Web浏览器在4个单独的线程中运行。

我从package.json和karma.conf.js中提取了karma-parallel的所有引用和定义。单元测试现在可以在IntelliJ中正常工作。

从现在开始,每次我要这样做时,我都必须将其回滚。