79211118

Date: 2024-11-21 12:24:33
Score: 0.5
Natty:
Report link

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.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: user27793975