diff --git a/package.json b/package.json index abf317430..dedb77e89 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "@storybook/react": "7.5.1", "@storybook/react-webpack5": "7.5.1", "@swc/core": "1.4.2", + "@swc/jest": "0.2.36", "@testing-library/jest-dom": "6.1.4", "@testing-library/react": "14.0.0", "@testing-library/user-event": "14.5.1", diff --git a/packages/core/jest.config.js b/packages/core/jest.config.js index fb8efaffa..b45bd01e9 100644 --- a/packages/core/jest.config.js +++ b/packages/core/jest.config.js @@ -7,6 +7,20 @@ module.exports = { fakeTimers: { enableGlobally: false, }, + transform: { + '^.+\\.(t|j)sx?$': [ + '@swc/jest', + { + jsc: { + transform: { + react: { + runtime: 'automatic', + }, + }, + }, + }, + ], + }, testMatch: ['/packages/core/lib/**/*.test.ts'], testPathIgnorePatterns: [ '/node_modules/', diff --git a/packages/hooks/jest.config.js b/packages/hooks/jest.config.js index 42fd7494e..f51555487 100644 --- a/packages/hooks/jest.config.js +++ b/packages/hooks/jest.config.js @@ -7,6 +7,20 @@ module.exports = { fakeTimers: { enableGlobally: false, }, + transform: { + '^.+\\.(t|j)sx?$': [ + '@swc/jest', + { + jsc: { + transform: { + react: { + runtime: 'automatic', + }, + }, + }, + }, + ], + }, moduleNameMapper: { '^@junipero/(.+)$': '/packages/$1/lib/index.js', '^~tests?-utils$': '/packages/react/tests/utils.ts', diff --git a/packages/react-d3-plugin/jest.config.js b/packages/react-d3-plugin/jest.config.js index 4762a2d4a..1d85ab319 100644 --- a/packages/react-d3-plugin/jest.config.js +++ b/packages/react-d3-plugin/jest.config.js @@ -9,6 +9,20 @@ module.exports = { fakeTimers: { enableGlobally: false, }, + transform: { + '^.+\\.(t|j)sx?$': [ + '@swc/jest', + { + jsc: { + transform: { + react: { + runtime: 'automatic', + }, + }, + }, + }, + ], + }, moduleNameMapper: { '^@junipero/transitions': '/packages/transitions/lib/index.tsx', '^@junipero/(.+)$': '/packages/$1/lib/index.ts', diff --git a/packages/react/jest.config.js b/packages/react/jest.config.js index e64f7394f..5bd5b3647 100644 --- a/packages/react/jest.config.js +++ b/packages/react/jest.config.js @@ -7,6 +7,20 @@ module.exports = { fakeTimers: { enableGlobally: false, }, + transform: { + '^.+\\.(t|j)sx?$': [ + '@swc/jest', + { + jsc: { + transform: { + react: { + runtime: 'automatic', + }, + }, + }, + }, + ], + }, moduleNameMapper: { '^@junipero/transitions': '/packages/transitions/lib/index.tsx', '^@junipero/(.+)$': '/packages/$1/lib/index.ts', diff --git a/packages/tailwind-plugin/jest.config.js b/packages/tailwind-plugin/jest.config.js index 83b143eb0..53e660677 100644 --- a/packages/tailwind-plugin/jest.config.js +++ b/packages/tailwind-plugin/jest.config.js @@ -7,6 +7,20 @@ module.exports = { fakeTimers: { enableGlobally: false, }, + transform: { + '^.+\\.(t|j)sx?$': [ + '@swc/jest', + { + jsc: { + transform: { + react: { + runtime: 'automatic', + }, + }, + }, + }, + ], + }, moduleNameMapper: { '^@junipero/transitions': '/packages/transitions/lib/index.tsx', '^@junipero/(.+)$': '/packages/$1/lib/index.ts', diff --git a/packages/transitions/jest.config.js b/packages/transitions/jest.config.js index e84614fd4..c35b09749 100644 --- a/packages/transitions/jest.config.js +++ b/packages/transitions/jest.config.js @@ -7,6 +7,20 @@ module.exports = { fakeTimers: { enableGlobally: false, }, + transform: { + '^.+\\.(t|j)sx?$': [ + '@swc/jest', + { + jsc: { + transform: { + react: { + runtime: 'automatic', + }, + }, + }, + }, + ], + }, moduleNameMapper: { '^@junipero/transitions': '/packages/transitions/lib/index.tsx', '^@junipero/(.+)$': '/packages/$1/lib/index.ts', diff --git a/yarn.lock b/yarn.lock index 9f72d90ce..df4566f7f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2029,6 +2029,15 @@ __metadata: languageName: node linkType: hard +"@jest/create-cache-key-function@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/create-cache-key-function@npm:29.7.0" + dependencies: + "@jest/types": "npm:^29.6.3" + checksum: 10c0/5c47ef62205264adf77b1ff26b969ce9fe84920b8275c3c5e83f4236859d6ae5e4e7027af99eef04a8e334c4e424d44af3e167972083406070aca733ac2a2795 + languageName: node + linkType: hard + "@jest/environment@npm:^29.7.0": version: 29.7.0 resolution: "@jest/environment@npm:29.7.0" @@ -4813,6 +4822,19 @@ __metadata: languageName: node linkType: hard +"@swc/jest@npm:0.2.36": + version: 0.2.36 + resolution: "@swc/jest@npm:0.2.36" + dependencies: + "@jest/create-cache-key-function": "npm:^29.7.0" + "@swc/counter": "npm:^0.1.3" + jsonc-parser: "npm:^3.2.0" + peerDependencies: + "@swc/core": "*" + checksum: 10c0/7f1993f9201420bb499c92ab28797352bcbf9e3a6c7b5a1806fdc34c9c3b46ea9e5b2f070c0e13fcf7f3c3fadbbc38777840baabb178f589bf1f67543763adb6 + languageName: node + linkType: hard + "@swc/types@npm:^0.1.5": version: 0.1.5 resolution: "@swc/types@npm:0.1.5" @@ -12410,6 +12432,13 @@ __metadata: languageName: node linkType: hard +"jsonc-parser@npm:^3.2.0": + version: 3.2.1 + resolution: "jsonc-parser@npm:3.2.1" + checksum: 10c0/ada66dec143d7f9cb0e2d0d29c69e9ce40d20f3a4cb96b0c6efb745025ac7f9ba647d7ac0990d0adfc37a2d2ae084a12009a9c833dbdbeadf648879a99b9df89 + languageName: node + linkType: hard + "jsonfile@npm:^6.0.1": version: 6.1.0 resolution: "jsonfile@npm:6.1.0" @@ -15842,6 +15871,7 @@ __metadata: "@storybook/react": "npm:7.5.1" "@storybook/react-webpack5": "npm:7.5.1" "@swc/core": "npm:1.4.2" + "@swc/jest": "npm:0.2.36" "@testing-library/jest-dom": "npm:6.1.4" "@testing-library/react": "npm:14.0.0" "@testing-library/user-event": "npm:14.5.1"