Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yarn test: all tests passed but returned "error Command failed with exit code 1"

I used to use npm but recently switched to yarn. When I run yarn test it shows all tests passed but below says error Command failed with exit code 1 with no other information on what could have caused this error

node version: 6.3.1

yarn version: 0.16.3

potential cause console.error node_modules/core-js/modules/es6.promise.js:117 Unhandled promise rejection Error: Actions may not be an undefined. at dispatch (/node_modules/redux-mock-store/lib/index.js:35:19) at /node_modules/redux-thunk/lib/index.js:14:16 at dispatch (/node_modules/redux/lib/applyMiddleware.js:45:18) at /src/actions/ontologies.js:159:7 at run (/node_modules/core-js/modules/es6.promise.js:87:22) at /node_modules/core-js/modules/es6.promise.js:100:28 at flush (/node_modules/core-js/modules/_microtask.js:18:9) at process._tickCallback (internal/process/next_tick.js:103:7)

like image 882
danep Avatar asked Dec 05 '16 18:12

danep


People also ask

What is command failed exit code 1?

The AWS Glue job fails with the error "Command failed with exit code 1" and doesn't start. This error occurs when the AWS Glue IAM role doesn't have the required permission to access the AWS Glue ETL script from the Amazon S3 path.

How do you run all tests of yarn?

Press `a` to run all tests, or run Jest with `--watchAll`. Watch Usage › Press a to run all tests. › Press f to run only failed tests. › Press p to filter by a filename regex pattern. › Press t to filter by a test name regex pattern. › Press q to quit watch mode. › Press Enter to trigger a test run.

How do you exit jest test?

--forceExit ​ Force Jest to exit after all tests have completed running. This is useful when resources set up by test code cannot be adequately cleaned up. This feature is an escape-hatch.


2 Answers

In my case, it's caused by snapshots obsolete after some test code changes. So the solution is to delete those test data in the __snapshots__ folder

like image 135
Jianwu Chen Avatar answered Oct 02 '22 09:10

Jianwu Chen


Answer:

the error code was due to line coverage being below the value that I defined (90%). It already told me line coverage 86.8% is below user defined value of 90% so I thought it unlikely that yarn would "double report" that error.

like image 29
danep Avatar answered Oct 02 '22 08:10

danep