Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 445
Kevin Farrugia Avatar asked May 29 '18 17:05

Kevin Farrugia


2 Answers

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

npm install jest-junit
like image 127
Tuula Avatar answered Nov 13 '22 14:11

Tuula


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"
like image 7
Kevin Farrugia Avatar answered Nov 13 '22 12:11

Kevin Farrugia