Skip to content

[v7-rc.1] ng test doesn't show any results without --reports option #12455

Closed
@lacolaco

Description

@lacolaco

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [x] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Angular CLI: 7.0.0-rc.1
Node: 10.11.0
OS: darwin x64
Angular: 7.0.0-rc.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.9.0-rc.1
@angular-devkit/build-angular      0.9.0-rc.1
@angular-devkit/build-ng-packagr   0.9.0-rc.1
@angular-devkit/build-optimizer    0.9.0-rc.1
@angular-devkit/build-webpack      0.9.0-rc.1
@angular-devkit/core               7.0.0-rc.1
@angular-devkit/schematics         7.0.0-rc.1
@angular/cli                       7.0.0-rc.1
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.0.0-rc.1
@schematics/angular                7.0.0-rc.1
@schematics/update                 0.9.0-rc.1
ng-packagr                         4.2.0
rxjs                               6.3.3
typescript                         3.1.1
webpack                            4.19.1

Repro steps

  1. ng new
  2. ng test --no-watch

The log given by the failure

There are no result reporting logs.

>ng test --no-watch
04 10 2018 00:04:17.530:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
04 10 2018 00:04:17.534:INFO [launcher]: Launching browser Chrome with unlimited concurrency
 10% building modules 7/8 modules 1 active ...Works/v7rc-test-example/src/styles.scss04 10 2018 00:04:17.878:INFO [launcher]: Starting browser Chrome
04 10 2018 00:04:23.486:INFO [Chrome 69.0.3497 (Mac OS X 10.12.6)]: Connected on socket RBjGmT1OIYL1oQCIAAAA with id 10996596
✨  Done in 31.89s.

Desired functionality

Reporting result.

> ng test  --no-watch --reporters=progress
04 10 2018 00:03:13.836:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
04 10 2018 00:03:13.839:INFO [launcher]: Launching browser Chrome with unlimited concurrency
 11% building modules 9/9 modules 0 active04 10 2018 00:03:13.868:INFO [launcher]: Starting browser Chrome
04 10 2018 00:03:19.281:INFO [Chrome 69.0.3497 (Mac OS X 10.12.6)]: Connected on socket tJ-gqNiqDzEZRF9BAAAA with id 17163606
Chrome 69.0.3497 (Mac OS X 10.12.6): Executed 3 of 3 SUCCESS (0.099 secs / 0.14 secs)
TOTAL: 3 SUCCESS
TOTAL: 3 SUCCESS
✨  Done in 32.83s.

Mention any other details that might be useful

This change causes the issue.
3fd6afc#diff-077caa4321e7d46196b0db340ce194ee

options.reporters has [] empty array by the default. so when w/o --reporters option, if (options.reporters) is true and karmaOptions.reporters will be [] as a result.

            console.log(karmaOptions.reporters); // => undefined
            console.log(options.reporters); // => []
            if (options.reporters) {
                // Split along commas to make it more natural, and remove empty strings.
                karmaOptions.reporters = options.reporters
                    .reduce((acc, curr) => acc.concat(curr.split(/,/)), [])
                    .filter(x => !!x);
            }
            console.log(karmaOptions.reporters); // => []

I think the criteria should be if (options.reporters.length > 0).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions