Friday 2 June 2017

Angular 2 Quickstart fails karma testing out of the box

A simple, 4-step clean install process of the official Angular2 quickstart is not able to run karma tests on windows 10. What can be done to resolve this error so that karma tests can be executed properly.


The Error Message:
INFO [karma]: Delaying execution, these browsers are not ready:   
Chrome 58.0.3029 (Windows 10 0.0.0)  


Recreating The Problem:

I typed the following 4 commands and nothing else:

C:\projects\temp>git clone https://github.com/angular/quickstart.git
C:\projects\temp>cd C:\projects\temp\quickstart  
C:\projects\temp\quickstart>npm install    
...install logs omitted for brevity  
C:\projects\temp\quickstart>npm start  
...app launched successfully, but logs omitted for brevity  
C:\projects\temp\quickstart>npm test  
...Error shown in complete logs below  

The problem can be reproduced in any computer in only a few minutes by typing these 4 simple commands. The full error message resulting after the final command is as follows:


The Full Error:
C:\projects\temp\quickstart>npm test

> angular-quickstart@1.0.0 pretest C:\projects\temp\quickstart
> npm run build


> angular-quickstart@1.0.0 build C:\projects\temp\quickstart
> tsc -p src/


> angular-quickstart@1.0.0 test C:\projects\temp\quickstart
> concurrently "npm run build:watch" "karma start karma.conf.js"

[0]
[0] > angular-quickstart@1.0.0 build:watch C:\projects\temp\quickstart
[0] > tsc -p src/ -w
[0]
[1] 01 06 2017 14:33:49.385:WARN [watcher]: Pattern "C:/projects/temp/quickstart/testing/**/*.js" does not match any file.
[1] 01 06 2017 14:33:49.406:WARN [watcher]: Pattern "C:/projects/temp/quickstart/testing/**/*.ts" does not match any file.
[1] 01 06 2017 14:33:49.407:WARN [watcher]: Pattern "C:/projects/temp/quickstart/testing/**/*.js.map" does not match any file.
[1] 01 06 2017 14:33:49.891:WARN [karma]: No captured browser, open http://localhost:9876/
[1] 01 06 2017 14:33:49.906:WARN [karma]: Port 9876 in use
[1] 01 06 2017 14:33:49.908:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9877/
[1] 01 06 2017 14:33:49.908:INFO [launcher]: Launching browser Chrome with unlimited concurrency
[1] 01 06 2017 14:33:49.958:INFO [launcher]: Starting browser Chrome
[1] 01 06 2017 14:33:51.821:INFO [watcher]: Changed file "C:/projects/temp/quickstart/src/app/app.component.js".
[1] 01 06 2017 14:33:51.843:INFO [watcher]: Changed file "C:/projects/temp/quickstart/src/app/app.component.spec.js".
[1] 01 06 2017 14:33:51.850:INFO [watcher]: Changed file "C:/projects/temp/quickstart/src/app/app.module.js".
[0] 2:33:51 PM - Compilation complete. Watching for file changes.
[1] 01 06 2017 14:33:51.873:INFO [watcher]: Changed file "C:/projects/temp/quickstart/src/main.js".
[1] 01 06 2017 14:33:51.965:INFO [Chrome 58.0.3029 (Windows 10 0.0.0)]: Connected on socket pXysNFDP8RC3agm8AAAA with id 9156960
[1] 01 06 2017 14:33:52.077:INFO [karma]: Delaying execution, these browsers are not ready: Chrome 58.0.3029 (Windows 10 0.0.0)

Since this is failing out of the box, anyone should be able to recreate this on any windows 10 machine with the current version of Chrome in only a few minutes.

What needs to change in order for npm test to succeed out of the box on Windows 10?



via CodeMed

No comments:

Post a Comment