angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.76k stars 11.97k forks source link

ng test -> karma; missing "test"-key:value in .angular-cli.json leads to very misleading error #8299

Closed maks187 closed 5 years ago

maks187 commented 7 years ago

Bug Report or Feature Request (mark with an x)

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

Versions.

_                      _                 ____ _     ___

/ \ | | / | | | | / △ \ | ' \ / ` | | | | |/ ` | '| | | | | | | / | | | | (| | || | | (| | | | |__| | | | // __| ||_, |_,||_,|| __|__|| |/ @angular/cli: 1.4.9 node: 6.11.0 os: win32 x64 @angular/animations: 4.4.6 @angular/cdk: 2.0.0-beta.12 @angular/common: 4.4.6 @angular/compiler: 4.4.6 @angular/core: 4.4.6 @angular/forms: 4.4.6 @angular/http: 4.4.6 @angular/material: 2.0.0-beta.12 @angular/platform-browser: 4.4.6 @angular/platform-browser-dynamic: 4.4.6 @angular/router: 4.4.6 @angular/cli: 1.4.9 @angular/compiler-cli: 4.4.6 @angular/language-service: 4.4.6 typescript: 2.3.4

Repro steps.

Later integration of Karma test into agular-cli environment and forgotten test-key-value in .angular-cli.json leads to an very hard to find error. ng test outputs the error:

The log given by the failure.

Path must be a string. Received undefined TypeError: Path must be a string. Received undefined at assertPath (path.js:7:11) at Object.resolve (path.js:186:7) at Object.getTestConfig (C:\xxxx\node_modules\@angular\cli\models\webpack-configs\test.js:43:24) at WebpackTestConfig.buildConfig (C:\xxxx\node_modules\@angular\cli\models\webpack-test-config.js:16:31) at init (C:\xxxx\node_modules\@angular\cli\plugins\karma.js:95:94) at Array.invoke (C:\xxxx\node_modules\di\lib\injector.js:75:15) at Injector.get (C:\xxxx\node_modules\di\lib\injector.js:48:43) at C:\xxxx\node_modules\karma\lib\server.js:143:20 at Array.forEach (native) at Server._start (C:\xxxx\node_modules\karma\lib\server.js:142:21) at Injector.invoke (C:\xxxx\node_modules\di\lib\injector.js:75:15) at Server.start (C:\xxxx\node_modules\karma\lib\server.js:103:18) at Promise (C:\xxxx\node_modules\@angular\cli\tasks\test.js:41:25) at Class.run (C:\xxxx\node_modules\@angular\cli\tasks\test.js:20:16) at Class.run (C:\xxxx\node_modules\@angular\cli\commands\test.js:109:25) at resolve (C:\xxxx\node_modules\@angular\cli\ember-cli\lib\models\command.js:261:20)

Desired functionality.

An error which shows what is really missing. so====> ... "polyfills": "polyfills.ts", ----> "test": "test.ts", <----- "tsconfig": "../tsconfig.json", ...

Mention any other details that might be useful.

alan-agius4 commented 5 years ago

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

angular-automatic-lock-bot[bot] commented 5 years ago

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.