My app passes all the tests in Circle CI. However, after it passes it just hangs there until it times out at 10 minutes, and eventually deemed failed.
Tests do pass locally. I get:
Test Suites: 1 failed, 11 passed, 12 total
Tests: 1 failed, 55 passed, 56 total
Snapshots: 2 obsolete, 10 passed, 10 total
Time: 11.196 s
Ran all test suites matching /a|q/i.
Active Filters: filename /a|q/
› Press c to clear filters.
Watch Usage
› Press a to run all tests.
› Press f to run only failed tests.
› Press o to only run tests related to changed files.
› Press u to update failing snapshots.
› Press q to quit watch mode.
› Press p to filter by a filename regex pattern.
› Press t to filter by a test name regex pattern.
› Press Enter to trigger a test run.
at the end in my local terminal. Then I would press ‘ctrl c’.
I get the same thing in Circle CI:
Test Suites: 1 failed, 10 passed, 11 total
Tests: 1 failed, 49 passed, 50 total
Snapshots: 2 obsolete, 9 passed, 9 total
Time: 10.752 s
Ran all test suites matching /a/i.
Active Filters: filename /a/
› Press c to clear filters.
Watch Usage
› Press a to run all tests.
› Press f to run only failed tests.
› Press o to only run tests related to changed files.
› Press u to update failing snapshots.
› Press q to quit watch mode.
› Press p to filter by a filename regex pattern.
› Press t to filter by a test name regex pattern.
› Press Enter to trigger a test run.
Too long with no output (exceeded 10m0s): context deadline exceeded
except for the last line.
This is my config.yml:
version: 2.1
orbs:
node: circleci/node@4.7.0
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
build:
docker:
- image: 'circleci/node:latest'
steps:
- checkout
- run:
name: "npm install"
command: sudo npm install
- run:
name: "npm build"
command: sudo npm run build
test:
docker:
- image: 'circleci/node:latest'
steps:
- checkout
- run:
name: "npm install"
command: sudo npm install
- run:
name: "npm test"
command: sudo npm test a
workflows:
build_and_test:
jobs:
- build
- test:
requires:
- build
build works fine. All spacing/linting are correct.
These are the commands in package.json:
"scripts": {
"begin": "react-scripts start && node server/server.js",
"start": "node server/server.js",
"build": "react-scripts --openssl-legacy-provider build",
"eject": "react-scripts eject",
"test": "react-scripts test",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install && npm run build"
},
I have also tried adding
- run: q
after the test line in .yml file, but it won’t even get to the ‘run q’ because ‘sudo npm test a’ does not end as mentioned above.
I have also tried adding ‘–forceExit’ in the yml file: ‘sudo npm test a --forceExit’.
I have also trird adding ‘–forceExit’ to the package.json’s test command: “test”: “react-scripts test --forceExit”
They both don’t work
I would really appreciate any advice. Thanks!
UPDATE)
I have added --watchAll=false at the end of npm test command in package.json.
Now, test does end in CI, but with
‘Exited with code exit status 1’
and test fails in CI even though all tests pass…