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

Windows - path case sensitivity #4644

Closed
peterdanis opened this issue Oct 10, 2017 · 7 comments · Fixed by #4730
Closed

Windows - path case sensitivity #4644

peterdanis opened this issue Oct 10, 2017 · 7 comments · Fixed by #4730

Comments

@peterdanis
Copy link
Contributor

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Running jest -o and jest --watch in the same directory, but with different lower/upper case letters in preceding path to the folder produces different outcomes.

Correct full path is D:\Projects\Temp\my-js-learning

Outcome:

  • with correct path Jest picks up changed file
  • with an incorrect case in working dir - Jest picks up changed file
    (D:\Projects\Temp\My-js-learning)
  • with an incorrect lower/uppec case letter in any dir preceding working dir - Jest does not pick up changed file
    (D:\ProjectS\Temp\my-js-learning)
    (D:\Projects\temp\my-js-learning)
    (D:\projects\Temp\my-js-learning)

image

Same issue on second Windows machine:

  • C:\users... and C:\Users...
    image

What is the expected behavior?
Preceding path should be case-insensitive on Windows.

Tested on two machines. Both in cmd and in powershell.
First:

  • Jest: 21.0.1
  • Windows: 10.0.15063
  • Git: 2.14.1.windows.1
  • Node: v8.6.0
  • Yarn: 1.1.0

Second:

  • Jest: v21.2.1
  • Windows: 6.1.7601
  • Git: 2.14.1.windows.1
  • Node: v6.11.3 and v8.6.0
  • Yarn: 1.1.0
@SimenB
Copy link
Member

SimenB commented Oct 11, 2017

Would you be able to send a PR with a fix (and tests)?

@peterdanis
Copy link
Contributor Author

peterdanis commented Oct 12, 2017 via email

cpojer pushed a commit that referenced this issue Nov 17, 2017
 (#4730)

* Correct project directory path case on Windows

* fixup! Add try-catch block with fallback

* Make only_changed test pass on Windows

* Add test

* Update changelog

* fixup! Simplify original writeFiles change

* fixup! Ignore process.binding flow error

* fixup! Use correct dir

* fixup! Fix lint error
@mbelsky
Copy link
Contributor

mbelsky commented Jun 25, 2019

Hey,

I face same issue on:

  • Windows 10
  • Jest v24.8.0
  • node v10.16.0
  • npm v6.9.0
cmd.exe output
C:\Users\publi\js\js-problems>dir
 Volume in drive C is SYSTEM
 Volume Serial Number is 5D09-2D90

Directory of C:\Users\publi\js\js-problems

06/20/2019 09:42 PM

.
06/20/2019 09:42 PM ..
06/16/2019 07:24 PM 156 .editorconfig
06/16/2019 07:24 PM 28 .gitignore
06/16/2019 08:40 PM .vscode
06/16/2019 07:24 PM 6,241 jest.config.js
06/16/2019 07:24 PM 1,088 LICENSE
06/20/2019 09:42 PM node_modules
06/20/2019 09:39 PM 216,074 package-lock.json
06/24/2019 08:40 PM 875 package.json
06/16/2019 09:19 PM problems
06/16/2019 08:49 PM 6,310 README.md
06/16/2019 08:40 PM static
7 File(s) 230,772 bytes
6 Dir(s) 138,667,102,208 bytes free

C:\Users\publi\js\js-problems>npx jest --findRelatedTests c:\Users\publi\js\js-problems\problems\001-sum.js
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: c:\Users\publi\js\js-problems\problems\001-sum.js - 0 matches

C:\Users\publi\js\js-problems>npx jest --findRelatedTests C:\Users\publi\js\js-problems\problems\001-sum.js
FAIL problems/tests/001.js (5.058s)
× Тестирование задачи "001-sum" (4011ms)

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

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

Expected: 3
Received: 1

   5 |     expect(sum(0)).toBe(1);
   6 |     expect(sum(1)).toBe(1);
>  7 |     expect(sum(2)).toBe(3);
     |                    ^
   8 |     expect(sum(5)).toBe(15);
   9 | });
  10 |

  at Object.toBe (problems/__tests__/001.js:7:20)

Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 5.125s, estimated 6s
Ran all test suites related to files matching /C:\Users\publi\js\js-problems\problems\001-sum.js/i.

There is a little difference between two jest runs: first time the disk letter is lower-cased and second is upper-cased.

@netcoding87
Copy link

I want to join the party with exactly same issue :)

  • Windows 10 (Build 17763)
  • Jest v24.8.0
  • node v10.16.0
  • yarn v1.17.3

Running jest --findRelatedTests <filepath> with lower-cased disk letter does not find any test... Can anyone help?

@SimenB
Copy link
Member

SimenB commented Sep 2, 2019

This issue is closed, please open up a new issue with reproduction steps.

Note than none on the team uses windows, so we'll have to rely on the community to come up with a fix here. We run CI on Windows, so any fixes including tests should make sure we don't regress

@mbelsky
Copy link
Contributor

mbelsky commented Sep 2, 2019

I've created #8900 for this.

@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 11, 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.

4 participants