Angular-cli: ng test --watch false does not work: Data path ".watch" should be boolean

Created on 14 Oct 2018  路  10Comments  路  Source: angular/angular-cli

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: 6.2.5
Node: 10.9.0
OS: darwin x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.8.5
@angular-devkit/build-angular      0.8.5
@angular-devkit/build-ng-packagr   0.8.5
@angular-devkit/build-optimizer    0.8.5
@angular-devkit/build-webpack      0.8.5
@angular-devkit/core               0.8.5
@angular-devkit/schematics         0.8.5
@angular/cli                       6.2.5
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.2.5
@schematics/angular                0.8.5
@schematics/update                 0.8.5
ng-packagr                         4.3.0
rxjs                               6.2.2
typescript                         2.9.2
webpack                            4.20.2

Repro steps

ng new test-app
cd test-app
ng test --watch false

The log given by the failure

Schema validation failed with the following errors:
  Data path ".watch" should be boolean.

Desired functionality


It should simply work.

Mention any other details that might be useful


After installing @angular/[email protected], it worked again. So the bug was introduced between versions 6.1.5 and 6.2.5.

devkibuild-angular medium regression

Most helpful comment

OK, found the issue (for me):
I created this project test project for _libraries_ and _applications_.
So I started again from scratch with the current version.

After generating the first library, ng test --watch false failed and ng test --help showed the parial help text. --> the error behavior above.

Nevertheless, ng test myApps --watch false and ng test myApps --help work fine.

When running ng test it cycles through all libraries and apps - although you have to ^C after each library/application.

Similar with ng e2e works fine bit ng e2e --help shows the partial help text.

So the bug is that with libraries and applications

  • ng test works "kind of"
  • ng test --watch false fails = bug
  • ng test --help is incorrect
  • ng test myApps works also with --help and parameters
  • ng e2e works without parameters
  • ng e2e --help is incorrect
  • ng e2e myApps ignores the myApp - same as ng e2e - not tried with parameters

All 10 comments

ng test --help
shows only two options

  • --prod
  • --configuration

whereas the wiki shows the "old" options, which don't work anymore

it would be helpful to have some documentation on the --configuration

Hi guys,

I am sorry about this, but I am unable to replicate the reported issue

Angular CLI: 6.2.5
Node: 10.10.0
OS: darwin x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.8.5
@angular-devkit/build-angular     0.8.5
@angular-devkit/build-optimizer   0.8.5
@angular-devkit/build-webpack     0.8.5
@angular-devkit/core              0.8.5
@angular-devkit/schematics        0.8.5
@angular/cli                      6.2.5
@ngtools/webpack                  6.2.5
@schematics/angular               0.8.5
@schematics/update                0.8.5
rxjs                              6.2.2
typescript                        2.9.2
webpack                           4.20.2

ng test --help

Run unit tests in existing project.
usage: ng test <project> [options]
arguments:
  project
    The name of the project to test.
options:
  --browsers 
    Override which browsers tests are run against.
  --code-coverage 
    Output a code coverage report.
  --configuration (-c)
    Specify the configuration to use.
  --environment 
    Defines the build environment.
  --eval-source-map 
    Output in-file eval sourcemaps.
  --karma-config 
    The name of the Karma configuration file.
  --main 
    The name of the main entry-point file.
  --poll 
    Enable and define the file watching poll time period in milliseconds.
  --polyfills 
    The name of the polyfills file.
  --preserve-symlinks 
    Do not use the real path when resolving modules.
  --prod 
    Flag to set configuration to 'production'.
  --progress 
    Log progress to the console while building.
  --source-map 
    Output sourcemaps.
  --ts-config 
    The name of the TypeScript configuration file.
  --vendor-source-map 
    Resolve vendor packages sourcemaps.
  --watch 
    Run build when files change.

ng test --watch false

 10% building modules 5/5 modules 0 active14 10 2018 10:06:20.238:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
14 10 2018 10:06:20.323:INFO [launcher]: Launching browser Chrome with unlimited concurrency
14 10 2018 10:06:20.333:INFO [launcher]: Starting browser Chrome
14 10 2018 10:06:33.505:INFO [Chrome 69.0.3497 (Mac OS X 10.13.6)]: Connected on socket SR-2TOpfGprQj-q9AAAA with id 78508711
Chrome 69.0.3497 (Mac OS X 10.13.6): Executed 4 of 4 SUCCESS (0.349 secs / 0.272 secs)
TOTAL: 4 SUCCESS
TOTAL: 4 SUCCESS

There are a few minor differences, so used the "old" way to upgrade (uninstall/rm install)

ng --version
(differences with << and >>)

Angular CLI: 6.2.5
Node: 10.11.0 >> (vs 10.10.0)
OS: darwin x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.8.5
@angular-devkit/build-angular      0.8.4 << (vs 0.8.5)
@angular-devkit/build-ng-packagr   0.8.4 <<
@angular-devkit/build-optimizer    0.8.4 <<
@angular-devkit/build-webpack      0.8.4 <<
@angular-devkit/core               0.8.5
@angular-devkit/schematics         0.8.5
@angular/cli                       6.2.5
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.2.4
@schematics/angular                0.8.5
@schematics/update                 0.8.5
ng-packagr                         4.3.0 (addl)
rxjs                               6.3.3 >> (vs 6.2.2)
typescript                         2.9.2
webpack                            4.20.2

(previously the @angular-devkit/* were all 0.8.4, odd that only the architect is 0.8.5 after re-install)

ng update

    We analyzed your package.json and everything seems to be in order. Good work!

ng test --help

Run unit tests in existing project.
usage: ng test <project> [options]
arguments:
  project
    The name of the project to test.
options:
  --configuration (-c)
    Specify the configuration to use.
  --prod 
    Flag to set configuration to 'production'.

ng test --watch false

Schema validation failed with the following errors:
  Data path ".watch" should be boolean.

So the main difference is node 10.11.0 (vs 10.10.0) and the @angular-devkit/* (0.8.4 << vs 0.8.5)

Using @angular/[email protected], ng test --watch false is working (as I wrote above). Strange is - however - the output of ng test --help:

usage: ng test <project> [options]
options:
  --configuration (-c)
    Specify the configuration to use.
  --prod 
    Flag to set configuration to "prod".

Hi, can you please provide some further information.

  1. package.json before the upgrade
  2. steps done to upgrade? Ie, ng update or manually updating the packages?
  3. Do you have a lock file?
  4. Which package manager are you using? (yarn, npm etc..)?

Thanks

I did no update, instead I more or less started from scratch...

The strange thing is, I just created two Angular apps, one with @[email protected] and the other with @[email protected]. And both are working as they should:

  • ng test --help shows all options
  • ng test --watch false just works

But in my real project, it does not work with @[email protected]. You can find the source code here. Maybe you are able to see the problem there: in the pushed version I can run npm test. But as soon as I update to @[email protected], it doesn't work any more.

OK, found the issue (for me):
I created this project test project for _libraries_ and _applications_.
So I started again from scratch with the current version.

After generating the first library, ng test --watch false failed and ng test --help showed the parial help text. --> the error behavior above.

Nevertheless, ng test myApps --watch false and ng test myApps --help work fine.

When running ng test it cycles through all libraries and apps - although you have to ^C after each library/application.

Similar with ng e2e works fine bit ng e2e --help shows the partial help text.

So the bug is that with libraries and applications

  • ng test works "kind of"
  • ng test --watch false fails = bug
  • ng test --help is incorrect
  • ng test myApps works also with --help and parameters
  • ng e2e works without parameters
  • ng e2e --help is incorrect
  • ng e2e myApps ignores the myApp - same as ng e2e - not tried with parameters

Hi all,

I had a really quick look at the repo, and the above mentioned issues should have been addressed in the lastest RC, (7.0.0-rc.3)

Can you please see if you are able to replicate the issue?

Thanks,
Alan

After executing ng update @angular/cli --next (which updated to @angular/[email protected]), everything is working as expected.

Thanks for your time!

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings