I have jest and jest-puppeteer setup to run tests. Running tests is simple enough using:
jest test.test --config="path/to/config.json"
However when I put this into the package.json:
...
"scripts": {
"test:jest": "jest test.test --config=\"path/to/config.json\""
},
...
And then run:
npm run test:jest
The test runs normally, but then I get the following error at the end:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test@1.0.0 jest:temp: `jest test.test --config="path/to/config.json"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test@1.0.0 jest:temp script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/obihill/.npm/_logs/2020-04-23T12_18_23_546Z-debug.log
After doing some research, I found out that this is because some tests might be failing. Sure enough, I setup all tests to pass, and the error no longer appears.
The issue I have is that I need to run this test and then a second test in sequence:
npm run test:jest && npm run test:postjest
But because of the failing tests and the resulting ELIFECYCLE
code, the second command never gets run. After some research, I found a way to suppress the errors. So now I run the following:
npm run test:jest --silent && npm run test:postjest
And there are no errors, but test:postjest
never runs. All the tests have to pass in test:jest
for the second command to run.
Is there a way to override this behavior and enable npm run test:postjest
to run in sequence regardless?