为什么 Angular 8 CircleCI 构建在执行 ng test 时失败 --watch-false,karma



我正在将一个开源项目WUF从Angular@7.2.0迁移到@8.2.14;它的CircleCI CI/CD管道WUF在Angular@7.2.0上运行良好,现在在尝试执行单元测试时迁移到Angular@8.2.14后失败;测试通过,然后失败,然后多次运行构建尝试。

我正在FM-736-ng8分支上构建。

CircleCI config.yml 的相关部分是:

- run:
name: Test WUF
command: |
ng test --watch=false --karmaConfig=src/karma.conf.circleci.js

业力配置文件 karma.conf.circleci.js 包含一个标志,用于执行一次测试并停止,似乎没有效果。同样,在 Angular@7.2.0 上运行良好,现在迁移到 Angular@8.2.14 后失败。

有关最新和相关的日志文件片段,请参见下文:

  • 构建开始:

    0% 编译 10% 建筑 0/0 模块 0 活动

块引用

10% building 0/0 modules 0 active
10% building 0/1 modules 1 active multi /root/wuf/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es5-polyfills.js/root/wuf/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es5-jit-polyfills.js/root/wuf/src/polyfills.ts
10% building 1/1 modules 0 active
10% building 1/1 modules 0 active
10% building 1/2 modules 1 active multi /root/wuf/src/polyfills.ts/root/wuf/node_modules/@angular-devkit/build-angular/src/angular-cli files/models/jit-polyfills.js
10% building 2/2 modules 0 active
10% building 2/2 modules 0 active
10% building 2/3 modules 1 active multi /root/wuf/src/styles.scss/root/wuf/src/assets/dummydata/branding/branding.scss
10% building 3/3 modules 0 active START:
10% building 3/4 modules 1 active /root/wuf/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/es5-polyfills.js
10% building 4/4 modules 0 active
...
  • 第一次单元测试运行结束:
HomeComponent
+ should create
Layout
+ should have a view component
+ should have a header component
+ should have a content component
+ should have a footer component
I18nAngularComponent
+ should create
+ should have cardinality paragraph showing 'no wolves'
+ should have gender paragraph
+ should have gender paragraph showing 'female.'
+ should have pluralization paragraph
+ should have pluralization paragraph showing 'has no wolves.'
I18nNgxTranslateComponent
+ should create
+ should create 
Finished in 5.459 secs / 5.426 secs @ 00:50:40 GMT+0000 (Coordinated Universal Time)
SUMMARY:
+ 68 tests completed
# 1 test skipped
0% compiling
10% building 0/0 modules 0 active

请注意测试是如何结束、通过和重新启动的。如果您查看日志,您会发现这种情况重复了很多次,直到它 CircleCI 杀死它。

预期的行为是单元测试运行一次并停止!

> 这太尴尬了!我有一个由许多npm packages组成的单存储库项目,以及展示它们的application。使用ng test运行单元测试时,测试将在运行应用程序测试后停止,而不运行包的测试。

使用ng test --watch false运行单元测试时,应用程序测试运行,然后运行包测试;我错误地将包错误解释为应用程序测试错误。

我的错误是看我正在处理的问题,应用程序测试,而不是我最初关注的领域以外的领域。很尴尬,但确实如此。

相关内容

最新更新