jest
jest copied to clipboard
[Bug]: v30-alpha.5 TestPathPatterns pattern-match regression
Version
30.0.0-alpha.5
Steps to reproduce
This can be demonstrated with jest's own examples/getting-started
on a Window vscode powershell terminal:
- clone https://github.com/jestjs/jest
- copy the
examples/getting-started
to a new folder outside of Jest, so we can change the jest version freely. - goto this standalone
getting-started
folder - edit
package.json
to change thejest
andbabel-jest
versions to30.0.0-alpha.5
- yarn install
- run a specific test like this in a powershell terminal:
> yarn jest --testLocationInResults --testNamePattern "adds 1 \+ 2 to equal 3$" --no-coverage --colors --watchAll=false --testPathPatterns "c:\\Users\\dev\\github\\open-source\\getting-started\\sum\.test\.js"
Expected behavior
Expect this to work just like with jest 29.x.
Edit package.jso
n to update jest
and babel-jest
to 29.7.0
; run yarn install
then run the command again (replacing --TestPathPatterns
with --TestPathPattern
):
PS C:\Users\dev\github\open-source\getting-started> yarn jest --testLocationInResults --testNamePattern "adds 1 \+ 2 to equal 3$" --no-coverage --colors --watchAll=false --testPathPattern "c:\\Users\\dev\\github\\open-source\\getting-started\\sum\.test\.js"
js";dbee3b2e-0ab6-4105-a99f-3a96e3b4cf5eyarn run v1.22.19 i
$ C:\Users\dev\github\open-source\getting-started\node_modules\.bin\jest --testLocationInResults --testNamePattern "adds 1 \+ 2 to equal 3$" --no-coverage --colors --watchAll=false --testPathPattern c:\\Users\\dev\\github\\open-source\\getting-started\\sum\.test\.js
PASS ./sum.test.js
√ adds 1 + 2 to equal 3 (2 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.669 s, estimated 1 s
Ran all test suites matching /c:\\Users\\dev\\github\\open-source\\getting-started\\sum\.test\.js/i with tests matching "adds 1 \+ 2 to equal 3$".
Done in 1.23s.
Actual behavior
the pattern match failed so no test is run:
PS C:\Users\dev\github\open-source\getting-started> yarn jest --testLocationInResults --testNamePattern "adds 1 \+ 2 to equal 3$" --no-coverage --colors --watchAll=false --testPathPatterns "c:\\Users\\dev\\github\\open-source\\getting-started\\sum\.test\.js"
yarn run v1.22.19
$ C:\Users\dev\github\open-source\getting-started\node_modules\.bin\jest --testLocationInResults --testNamePattern "adds 1 \+ 2 to equal 3$" --no-coverage --colors --watchAll=false --testPathPatterns c:\\Users\\dev\\github\\open-source\\getting-started\\sum\.test\.js
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In C:\Users\dev\github\open-source\getting-started
4 files checked.
testMatch: **/__tests__/**/*.?([mc])[jt]s?(x), **/?(*.)+(spec|test).?([mc])[jt]s?(x) - 1 match
testPathIgnorePatterns: \\node_modules\\ - 4 matches
testRegex: - 0 matches
Pattern: c:\\Users\\dev\\github\\open-source\\getting-started\\sum\.test\.js - 0 matches
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Additional context
- This issue only occurs on Windows. It works as expected on macOS, as far as I can tell.
- Also noticed jest seems to perform a case-insensitive match for TestPathPattern in v29.x. Can't tell if v30 is doing the same.
Environment
System:
OS: Windows 10 10.0.19045
CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
Binaries:
Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
npmPackages:
jest: ^30.0.0-alpha.5 => 30.0.0-alpha.5