错误:“ ERROR”,TypeError-在使用angular 6项目运行`ng test`时-PhantomJS

时间:2018-08-14 13:12:21

标签: angular testing

当我运行ng test时,它同时在chrome和PhantomJS中运行测试,这是输出:

PhantomJS 2.1.1 (Linux 0.0.0): Executed 37 of 37 (1 FAILED) (0 secs / 15.752 secs)
Chrome 68.0.3440 (Linux 0.0.0): Executed 36 of 37 SUCCESS (0 secs / 10.731 secs)
PhantomJS 2.1.1 (Linux 0.0.0) ERROR: 'ERROR', TypeError{line: 1364, sourceURL: 'http://localhost:9876/_karma_webpack_/vendor.js', stack: '_matches@http://localhost:9876/_karma_webpack_/vendor.js:1364:73
matchesElement@http://localhost:9876/_karma_webpack_/vendor.js:5450:30
processLeaveNode@http://localhost:9876/_karma_webpack_/vendor.js:4246:39
http://localhost:9876/_karma_webpack_/vendor.js:4370:78
forEach@[native code]
http://localhost:9876/_karma_webpack_/vendor.js:4370:34
flush@http://localhost:9876/_karma_webpack_/vendor.js:4275:34
flush@http://localhost:9876/_karma_webpack_/vendor.js:5119:37
http://localhost:9876/_karma_webpack_/vendor.js:115207:35
invoke@http://localhost:9876/_karma_webpack_/vendor.js:145347:31
onInvoke@http://localhost:9876/_karma_webpack_/vendor.js:143657:45
invoke@http://localhost:9876/_karma_webpack_/vendor.js:145346:40
run@http://localhost:9876/_karma_webpack_/vendor.js:145097:49
runOutsideAngular@http://localhost:9876/_karma_webpack_/vendor.js:58319:31
end@http://localhost:9876/_karma_webpack_/vendor.js:115205:41
end@http://localhost:9876/_karma_webpack_/vendor.js:65776:30
detectChanges@http://localhost:9876/_karma_webpack_/vendor.js:63244:23
http://localhost:9876/_karma_webpack_/vendor.js:59117:76
forEach@[native code]
tick@http://localhost:9876/_karma_webpack_/vendor.js:59117:32
http://localhost:9876/_karma_webpack_/vendor.js:59009:109
invoke@http://localhost:9876/_karma_webpack_/vendor.js:145347:31
onInvoke@http://localhost:9876/_karma_webpack_/vendor.js:143657:45
invoke@http://localhost:9876/_karma_webpack_/vendor.js:145346:40
onInvoke@http://localhost:9876/_karma_webpack_/vendor.js:58360:39
invoke@http://localhost:9876/_karma_webpack_/vendor.js:145346:40
run@http://localhost:9876/_karma_webpack_/vendor.js:145097:49
run@http://localhost:9876/_karma_webpack_/vendor.js:58274:31
next@http://localhost:9876/_karma_webpack_/vendor.js:59009:84
http://localhost:9876/_karma_webpack_/vendor.js:58091:56
__tryOrUnsub@http://localhost:9876/_karma_webpack_/vendor.js:131365:20
next@http://localhost:9876/_karma_webpack_/vendor.js:131303:34
_next@http://localhost:9876/_karma_webpack_/vendor.js:131247:30
next@http://localhost:9876/_karma_webpack_/vendor.js:131224:23
next@http://localhost:9876/_karma_webpack_/vendor.js:130990:29
emit@http://localhost:9876/_karma_webpack_/vendor.js:58083:80
checkStable@http://localhost:9876/_karma_webpack_/vendor.js:58329:39
onLeave@http://localhost:9876/_karma_webpack_/vendor.js:58396:16
onInvokeTask@http://localhost:9876/_karma_webpack_/vendor.js:58354:24
invokeTask@http://localhost:9876/_karma_webpack_/vendor.js:145379:48
runTask@http://localhost:9876/_karma_webpack_/vendor.js:145147:57
invokeTask@http://localhost:9876/_karma_webpack_/vendor.js:145455:41
PhantomJS 2.1.1 (Linux 0.0.0): Executed 37 of 37 (1 FAILED) (15.454 secs / 15.752 secs)
Chrome 68.0.3440 (Linux 0.0.0): Executed 37 of 37 SUCCESS (11.067 secs / 10.941 secs)
TOTAL: 1 FAILED, 73 SUCCESS
TOTAL: 1 FAILED, 73 SUCCESS
TOTAL: 1 FAILED, 73 SUCCESS

这里没有任何可能失败的测试的内容,那么究竟是什么导致此错误呢?我的项目最近表现不佳,无法识别Date之类的关键字,或者不允许我在列表中使用.length属性。之后,我运行了npm install,那些“预编译器”错误消失了,但是这没有发生。

此外,还运行了74个测试(Chrome中为37个,PhantomJS中为37个),其中73个通过了。那么其中一种浏览器有问题吗?

0 个答案:

没有答案