diff --git a/jest.config.cjs b/jest.config.cjs index ea6b6706..18bb8139 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,7 +1,18 @@ module.exports = { - preset: 'ts-jest', + moduleNameMapper: { + '^(\\.{1,2}/.*)\\.js$': '$1' + }, + extensionsToTreatAsEsm: ['.ts'], + transform: { + '^.+\\.(mt|t|cj|j)s$': [ + 'ts-jest', + { + useESM: true + } + ] + }, testEnvironment: 'node', testMatch: [ - '/build/**/__tests__/*.js' + '/**/__tests__/*.ts' ] } diff --git a/package.json b/package.json index fbbfcbde..a83b795f 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "scripts": { "lint": "yarn ts-standard", "fix": "yarn ts-standard --fix", - "test": "yarn build && cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --runInBand", + "test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --runInBand", "build": "tsc -p tsconfig.json", "build-release": "tsc -p tsconfig.release.json", "clean": "tsc -b --clean && rm -rf build/*", diff --git a/tsconfig.json b/tsconfig.json index 871ed609..3b503295 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,6 @@ "module": "ESNext", "esModuleInterop": true, "moduleResolution": "Node", - "rootDir": "./src", "outDir": "build", "sourceMap": true, "strictNullChecks": true, @@ -21,4 +20,4 @@ "include": [ "src/**/*.ts", ] -} \ No newline at end of file +}