我在 运行 单元测试中遇到错误 "createSpyObj requires a non-empty array",之前执行得很好
I am getting an error "createSpyObj requires a non-empty array" with running unit tests, which were executed perfectly before
我正在进行 Angular 前端单元测试以更新 Sonar 报告,
Chrome Headless 93.0.4577.63 (Windows 10) ERROR
An error was thrown in afterAll
createSpyObj requires a non-empty array or object of method names to create spies for thrown
Chrome Headless 93.0.4577.63 (Windows 10): Executed 994 of 1041 (skipped 20) ERROR (0 secs / 11.047 secs)
Chrome Headless 93.0.4577.63 (Windows 10) ERROR
An error was thrown in afterAll
Chrome Headless 93.0.4577.63 (Windows 10): Executed 994 of 1041 (skipped 20) ERROR (16.566 secs / 11.047 secs)
这是我收到的错误日志。以前所有测试运行都没有问题。在不同的组件中添加了一些新测试后,突然出现此错误。然后我删除了新测试和新组件。但我仍然收到此错误。但是测试在自动打开的 Chrome 无头浏览器上执行时没有任何错误。为什么我会收到此 ERROR
查看 jasmine.createSpyObj
的代码库并确保数组不为空。
// Make sure you don't see empty arrays like so when using jasmine.createSpyObj
// The array is supposed to be an array of strings of public methods
// you want to mock.
jasmine.createSpyObj([]);
jasmine.createSpyObj('SomeName', []);
我正在进行 Angular 前端单元测试以更新 Sonar 报告,
Chrome Headless 93.0.4577.63 (Windows 10) ERROR
An error was thrown in afterAll
createSpyObj requires a non-empty array or object of method names to create spies for thrown
Chrome Headless 93.0.4577.63 (Windows 10): Executed 994 of 1041 (skipped 20) ERROR (0 secs / 11.047 secs)
Chrome Headless 93.0.4577.63 (Windows 10) ERROR
An error was thrown in afterAll
Chrome Headless 93.0.4577.63 (Windows 10): Executed 994 of 1041 (skipped 20) ERROR (16.566 secs / 11.047 secs)
这是我收到的错误日志。以前所有测试运行都没有问题。在不同的组件中添加了一些新测试后,突然出现此错误。然后我删除了新测试和新组件。但我仍然收到此错误。但是测试在自动打开的 Chrome 无头浏览器上执行时没有任何错误。为什么我会收到此 ERROR
查看 jasmine.createSpyObj
的代码库并确保数组不为空。
// Make sure you don't see empty arrays like so when using jasmine.createSpyObj
// The array is supposed to be an array of strings of public methods
// you want to mock.
jasmine.createSpyObj([]);
jasmine.createSpyObj('SomeName', []);