Skip to content

Commit 2571196

Browse files
fix: convert Jest configs to ES module syntax
Convert jest.config.ts and swcjest.config.ts from CommonJS to ES module syntax to fix 'module is not defined in ES module scope' error. The issue occurred because package.json has "type": "module" which makes Node.js treat .ts files as ES modules, but Jest configs were using module.exports (CommonJS syntax). Co-authored-by: Ivan Galiatin <[email protected]>
1 parent a33423f commit 2571196

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

jest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2-
module.exports = {
2+
export default {
33
preset: 'ts-jest',
44
testEnvironment: 'jsdom',
55
setupFilesAfterEnv: ['<rootDir>/jest-setup.ts'],

swcjest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
testEnvironment: 'jsdom',
33
transform: {
44
'^.+\\.(t|j)sx?$': '@swc/jest',

0 commit comments

Comments
 (0)