相关疑难解决方法(0)

迁移到 Angular9 后错误附加了 Webpack 目录

我最近将我的项目从 angular 7 升级到了 angular 9。

当我运行测试 ( ng test) 时,我总是会http://localhost:9876/_karma_webpack_/附加到错误,因此在 Visual Studio 代码中,我们无法单击错误直接访问文件。

为了测试,我expect(2).toEqual(1);app.component.spec.ts文件中添加了

例如,使用开箱即用的 angular 7 projet,我在 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)
Run Code Online (Sandbox Code Playgroud)

至于角度 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)
Run Code Online (Sandbox Code Playgroud)

当我检查 package.json 中的版本时,这些是影响 Karma 和 jasmine 的更改:

"@types/jasmine": …
Run Code Online (Sandbox Code Playgroud)

karma-jasmine jasmine2.0 karma-webpack angular

1
推荐指数
1
解决办法
410
查看次数