Reputation: 1857
I have a NodeJs application. Currently I am using team city for build and deployment of this application. Now I want to run unit test cases before deployment. I have used Mocha framework with Chai to write test cases. I don't see any runner type for Mocha or Node Js in team city.
I know some plugin is needed to be installed on teamcity server.
does any one know what is the plugin and what steps I need to follow?
Upvotes: 3
Views: 4629
Reputation: 1772
You don't have to install any specific TeamCity plugin, you have to use test reporter capable of writing TeamCity service messages, e.g. mocha-teamcity-reporter, which is just another npm package.
You'll get you tests consumed by TeamCity after you run mocha --reporter mocha-teamcity-reporter test
in your build step, so Command-Line Runner
may be used for this purpose.
It is a good practice to extract this command to a separate script in your package.json
, e.g:
"test:ci": "mocha --reporter mocha-teamcity-reporter test"
and use npm run test:ci
in your build step.
Upvotes: 8