question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JEST tests complete successfully but returns exit status 1

See original GitHub issue

I run JEST tests using npm run test:jest and the corresponding entry in package.json is

"test:jest": "jest --config=./jest.config.js",

All tests run successfully, but returns with exit code 1

Test Suites: 1 skipped, 106 passed, 106 of 107 total
Tests:       10 skipped, 657 passed, 667 total
Snapshots:   14 files obsolete, 0 total
Time:        34.453s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @vc/toolchain@3.3.0 test:jest: `jest --config=./jest.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @vc/toolchain@3.3.0 test:jest 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!     /home/.npm/_logs/2019-12-18T13_01_11_869Z-debug.log

10 silly lifecycle @vc/toolchain@3.3.0~test:jest: Args: [ '-c', 'jest --config=./jest.config.js' ]
11 silly lifecycle @vc/toolchain@3.3.0~test:jest: Returned: code: 1  signal: null
12 info lifecycle @vc/toolchain@3.3.0~test:jest: Failed to exec test:jest script
13 verbose stack Error: @vc/toolchain@3.3.0 test:jest: `jest --config=./jest.config.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:915:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid @vc/toolchain@3.3.0
15 verbose cwd /workspace/vc.src/vco/src/server/node
16 verbose Linux 3.13.0-163-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test:jest"
18 verbose node v8.17.0
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error @vc/toolchain@3.3.0 test:jest: `jest --config=./jest.config.js`
22 error Exit status 1
23 error Failed at the @vc/toolchain@3.3.0 test:jest script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I am not sure why the process exits with status code 1 even though all tests pass.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:60
  • Comments:84

github_iconTop GitHub Comments

63reactions
corsikcommented, Jun 8, 2020

Snapshots: 3 obsolete, 26 passed, 26 total obsolete - are the cause of the error, after their removal, the error is gone.

52reactions
thymikeecommented, Dec 18, 2019

Repro please, or it didn’t happen

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it standard for Jest to exit with a status 1 if any test fails?
It is pretty much universal behaviour for any process to exit with a non-zero exit code if things went wrong. · No, npm...
Read more >
Configuring Jest
By default, Jest runs all tests and produces all errors into the ... reporters can force Jest to exit with non zero code...
Read more >
Testing process.exit with Jest in NodeJS - tsmx
Demonstrating a pragmatic way on how to test code paths resulting in process.exit using the Jest test library. Table of Contents.
Read more >
Job fails because of console.error - GitLab CI/CD
The tests succeed but the job fails with exit code 1. When I run npm run test on my local machine it returns...
Read more >
Run jest for unit tests of modified files only | by SunCommander
This is a really good package for building a command-line interface. It is primarily used for parsing the arguments given by the user....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found