3

Noticed Karma tests not running on a new angular-cli project

  1. ng new MyProject
  2. Let project build
  3. npm run test
  4. The following is output, and a blank browser is opened to (localhost:9876/?id=50029001). The page is identified as 'Untitled'.

    10% building modules 1/1 modules 0 active06 11 2017 13:15:08.477:WARN [karma]: No captured browser, open http://lo calhost:9876/ 06 11 2017 13:15:08.493:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/ 06 11 2017 13:15:08.493:INFO [launcher]: Launching browser Chrome with unlimited concurrency 06 11 2017 13:15:08.493:INFO [launcher]: Starting browser Chrome 06 11 2017 13:15:22.195:WARN [karma]: No c aptured browser, open http://localhost:9876/ 06 11 2017 13:16:08.507:WARN [launcher]: Chrome have not captured in 60000 ms, killing. 06 11 2017 13:16:08.601:INFO [launcher]: Trying to start Chrome again (1/2). 06 11 2017 13:17:08.618:WARN [launcher]: Chrome have not captured in 60000 ms, killing. 06 11 2017 13:17:08.758:INFO [launcher]: Trying to start Chrome again (2/2). 06 11 2017 13:18:08.774:WARN [launcher]: Chrome have not captured in 60000 ms, killing. 06 11 2017 13:18:08.960:ERROR [launcher]: Chrome failed 2 times (timeout). Giving up.

Is this a new break with the release of Angular-5?

Robert Price
  • 239
  • 2
  • 5
  • 11

2 Answers2

1

Although you write that you did a new project, so npm install is done with no node_modules folder existing before, I want to share my solution in case someone gets to this thread like I did. I had the same problem and tried a lot of the suggested solutions I found, but what finally solved it for me was to delete the node_modules folder and getting everything new via npm install.

same issue: Karma - Chrome failed 2 times (cannot start). Giving up

Gerros
  • 688
  • 11
  • 20
0

go to the same directory as karma.conf.js and run the command "karma start"

Fateh Mohamed
  • 20,445
  • 5
  • 43
  • 52
  • Running 'karma start' provides the following response: karma : The term 'karma' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + karma start + ~~~~~ + CategoryInfo : ObjectNotFound: (karma:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException – Robert Price Nov 06 '17 at 19:15
  • install it : npm install -g karma-cli – Fateh Mohamed Nov 06 '17 at 19:20
  • A search on the karma error found this link (https://stackoverflow.com/questions/20800933/running-karma-after-installation-results-in-karma-is-not-recognized-as-an-inte) The fix is to run 'npm install karma-cli' – Robert Price Nov 06 '17 at 19:31