You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 to 1.2.205.
Input code
import*asanImportfrom'./myFile'describe('some test suite',()=>{it('test 1',()=>{constspy=jest.spyOn(anImport,'myFunction').mockReturnValue(0)expect(anImport.someOtherFunc()).toBe(false)})})
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.
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: