When I test my Angular project on Travis-CI, two exceptions emerged:
$ ng test
The test command requires to be run in an Angular project, but a project definition could not be found.
The command "ng test" exited with 1.
$ ng e2e
The e2e command requires to be run in an Angular project, but a project definition could not be found.
The command "ng e2e" exited with 1.
The error message is pretty confusing. I googled about "Angular project definition", but nothing relevant is found.
I checked out Angular CLI wiki,
but there is no useful information about ng test
and ng e2e
,
not to mention the definition of "project definition".
My Github project:
https://github.com/donizyo/ng-dementor
My development environment:
$ ng version
Angular CLI: 7.0.3
Node: 11.1.0
OS: linux x64
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
------------------------------------------------------
@angular-devkit/architect 0.10.3
@angular-devkit/core 7.0.3
@angular-devkit/schematics 7.0.3
@angular/cli 7.0.3
@schematics/angular 7.0.3
@schematics/update 0.10.3
rxjs 5.5.12
typescript 2.5.3
Raw log of Travis-CI can be found here.
UPDATE 1
I just installed the lastest Angular CLI (v7.0.4) on my PC,
$ ng version
Angular CLI: 7.0.4
Node: 8.9.3
OS: win32 ia32
Angular: <error>
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
------------------------------------------------------
@angular-devkit/architect 0.10.4 (cli-only)
@angular-devkit/core 7.0.4 (cli-only)
@angular-devkit/schematics 7.0.4 (cli-only)
@schematics/angular 7.0.4 (cli-only)
@schematics/update 0.10.4 (cli-only)
rxjs 6.3.3 (cli-only)
typescript 3.1.3 (cli-only)
and generated a new project testprj
with it.
When I execute ng test
in directory My Projects/testprj/
,
everything goes fine.
Karma v3.0.0 server was started, Chrome browser was launched.
However when I execute ng test
in directory My Projects/ng-dementor/
,
Angular CLI gives me nothing but "The test command requires to be run in an Angular project, but a project definition could not be found."
UPDATE 2
I updated my Angular CLI according to Angular Update Guide. Now my develop environment is:
Angular CLI: 7.0.4
Node: 8.9.3
OS: win32 ia32
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.10.4
@angular-devkit/build-angular 0.10.4
@angular-devkit/build-optimizer 0.10.4
@angular-devkit/build-webpack 0.10.4
@angular-devkit/core 7.0.4
@angular-devkit/schematics 7.0.4
@angular/cli 7.0.4
@ngtools/webpack 7.0.4
@schematics/angular 7.0.4
@schematics/update 0.10.4
rxjs 5.5.12
typescript 2.5.3
webpack 4.19.1