jest: Jest 26.2.1 regression: “No tests found” on Windows

🐛 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 

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 10
  • Comments: 23 (14 by maintainers)

Most upvoted comments

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

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.

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.

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.

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?