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

File paths shouldn't be reported with backslashes #6370

Closed
JoshuaKGoldberg opened this issue May 31, 2018 · 7 comments
Closed

File paths shouldn't be reported with backslashes #6370

JoshuaKGoldberg opened this issue May 31, 2018 · 7 comments

Comments

@JoshuaKGoldberg
Copy link
Contributor

🐛 Bug Report

On Windows, file paths in tests reports on the CLI are reported using backslashes (likely from the default path.join):

$ jest
 FAIL  src\my\directory\File.test.ts
    MyContents
      ...

That's inconvenient because you can't run jest <path-to-file> to run just that file.

  • ✔ works: jest src/my/directory/File.test.ts
  • ❌ no matches: jest src\my\directory\File.test.ts

To Reproduce

Steps to reproduce the behavior:

  1. Create a test file within a directory
  2. On Windows, run jest or any flags variant that runs that file
  3. Copy & paste the file contents from the reporter as a matcher to jest on the CLI
  4. Observe no matches

Expected behavior

Less proliferation of the inconvenience that is the backslash!

Run npx envinfo --preset jest

Paste the results here:

 System:
    OS: Windows 10
    CPU: x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
  Binaries:
    Yarn: 1.5.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 3.10.10 - C:\Code\WebClient\node_modules\.bin\npm.CMD
@SimenB
Copy link
Member

SimenB commented Jun 1, 2018

This should be the case in jest 23.1.0 and up, #6310

@SimenB SimenB closed this as completed Jun 1, 2018
@SimenB
Copy link
Member

SimenB commented Jun 1, 2018

Wait no - we report with slash, but I suppose we still match on backslash?

@SimenB
Copy link
Member

SimenB commented Jul 3, 2018

@JoshuaKGoldberg can you confirm if this is still an issue with latest Jest?

@JoshuaKGoldberg
Copy link
Contributor Author

I cannot confirm if this is an issue because I cannot run unit tests anymore. 🤷‍ #6546

@ruapho
Copy link

ruapho commented Dec 6, 2018

I can confirm this:
✔️ node .\node_modules\jest\bin\jest.js server/modules/file/file.stream.service.test.ts
==> Test Suites: 1 passed, 1 total

node .\node_modules\jest\bin\jest.js server\modules\file\file.stream.service.test.ts
==> Pattern: server\modules\file\file.stream.service.test.ts - 0 matches

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
  Binaries:
    Node: 10.14.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.12.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD

Using "jest": "23.6.0" with "ts-jest": "23.10.5"

@SimenB
Copy link
Member

SimenB commented Dec 6, 2018

Ok, so it works like intended, then? We use forward slash in the reports, and if we use forward slash in the matching as well, then we're good.

Closing, but if I misunderstood I'm happy to reopen

@SimenB SimenB closed this as completed Dec 6, 2018
@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 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants