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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshots are different on linux and windows when contain \\ #9614

Closed
alexander-akait opened this issue Feb 25, 2020 · 7 comments
Closed

Snapshots are different on linux and windows when contain \\ #9614

alexander-akait opened this issue Feb 25, 2020 · 7 comments

Comments

@alexander-akait
Copy link
Contributor

馃悰 Bug Report

Snapshoting RegExp on windows and linux are difference when it is contains \\.

To Reproduce

describe("regexp", () => {
	it("should work", () => {
		expect({ test: /[\\/]node_modules[\\/]/ }).toMatchInlineSnapshot();
	});
});

Expected behavior

Snapshots should escaped property and equally on windows and linux

Link to repl or repo (highly encouraged)

Original issue: webpack/webpack#10443

envinfo

npx: installed 1 in 2.375s

  System:
    OS: Linux 5.3 Ubuntu 19.10 (Eoan Ermine)
    CPU: (6) x64 AMD FX(tm)-6300 Six-Core Processor
  Binaries:
    Node: 10.15.2 - /usr/bin/node
    Yarn: 1.13.0 - /usr/bin/yarn
    npm: 6.13.7 - /usr/local/bin/npm
  npmPackages:
    jest: ^25.1.0 => 25.1.0 

Additional information: there were no problems using jest@24, looks like it is a regression

@SimenB
Copy link
Member

SimenB commented Feb 25, 2020

@pedrottimark ideas?

@SimenB
Copy link
Member

SimenB commented Feb 26, 2020

The regexp part of pretty-format hasn't changed for years

https://github.com/facebook/jest/blob/003bd50afaf0022381ffa9eb30abd511fad2ed2e/packages/pretty-format/src/index.ts#L157-L163

image

So I'm not sure where to begin looking into this... Maybe the equality function just lies? It was tweaked in #9167. RegExp equality went from

    return (
        a.source == b.source &&
        a.global == b.global &&
        a.multiline == b.multiline &&
        a.ignoreCase == b.ignoreCase
      );

to

return a.source === b.source && a.flags === b.flags;

I wouldn't expect that to result in this change, though...
@jeysal ideas?

@alexander-akait
Copy link
Contributor Author

@SimenB I can spent my time on searching a problem, I'm afraid that it will take me more time for me, so I created the problem, suddenly there are some known potential problem areas

@jeysal
Copy link
Contributor

jeysal commented Feb 26, 2020

Hmm I'd be surprised if it was related to that too. It should only matter for flags other than those 3

@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Feb 25, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions
Copy link

github-actions bot commented May 1, 2022

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 1, 2022
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