Instead of using the npm command, test the code using the correct testing method found in your package.json
file.
For example, if the command in the package.json
file is: "test": "jest --watchAll --runInBand --detectOpenHandles"
, the correct .github/workflows/testing.yml
file would be:
name: Run Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Dependencies
run: npm install
- name: Run tests
run: npx jest --runInBand --detectOpenHandles --forceExit
Don't use the --watchAll
command as this could lead to the issue you were facing. Use the --forceExit
command in the .github/workflows/testing.yml
file to ensure the testing is exited.
This way, you can keep the command in the package.json
file the same and can continue testing the app on your local machine in the same way.