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

test: allow more tests to run on windows #10351

Merged
merged 4 commits into from Aug 2, 2020
Merged

test: allow more tests to run on windows #10351

merged 4 commits into from Aug 2, 2020

Conversation

G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Aug 1, 2020

Summary

Closes #3121 (mostly) - the only two outstanding are the yarn pnp test & an open handles test.

Test plan

See if Windows runs in CI passes after adjusting the relevant tests.

@SimenB
Copy link
Member

SimenB commented Aug 1, 2020

Yay! Better coverage on Windows is wonderful

@G-Rath
Copy link
Contributor Author

G-Rath commented Aug 1, 2020

For sure, although jest-haste-map had me in a bit of state by the end of it... 😵😵😵

it('does not report --notify flag', () => {
if (process.platform === 'win32') {
Copy link
Contributor Author

@G-Rath G-Rath Aug 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only test aside from the yarn pnp one that is now being skipped on Windows 🎉

Open to ideas on if anything can be done to eliminate it - I suspect it represents an actual "bug" (/ maybe just something that can't be supported?)

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay, thank you so much!

@@ -30,7 +27,9 @@ test('CLI accepts exact file names if matchers matched', () => {

expect(result.exitCode).toBe(0);

const {rest, summary} = extractSummary(result.stderr);
const {rest, summary} = extractSummary(
result.stderr.replace('\\\\foo\\\\bar', '\\/foo\\/bar'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we normalize the output of jest instead of normalizing in the test itself?

Copy link
Contributor Author

@G-Rath G-Rath Aug 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, yes but I don't know how much work that'll involve.

However, I don't know if thats a good idea from UX POV, as jest is implicitly normalizing the input - we pass in ./foo/bar.spec.js, which is a Linux style file path (it's actually probably node doing the normalizing, but the result is the same).

By outputting the actual OS-specific file path that was used, users can see that it doesn't matter if they pass in Linux file paths; where as if we normalised them in the output here, personally I'd look at that and think "oh maybe Jest isn't finding my test file because it's using the Linux file path" (especially since copying & pasting the file path into Windows would cause an error, as iirc Powershell, CMD, and Explorer all expect forward slashes).

e2e/__tests__/dependencyClash.test.ts Show resolved Hide resolved
e2e/__tests__/dependencyClash.test.ts Outdated Show resolved Hide resolved
it('does not report --notify flag', () => {
if (process.platform === 'win32') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the same as the skip?

Copy link
Contributor Author

@G-Rath G-Rath Aug 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, as the skip causes all tests in the file to be skipped, but this is the only one that actually fails.

e2e/__tests__/pnp.test.ts Show resolved Hide resolved
@@ -29,14 +29,6 @@ export function skipSuiteOnJestCircus(): void {
}
}

export function skipSuiteOnWindows(): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping this until all skips are resolved seems better to me - easier to find usage 🙂

Copy link
Contributor Author

@G-Rath G-Rath Aug 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was in part for the excitement of it - the two tests that are remaining don't seem like they're going to go away anytime soon (the yarn pnp one at least), and I felt that removing this helper made it harder to justify skipping future tests in Windows.

Happy to add it back 🙂

I remembered the real reason: this helper causes all tests in the file to be skipped, regardless of where it's used.
Of the two tests remaining that would use it, only the yarn pnp one has one test in its file, so using it skips a whole host of other tests that pass on Windows.

Thus, if you take that out of the picture, you're just left with one test that would be using it, and that is unlikely to go away soon from what I understand; I felt that inling it would make it harder to justify skipping tests on Windows in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aight, consider me convinced! 🙂

@SimenB
Copy link
Member

SimenB commented Aug 1, 2020

Windows is falling again 🙂

@G-Rath
Copy link
Contributor Author

G-Rath commented Aug 1, 2020

The failures are in jest-haste-map, which is interesting as nothing should have changed when I dropped the previous commit 🤔

Looking over the code, theres a few paths I've missed, and at the failures, some of them don't surprise me, i.e

   Map {
    -   "\\project\\fruits\\Pear.js" => 0,
    -   "\\project\\fruits\\another\\Pear.js" => 0,
    +   "/project\\fruits\\Pear.js" => 0,
    +   "/project\\fruits\\another\\Pear.js" => 0,
      }

I originally kept the root slash in, thinking it was part of how haste-map worked, but it seems I was just wrong.
I'll keep chipping away at it and hopefully it'll settle down.

@SimenB
Copy link
Member

SimenB commented Aug 2, 2020

@G-Rath mark as ready wehen it is?

@G-Rath
Copy link
Contributor Author

G-Rath commented Aug 2, 2020

@SimenB will do - I'm afk right now but when I'm back I'll squash and mark as ready 🎉🎉

@SimenB
Copy link
Member

SimenB commented Aug 2, 2020

We squash merge, so no worries 🙂

@SimenB SimenB marked this pull request as ready for review August 2, 2020 08:38
@SimenB SimenB changed the title test: allow tests to run on windows test: allow more tests to run on windows Aug 2, 2020
@SimenB SimenB merged commit 683b7e6 into jestjs:master Aug 2, 2020
@SimenB
Copy link
Member

SimenB commented Aug 2, 2020

Thanks!

@github-actions
Copy link

This pull request 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 this pull request may close these issues.

Make all tests pass on Windows
3 participants