[当我运行测试(ng test
)时,我总是将http://localhost:9876/_karma_webpack_/
附加到错误的后面,因此在Visual Studio代码中,我们无法单击错误直接将其链接到文件。
为了测试,我在expect(2).toEqual(1);
文件中添加了app.component.spec.ts
例如,在开箱即用Angular 7投影机的情况下,我在ng test中收到此错误:
Chrome 81.0.4044 (Windows 10.0.0) AppComponent should have as title 'angular7app' FAILED
Expected 2 to equal 1.
at UserContext.<anonymous> (src/app/app.component.spec.ts:23:12)
关于角度9,我得到这个错误:
Chrome 81.0.4044.122 (Windows 10) AppComponent should have as title 'untaire' FAILED
Error: Expected 2 to be 1.
at <Jasmine>
at UserContext.<anonymous> (http://localhost:9877/_karma_webpack_/src/app/app.component.spec.ts:23:12)
当我检查package.json中的版本时,这些是会影响Karma和茉莉花的更改:
"@types/jasmine": "~2.8.8" to "~3.5.0"
"@types/jasminewd2": "~2.0.3" to "~2.0.3" (no changes)
"jasmine-core": "~2.99.1" to "~3.5.0"
"jasmine-spec-reporter": "~4.2.1", to "~4.2.1" (no changes)
"karma": "~4.0.0", to "~5.0.0"
"karma-chrome-launcher": "~2.2.0", to "~3.1.0"
"karma-coverage-istanbul-reporter": "~2.0.1", to "~2.1.0"
"karma-jasmine": "~1.1.2", to "~3.0.1"
"karma-jasmine-html-reporter": "^0.2.2", to "^1.4.2"
我已经检查过,但在这些软件包中都没有发现有关此新行为的任何信息
我最近将我的项目从7号角升级到9号角。运行测试(ng test)时,我总是得到http:// localhost:9876 / _karma_webpack_ /附加错误,因此在Visual Studio代码中, ...
karma.conf.js
配置属性formatError
: