Skip to content

Commit 576082c

Browse files
committed
chore(deps): update dependencies
1 parent 40451b6 commit 576082c

4 files changed

Lines changed: 4051 additions & 3722 deletions

File tree

jest-setup.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
11
import '@testing-library/jest-dom'
2+
3+
type MockObjectConstructor = ObjectConstructor & { __definePropertyMocked__?: true }
4+
5+
/**
6+
* Allow module mocks with `@swc/core` enforcing stricter ESM spec.
7+
* @see https://github.com/magic-akari/swc_mut_cjs_exports/issues/103#issuecomment-1926819722
8+
*/
9+
if ((Object as MockObjectConstructor)['__definePropertyMocked__'] !== true) {
10+
;(Object as MockObjectConstructor)['__definePropertyMocked__'] = true
11+
const originalDefineProperty = Object.defineProperty
12+
const mutableDefineProperty: ObjectConstructor['defineProperty'] = (obj, prop, attributes) => {
13+
// this is to prevent the error `Cannot redefine property: prototype`; prototype can not be configurable...
14+
if (prop === 'prototype') return originalDefineProperty(obj, prop, attributes)
15+
return originalDefineProperty(obj, prop, {
16+
...attributes,
17+
configurable: true,
18+
})
19+
}
20+
Object.defineProperty = mutableDefineProperty
21+
}

jest.config.cjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ module.exports = {
1111
'@swc/jest',
1212
{
1313
jsc: {
14-
experimental: {
15-
plugins: [['jest_workaround', {}]],
16-
},
1714
transform: {
1815
react: {
1916
runtime: 'automatic',

0 commit comments

Comments
 (0)