IDEA karma-js plugin help! . Building Angular test explorer for vscode
Hey so I am building a test explorer for vscode using js karma plugin as example. I managed to load the tests and run them all together, also I am making progress for running one test at a time. But I noticed some strange behaviour.
I run ng test to start angular ( through a command line child_process), then I do karma run to run all the tests and I get the results by using a custom reporter for karma.. but i noticed that after a few runs when I try to do karma run again I get "There is no server listening on port 9876". How can I prevent karma server from stop listening after a while or how does the plugin solves this problem?
Please sign in to leave a comment.
IntelliJ runs Karma server with disabled `singleRun` to prevent its exit.
Hi, sorry for my delayed response. I was on holidays. Its weird cause I am using singleRun: false as part of the config.
https://github.com/Raagh/angular-test-explorer/blob/feature/run-tests/src/config/test-explorer-karma.conf.ts
there is also the repository.
I will continue today and verify that those values are actually ending in the karma config.
Also, you need to defend from assigning to `singleRun` after your initialization code is run: https://github.com/angular/devkit/blob/v6.0.1/packages/angular_devkit/build_angular/src/karma/index.ts#L65
I am still having that bug, I added some code in the karma.conf to prevent singleRun to be set as true. just as you did on your runner.
https://github.com/Raagh/angular-test-explorer/blob/feature/run-tests/src/config/test-explorer-karma.conf.ts#L71
still on third run this happens. First two Karma run, runs all the tests correctly. then last one only runs a few and ends abruptly. After that the next try says that there is no server listening.
I will continue to see if I can figure it out.