Search code examples
continuous-integrationteamcityjestjstest-coverage

Jest Test On TeamCity


I have a react application that uses Jest and jest-teamcity-reporter as a testResultsProcessor enter image description here

my npm test scripts is as follow : enter image description here

the problem is when i run my build in team city which contains test coverage, the test is running but i cannot see the test tab in the result and also the number of test passed. enter image description here in the logs i have the following errors : enter image description here

Please note that i have other projects with the same template and i don't have a problem seeing the test tab and the metrics enter image description here

finally here is my build steps defined in the template enter image description here

Could you please help me with this problem.

Thank you.


Solution

  • You have to add the test result processor in your jest configuration object inside your package.json.

    "testResultsProcessor": "jest-teamcity-reporter"

    To test locally, you need to set a variable in command line : SET TEAMCITY_VERSION=1

    You will see logs lines starting with ##teamcity and that's the metrics you're looking for.