Kevin Farrugia
Kevin Farrugia

Reputation: 7439

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

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.

Upvotes: 17

Views: 31263

Answers (2)

Kevin Farrugia
Kevin Farrugia

Reputation: 7439

Found the solution and it was the removal of inverted commas.

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

should become

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

Upvotes: 8

Tuula
Tuula

Reputation: 326

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

npm install jest-junit

Upvotes: 15

Related Questions