Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run tests in .github/actions on Windows #1096

Open
nbolton opened this issue Nov 30, 2023 · 1 comment
Open

Unable to run tests in .github/actions on Windows #1096

nbolton opened this issue Nov 30, 2023 · 1 comment

Comments

@nbolton
Copy link

nbolton commented Nov 30, 2023

Environment

  1. vscode-jest version: v5.2.3
  2. node -v: v18.17.0 (direct install for testing; didn't use fnm/nvm)
  3. npm -v or yarn --version: npm 9.6.7
  4. npm ls jest or npm ls react-scripts:
├─┬ @testing-library/[email protected]
│ └── [email protected] deduped
├── [email protected]
└─┬ [email protected]
  └── [email protected] deduped
  1. your vscode-jest settings if customized:
    • jest.jestCommandLine? Not set
    • jest.autoRun?
  "jest.autoRun": {
    "watch": false,
    "onSave": "test-src-file"
  },
  1. Operating system: Windows (works fine on macOS and Linux)

Prerequisite

  • are you able to run jest test from the command line? Yes, by copying and pasting the same generated command.
  • how do you run your tests from the command line? Works by simply running jest

Steps to Reproduce

  1. Have a .github/actions dir with unit tests
  2. Use the extension on macOS and Linux
  3. See that the .github tests pass
  4. Use the extension on Windows
  5. See that the .github tests fail

Expected Behavior

The workaround is to copy and paste the exact generated command from the Jest extension output directly to the terminal, which produces:

Test Suites: 2 passed, 2 total
Tests:       14 passed, 14 total
Snapshots:   0 total
Time:        2.658 s, estimated 6 s
Ran all test suites matching /c:\\project\\\.github/i

Actual Behavior

The command line generated is:
jest --testLocationInResults --json --useStderr --outputFile C:\Users\username\AppData\Local\Temp\jest_runner_project_username_2.json --coverage --reporters default --reporters c:\Users\username\.vscode\extensions\orta.vscode-jest-5.2.3\out\reporter.js --colors --watchAll=false --testPathPattern c:\\project\\\.github

Note: Values edited (e.g. project and username) for privacy.

Which produces:

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In C:\project
  453 files checked across 8 projects. Run with `--verbose` for more details.
Pattern: c:\project\\.github - 0 matches

The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...

@connectdotz
Copy link
Collaborator

hmm... this might be a bug... can you try to run the generated command directly in the terminal? Does it give you the same error? If it does, can you try to add one more backslash for the "testPathPattern": --testPathPattern c:\\project\\\\.github and see if that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants