Skip to content

findRelatedTests is case-insensitive on Windows

🐛 Bug Report

To Reproduce

Steps to reproduce the behavior:

  • Clone
  • Replace return undefined; with return -1; in problems/001-sum.js
  • git add .
  • npx jest --findRelatedTests Problems/001-sum.js. Note: the real path to the file is problems/001-sum.js - the first letter is lowercased
Output:
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
No files found in C:\Users\publi\js\js-problems.
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: Problems\\001-sum.js - 0 matches

Expected behavior

 FAIL  problems/__tests__/001.js
  × Тестирование задачи "001-sum" (1008ms)

● Тестирование задачи "001-sum"

expect(received).toBe(expected) // Object.is equality

Expected: 1
Received: -1

  2 | 
  3 | test('Тестирование задачи "001-sum"', () => {
> 4 |     expect(sum(-100)).toBe(1);
    |                       ^
  5 |     expect(sum(0)).toBe(1);
  6 |     expect(sum(1)).toBe(1);
  7 |     expect(sum(2)).toBe(3);

  at Object.toBe (problems/__tests__/001.js:4:23)

Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: 2.226s Ran all test suites related to files matching /Problems\001-sum.js/i.

Link to repo

npx envinfo --preset jest results

  System:
    OS: Windows 10
    CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
  Binaries:
    Node: 10.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.16.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD