From 63ec00010faa868a9820d577cdf525874ccbc3ef Mon Sep 17 00:00:00 2001 From: Tony133 Date: Tue, 27 Oct 2026 23:00:31 +0100 Subject: [PATCH 1/2] test: transpile ESM-only cookie@2 in jest suite --- package.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 031f2f42..da178266 100644 --- a/package.json +++ b/package.json @@ -108,11 +108,15 @@ "testMatch": [ "**/*.test.ts" ], + "transformIgnorePatterns": [ + "/node_modules/(?!cookie/)" + ], "transform": { - "^.+\\.(ts|tsx)$": [ + "^.+\\.(ts|tsx|js)$": [ "ts-jest", { "tsconfig": { + "allowJs": true, "esModuleInterop": true, "types": [ "jest", @@ -126,4 +130,4 @@ "publishConfig": { "access": "public" } -} +} \ No newline at end of file From 28315e6671684869d60cc511429160b6de12a153 Mon Sep 17 00:00:00 2001 From: Tony133 Date: Wed, 28 Oct 2026 15:41:04 +0100 Subject: [PATCH 2/2] test: move jest config to jest.config.js --- jest.config.js | 24 ++++++++++++++++++++++++ package.json | 26 -------------------------- 2 files changed, 24 insertions(+), 26 deletions(-) create mode 100644 jest.config.js 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 da178266..340722d5 100644 --- a/package.json +++ b/package.json @@ -101,32 +101,6 @@ "overrides": { "vitest": "5.0.1" }, - "jest": { - "preset": "ts-jest", - "testEnvironment": "node", - "rootDir": "./test/typescript-jest", - "testMatch": [ - "**/*.test.ts" - ], - "transformIgnorePatterns": [ - "/node_modules/(?!cookie/)" - ], - "transform": { - "^.+\\.(ts|tsx|js)$": [ - "ts-jest", - { - "tsconfig": { - "allowJs": true, - "esModuleInterop": true, - "types": [ - "jest", - "node" - ] - } - } - ] - } - }, "publishConfig": { "access": "public" }