How to configure TeamCity using Mocha?

I have a project that I am setting up through teamcity for CI. The project itself is a nodejs application, and it includes a test written in mocha, which we look through jscoverage. In the build configuration that I configure, I have 3 build steps that occur during registration.

  • call jscoverage.exe against the folders in my project that I am covering.

  • call mocha to run the test against jscovered files from step 1 and output to the html-cov reporter

  • move the generated report report.html to the public web directory for later viewing.

At stage 2, assembly is not performed: mocha "is not in the C: \ NodeJS \ MeasuresAPI directory

I have included mocha and all my node packages in the path to the system environment, and I can access them on the command line, but TeamCity does not see them.

for jscoverage.exe, I had to include the full path. In mocha, I tried to include the path to my global node installation where mocha is installed, but this gives me an error:

".. \ node_modules \ mocha \ bin \ mocha" (in the directory "C: \ NodeJS \ MeasuresAPI"): Error CreateProcess = 193,% 1 is not a valid Win32 application

Has anyone had any experience with Teamcity and Mocha and how to make them play well? or any ideas for continuous integration with nodejs, mocha stack?

+7
source share
1 answer

Yes, it happened to me when I configured TeamCity to run mocha on Windows Server. The solution was to call mocha by specifying the path to the bat mocha.cmd file. For example, if you have a C: \ mocha folder and you run npm install mocha

in this directory than the path to the bat file will be

C: \ mocha \ node_modules.bin \ mocha.cmd

And you can tell Teamcity to execute the mocha command by specifying the following statement:

C: \ mocha \ node_modules.bin \ mocha --ui tdd --reporter html-cov test \ measureDBTests.js> coverage.html

+6
source

All Articles