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

Jest 26.2.1 regression: “No tests found” on Windows #10339

Closed
ai opened this issue Jul 30, 2020 · 23 comments · Fixed by #10346
Closed

Jest 26.2.1 regression: “No tests found” on Windows #10339

ai opened this issue Jul 30, 2020 · 23 comments · Fixed by #10346

Comments

@ai
Copy link
Contributor

ai commented Jul 30, 2020

🐛 Bug Report

In PostCSS we found a problem with the new Jest release. After updating Jest to 26.2.1, Jest stopped to see tests on Windows in our Travis CI.

$ npx jest

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
No files found in C:\Users\travis\build\postcss\postcss.
Make sure Jest's configuration does not exclude this directory.
To set up Jest, make sure a package.json file exists.
Jest Documentation: facebook.github.io/jest/docs/configuration.html
Pattern:  - 0 matches
The command "npx jest" exited with 1.

To Reproduce

Seems like just call npx jest on Windows. Here is a config to call it on Travis CI

matrix:
  include:
    os: windows
    cache: false
    node_js: node
    script: npx jest
    env:
      - YARN_GPG=no

Expected behavior

https://travis-ci.org/github/postcss/postcss/jobs/713424784

Link to repl or repo (highly encouraged)

https://github.com/postcss/postcss/archive/8722140c5c55530b0c4091190f1557b42fd18c87.zip

envinfo

  System:
    OS: Windows 10 10.0.17763
    CPU: (2) x64 Intel(R) Xeon(R) CPU
  Binaries:
    Node: 14.7.0 - C:\ProgramData\nvs\node\14.7.0\x64\node.EXE
    Yarn: 1.22.4 - ~\.yarn\bin\yarn.CMD
    npm: 6.14.7 - C:\ProgramData\nvs\node\14.7.0\x64\npm.CMD
  npmPackages:
    jest: ^26.2.1 => 26.2.1 
@ahnpnl
Copy link
Contributor

ahnpnl commented Jul 30, 2020

Strange thing that even ts-jest hasn’t updated to jest 26.2.x but also saw the same issue https://travis-ci.com/github/kulshekhar/ts-jest/jobs/366826311

The issue occured right after 26.2 was released and CI still uses 26.1, and of course all PRs by dependabot to upgrade to jest 26.2 failed with the same reason.

The issue however only happens to ts-jest node 14 tests on external projects, unit tests on node 10 Windows work fine https://travis-ci.com/github/kulshekhar/ts-jest/jobs/366826310

@ahnpnl
Copy link
Contributor

ahnpnl commented Jul 30, 2020

Seem like PostCSS and ts-jest CIs both failed with Node 14 Windows

@sr258
Copy link

sr258 commented Jul 31, 2020

This affects me as well. I use Windows with Node v12.18.3 and Jest v26.2.1. Ts-Jest is at 26.1.4.

@SimenB
Copy link
Member

SimenB commented Jul 31, 2020

I don't have access to a windows machine, unfortunately, so hard for me to debug this... Our own Windows CI passes on both GH Actions and Azure Pipelines, so I wonder if this is some weird config thing?

Does it just happen with ts-jest?

@ai
Copy link
Contributor Author

ai commented Jul 31, 2020

@SimenB yeap, we have TypeScript tests too

@ahnpnl
Copy link
Contributor

ahnpnl commented Jul 31, 2020

I tried to run ts-jest CI on tag 26.1.4 (which is the latest release) also failed with Windows Node 14. Tag 26.1.4 doesn't use jest 26.2 for e2e tests https://github.com/kulshekhar/ts-jest/blob/220f4fbfd2544ad23af494c2d5acd53d28fdac74/e2e/__external-repos__/custom-typings/yarn.lock#L296

The only clue I have is CI didn't fail with 26.1 until 26.2 released

@SimenB
Copy link
Member

SimenB commented Jul 31, 2020

I'm guessing this is somehow related to #10308 - only windows change I can think of (although it's weird that our own tests pass...).

Does anyone here use Windows on their own machine, or have the possibility to test? If so, try reverting this change

image

in node_modules/jest-haste-map/build/crawlers/node.js. That should force an fs crawl using Node's APIs rather than using find on windows

@ahnpnl
Copy link
Contributor

ahnpnl commented Jul 31, 2020

I think maybe an alpha version so we can point CI to it ?

@SimenB
Copy link
Member

SimenB commented Jul 31, 2020

I'd rather avoid it if possible, but not a huge issue if no one here has a Windows machine

@raviteja64
Copy link

raviteja64 commented Jul 31, 2020

Tests not being detected on WIndows. I use yarn, ts-jest for typescript.

Do we have an interim solution for windows?
Version is automatically being pointed to 26.2.1 even thought i explicitly mention ~26.1.0

@SimenB
Copy link
Member

SimenB commented Jul 31, 2020

Interim solution is to revert the upgrade commit if you have a lockfile. For fresh installs you could try to use resolutions

@ritterzk
Copy link

I'm guessing this is somehow related to #10308 - only windows change I can think of (although it's weird that our own tests pass...).

Does anyone here use Windows on their own machine, or have the possibility to test? If so, try reverting this change

image

in node_modules/jest-haste-map/build/crawlers/node.js. That should force an fs crawl using Node's APIs rather than using find on windows

yes, as soon as you undo the change, it will run on Windows systems again.

@SimenB
Copy link
Member

SimenB commented Jul 31, 2020

I was able to find the old windows images from modern.ie, and was able to confirm it. I'll try a couple of minutes to fix detection properly, if not I'll re-add the condition 👍 I'm very confused by why our CI passes with the changes...

@SimenB
Copy link
Member

SimenB commented Jul 31, 2020

https://github.com/facebook/jest/releases/tag/v26.2.2

@ahnpnl
Copy link
Contributor

ahnpnl commented Jul 31, 2020

Thanks a lot Simen !!, I see our CI is green again

@pglejzer
Copy link

Thanks, I also had problems with my tests after upgrade to version 26.2.1 but with 26.2.2 everything is working again. Thanks again.

@G-Rath
Copy link
Contributor

G-Rath commented Sep 9, 2020

@SimenB stumbled on this while lazily scrolling through the issues - I dev on Windows (w/ WSL for CLI) so feel free to ping me on future Windows issues if you'd like :)

@SimenB
Copy link
Member

SimenB commented Sep 9, 2020

Thanks @G-Rath! Will do 🙂

@arose
Copy link

arose commented Nov 26, 2020

Hi, I still have this issue with 26.2.2 or later on one of my windows machines (on others it does work). On the machine where it does not work, I can make it work by manually changing forceNodeFilesystemAPI in jest-haste-map (packages/jest-haste-map/src/crawlers/node.ts) to true.

@exaucae
Copy link

exaucae commented Jan 22, 2021

Hi there,

I'm facing the exact same error aforementioned. on my local machine.

I'm using CRA and the following packages:
jest:: 26.6.3
jest-transform-stub: 2.0.0,
@testing-library/jest-dom: 5.11.4
@testing-library/react: 11.1.0
@testing-library/user-event: 12.1.10
@types/jest: 26.0.15
ts-jest: 26.4.4

System:
OS: Microsoft Windows [Version 10.0.18363 N/A Build 18363]
CPU: (2) x64 IIntel64 Family 6 Model 142 Stepping 10 GenuineIntel ~1910 Mhz
Binaries:
typescript: 4.1.3
npx: 6.14.11
Node: 14.7.0
Yarn: 1.22.10
npm: 6.14.11

All tests are ran Mac os, docker container and CI ( with ubuntu image).
Sounds like the issue is from the Windows OS compatibility. Looking for any clue.

@Martibis
Copy link

Martibis commented Feb 1, 2021

Same issue here

@exaucae
Copy link

exaucae commented Apr 4, 2021

It's odd that no one pays attention our demand. It's been 3 months since my post.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.