I'm trying to execute Angular tests on TeamCity and generate code coverage.
However, I encountered an issue while executing a build step on TeamCity. The build step involves running the command npm run test:once, which is defined in the package.json file as "test:once": "ng test --watch=false". However, I encountered an error stating:
ERROR [launcher]: No binary for Chrome browser on your platform. 17:12:26
Please, set "CHROME_BIN" env variable.
In an attempt to resolve this, I tried to utilize PhantomJS browsers for running the tests. However, when running the tests locally, I encountered the following errors:
✔ Browser application bundle generation complete.
20 02 2024 17:14:02.496:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9876/
20 02 2024 17:14:02.497:INFO [launcher]: Launching browsers PhantomJS with concurrency unlimited
20 02 2024 17:14:02.499:INFO [launcher]: Starting browser PhantomJS
20 02 2024 17:14:04.209:INFO [PhantomJS 2.1.1 (Mac OS 0.0.0)]: Connected on socket ByBY8ktapjcIdKf6AAAB with id 17854113
PhantomJS 2.1.1 (Mac OS 0.0.0) ERROR
SyntaxError: Unexpected token ')'
at http://localhost:9876/_karma_webpack_/runtime.js:1:0
PhantomJS 2.1.1 (Mac OS 0.0.0) ERROR
SyntaxError: Unexpected token ')'
at http://localhost:9876/_karma_webpack_/polyfills.js:8:0```
These errors seem to indicate syntax issues within the JavaScript files being executed by PhantomJS during the test process.
Github Repo URL: https://github.com/shivanshkr/demo