为什么执行ng test --watch-false时Angular 8 CircleCI构建失败,并且业力配置为singleRun = true?

问题描述 投票:0回答:1

我正在将一个开源项目WUF[email protected]迁移到@ 8.2.14;它的CircleCI CI / CD管道WUF[email protected]上运行得很好,但是在尝试执行单元测试时迁移到[email protected]后现在失败了。测试通过,然后因尝试多次运行而失败。

我正在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包含执行一次测试并停止的标志,似乎无效。同样,在[email protected]上也能正常工作,但现在迁移到[email protected]后失败。

请参见下面的most recent and relevant log文件摘要:

  • 构建开始:

    0%编译10%建筑物0/0模块0处于活动状态

Blockquote

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将其杀死为止。

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

angular unit-testing karma-jasmine circleci
1个回答
0
投票

这很尴尬!我有一个由几个npm packages和一个展示它们的application组成的mono-repo项目。使用ng test运行单元测试时,测试将在运行应用程序测试后停止,而不运行软件包的测试。

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

我的错误是看我正在研究的问题,应用程序测试,而不是最初关注的领域之外。相当尴尬,但事实如此。

© www.soinside.com 2019 - 2024. All rights reserved.