I am using the Jest to perform the unit testing.
"jest": "^26.4.2",
"jest-preset-angular": "^8.3.1"
All the test has been passed and ran but got an error as below
Test Suites: 20 passed, 20 total
Tests: 26 passed, 26 total
Snapshots: 2 obsolete, 5 passed, 5 total
Time: 92.961 s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:app: `jest --config ./jest.app.config.js --no-cache`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test:app 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/macbook/.npm/_logs/2020-09-15T09_19_42_790Z-debug.log
I tried the below command from the google search, however, it is not working
npm cache clean --force
rm -rf node_modules
npm install
error from logs
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'test:app' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretest:app', 'test:app', 'posttest:app' ]
5 info lifecycle [email protected]~pretest:app: [email protected]
6 info lifecycle [email protected]~test:app: [email protected]
7 verbose lifecycle [email protected]~test:app: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~test:app: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp/node_modules/.bin:/usr/local/opt/helm@2/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin
9 verbose lifecycle [email protected]~test:app: CWD: /Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp
10 silly lifecycle [email protected]~test:app: Args: [ '-c', 'jest --config ./jest.app.config.js --no-cache' ]
11 silly lifecycle [email protected]~test:app: Returned: code: 1 signal: null
12 info lifecycle [email protected]~test:app: Failed to exec test:app script
13 verbose stack Error: [email protected] test:app: `jest --config ./jest.app.config.js --no-cache`
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 EventEmitter.emit (events.js:314:20)
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 ChildProcess.emit (events.js:314:20)
13 verbose stack at maybeClose (internal/child_process.js:1051:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/macbook/Projects/Playtime Projects/IDP/Idp.Bx.Ui/idp
16 verbose Darwin 19.6.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test:app"
18 verbose node v14.5.0
19 verbose npm v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] test:app: `jest --config ./jest.app.config.js --no-cache`
22 error Exit status 1
23 error Failed at the [email protected] test:app script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
obsolete - are the cause of the error, after their removal, the error is gone.
Delete the snapshots and rerun the test everything should work fine
Reference - https://github.com/facebook/jest/issues/9324