diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 00000000..4387dae6 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,24 @@ +'use strict' + +/** @type {import('jest').Config} */ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', + rootDir: './test/typescript-jest', + testMatch: ['**/*.test.ts'], + // cookie@2 (pulled in by light-my-request) is ESM-only and must be + // transpiled to CJS for this suite, which runs in CommonJS via ts-jest. + transformIgnorePatterns: ['/node_modules/(?!cookie/)'], + transform: { + '^.+\\.(ts|tsx|js)$': [ + 'ts-jest', + { + tsconfig: { + allowJs: true, + esModuleInterop: true, + types: ['jest', 'node'] + } + } + ] + } +} diff --git a/package.json b/package.json index 031f2f42..340722d5 100644 --- a/package.json +++ b/package.json @@ -101,29 +101,7 @@ "overrides": { "vitest": "5.0.1" }, - "jest": { - "preset": "ts-jest", - "testEnvironment": "node", - "rootDir": "./test/typescript-jest", - "testMatch": [ - "**/*.test.ts" - ], - "transform": { - "^.+\\.(ts|tsx)$": [ - "ts-jest", - { - "tsconfig": { - "esModuleInterop": true, - "types": [ - "jest", - "node" - ] - } - } - ] - } - }, "publishConfig": { "access": "public" } -} +} \ No newline at end of file