17

I have setup jest and jest-junit as the reporter and followed the simple instructions given by jest-junit.

This includes npm install jest --save-dev and npm install jest-junit --save-dev

My package.json looks like this (excerpt):

  "devDependencies": { 
    "jest": "^22.4.4",
    "jest-junit": "^4.0.0",
  },
  "scripts": {
    "test": "jest --ci --testResultsProcessor='jest-junit'"
  },
  "jest": {
    "verbose": true,
    "testResultsProcessor": "jest-junit"
  },
  "jest-junit": {
    "suiteName": "Test Suite",
    "output": "./junit.xml"
  }

When running npm run test on my machine (OSX), it works well. When running it as part of the CI build process or on another Windows machine, I am getting the following error:

Module 'jest-junit' in the testResultsProcessor option was not found.

2 Answers 2

16

Maybe you just need to install the missing module to the other machine:

npm install jest-junit
Sign up to request clarification or add additional context in comments.

2 Comments

Edited original question. Included jest-junit as a devDependency and run npm install (without error) prior to running npm run test
In my case it's worked fine with yarn add jest-junit ...
8

Found the solution and it was the removal of inverted commas / apostrophes (') around jest-junit.

"test": "jest --ci --testResultsProcessor='jest-junit'"

should become

"test": "jest --ci --testResultsProcessor=jest-junit"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.