ng test not working after upgrade to 6.0.0
See original GitHub issueAfter upgrading the cli the unit tests doesn’t start anymore. Previous behaviour was that the unit tests were found and executed. Now it does not find the unit tests and says 0 of 0 executed.
Versions
Angular CLI: 6.0.0-rc.6
Node: 9.7.1
OS: win32 x64
Angular: 5.2.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker
Repro steps
- Upgrade to latest cli
- ng test
Observed behavior
27 04 2018 14:59:35.185:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/
27 04 2018 14:59:35.191:INFO [launcher]: Launching browser Chrome with unlimited concurrency
27 04 2018 14:59:35.201:INFO [launcher]: Starting browser Chrome 27 04 2018 15:00:26.221:INFO [Chrome 66.0.3359 (Windows 10 0.0.0)]: Connected on socket _q17vZKEaK6MoqgCAAAA with id 70169079
Chrome 66.0.3359 (Windows 10 0.0.0): Executed 0 of 0 ERROR (0.016 secs / 0 secs)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myproj-web@0.0.1 test: `ng test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myproj-web@0.0.1 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\myuser\AppData\Roaming\npm-cache\_logs\2018-04-27T13_00_28_789Z-debug.log
10 silly lifecycle myproj-web@0.0.1~test: Args: [ '/d /s /c', 'ng test' ]
11 silly lifecycle myproj-web@0.0.1~test: Returned: code: 1 signal: null
12 info lifecycle myproj-web@0.0.1~test: Failed to exec test script
13 verbose stack Error: myproj-web@0.0.1 test: `ng test`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
13 verbose stack at EventEmitter.emit (events.js:127:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:127:13)
13 verbose stack at maybeClose (internal/child_process.js:936:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid myproj-web@0.0.1
15 verbose cwd C:\Users\myuser\myproj\myproj-web
16 verbose Windows_NT 10.0.16299
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
18 verbose node v9.7.1
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error myproj-web@0.0.1 test: `ng test`
22 error Exit status 1
23 error Failed at the myproj-web@0.0.1 test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Issue Analytics
- State:
- Created 5 years ago
- Reactions:16
- Comments:42 (4 by maintainers)
Top Results From Across the Web
ng test not working after upgrade to Karma 2.0.0
There is no console output. I've tried both Chrome and ChromeHeadless for the browser but have run out of ideas. Any help would...
Read more >Changelog - Cypress Documentation
Fixed an issue with Angular Component Testing where urls within SASS/SCSS files were not being correctly resolved which could result in incomplete styling....
Read more >jasmine an error was thrown in afterall - You.com
I have an Angular 5 project running karma/jasmine. Unfortunately the tests stopped working after upgrading from 2.99.0 to 3.1.0 with this ambiguous error....
Read more >What's new in Angular CLI 6.0? - Ninja Squad
The ng update command has been introduced in 1.7 but was a glorified npm install . With this release, it starts to express...
Read more >karma-users - Google Groups
Asynchronous UT could not run normal after upgrade to the latest version @6.3.4. ... Hi All, When I run ng test I am...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just ran into this as well (
Executed 0 of 0 ERROR
) after upgrading to Angular 6 on a project where tests previously ran successfully. I compared thetest.ts
file in my project versus a new project generated with the Angular 6 CLI, and noticed a lot of additional imports (import 'core-js/es7/reflect'
,import 'zone.js/dist/jasmine-patch'
), etc in my project. I replaced these with:and my tests started executing again. It definitely seems like an error message is getting swallowed somewhere.
I’ve done some more investigation. My Karma entrypoint file (which I had renamed from
src/test.ts
toui/main.karma.ts
; all of my .ts files live inui
rather thansrc
) does not seem to be getting executed in the way I’d expect: none of theconsole.error
statements I place in that file ever show up in the console or terminal output (they do show up in the terminal output if I do the same thing in a cleanng new
project.)I confirmed that my
main.karma.ts
file is correctly referenced from theangular.json
test/main option, and I confirmed that compilation fails if I change the “main” attribute to point to a nonexistent filename.I confirmed that my
*.spec.ts
files are detected and included by Karma. The generated_karma_webpack_/main.js
file available when running Karma contains avar map = {...}
line section which maps my spec files to their workspace-relative paths, and the tests themselves show up in that file.My suspicion is still that something is going wrong with the execution of my Karma main entrypoint file, since like I mentioned, any
console.error
or other logging statements I add to that file are not showing up in my terminal output. However, that file is very simple and is identical to thetest.ts
provided out-of-the-box by Angular CLI, so I’m still not sure what the issue is.