-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
jest.spyOn cannot redefine property #8350
Labels
Comments
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
In my project, upgrading from 1.2.205 leads to this error:
TypeError: Cannot redefine property: myFunction at Function.defineProperty (<anonymous>)
. Seems to be different from other similar errors that I found online such as this one as I am not importing from an index file. The issue goes away when I downgrade to1.2.205
.Input code
Config
Playground link (or link to the minimal reproduction)
https://github.com/zachbryant/swc-repro
SWC Info output
Operating System:
Platform: linux
Arch: x64
Machine Type: x86_64
Version: #16~22.04.1-Ubuntu SMP Tue Oct 10 17:11:51 UTC 2023
CPU: (16 cores)
Models: AMD EPYC 7763 64-Core Processor
Binaries:
Node: 18.18.2
npm: 9.8.1
Yarn: 1.22.19
pnpm: 8.10.2
Relevant Packages:
@swc/core: 1.2.213
@swc/helpers: 0.5.1
@swc/types: 0.1.5
typescript: 4.8.4
SWC Config:
output: N/A
.swcrc path: N/A
Next.js info:
output: N/A
Expected behavior
Expected test to pass as is, no issue.
Actual behavior
Test fails with aforementioned error.
Version
1.2.206 and above
Additional context
I tried loose mode etc to no avail. Switching my repo to use mocks/the mock esmodule workaround isn't an option.
I tried 1.2.206 and other higher versions and the error persisted. I'm on the latest of everything.
The text was updated successfully, but these errors were encountered: