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

[Bug]: structuredClone changes type of RegExp #15398

Open
marekdedic opened this issue Dec 4, 2024 · 2 comments
Open

[Bug]: structuredClone changes type of RegExp #15398

marekdedic opened this issue Dec 4, 2024 · 2 comments

Comments

@marekdedic
Copy link

Version

29.7.0

Steps to reproduce

test("Minimal", async () => {
  const defaultExclude = /node_modules/;
  expect(defaultExclude instanceof RegExp).toBe(true); // ok
  expect(structuredClone(defaultExclude) instanceof RegExp).toBe(true); // error
});

Expected behavior

Expected structuredClone not to change the type of the RegExp.

Actual behavior

It does.

Additional context

Discovered as part of vitejs/vite#18875
Probably related to #2549

Environment

System:
    OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1265U
  Binaries:
    Node: 22.11.0 - /usr/bin/node
    Yarn: 1.22.21 - /usr/bin/yarn
    npm: 10.9.1 - /usr/bin/npm
  npmPackages:
    jest: ^29.7.0 => 29.7.0
@mrazauskas
Copy link
Contributor

Try using jest-light-runner as suggested in #2549 (comment). If that helps, most likely you have hit #2549.

@marekdedic marekdedic changed the title [Bug]: [Bug]: structuredClone changes type of RegExp Dec 4, 2024
@marekdedic
Copy link
Author

While trying to run with jest-light-runner I get:

 FAIL  __tests__/basic.test.ts
  ● Test suite failed to run

    thrown: Object {}

but I'm not sure if it's the underlying issue or just some incompatibility with jest-light-runner, I've never used it before and there isn't anything to debug this.

Original PR I'm trying it on: marekdedic/rollup-plugin-htaccess#170

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants