From cc7842d894411cb1beeb165c813e4fbf83ad6ebe Mon Sep 17 00:00:00 2001 From: Gus Narea Date: Thu, 1 Sep 2022 18:43:57 +0100 Subject: [PATCH] implement fix from https://github.com/kulshekhar/ts-jest/issues/2399 --- jest.config.mjs | 10 ++++++++-- src/lib/{foo.test.ts => foo.spec.ts} | 0 2 files changed, 8 insertions(+), 2 deletions(-) rename src/lib/{foo.test.ts => foo.spec.ts} (100%) diff --git a/jest.config.mjs b/jest.config.mjs index f619eb02..f7784121 100644 --- a/jest.config.mjs +++ b/jest.config.mjs @@ -61,7 +61,11 @@ export default { // globalTeardown: null, // A set of global variables that need to be available in all test environments - // globals: {}, + globals: { + 'ts-jest': { + useESM: true, + }, + }, // An array of directory names to be searched recursively up from the requiring module's location // moduleDirectories: [ @@ -72,7 +76,9 @@ export default { moduleFileExtensions: ["js", "ts"], // A map from regular expressions to module names that allow to stub out resources with a single module - // moduleNameMapper: {}, + moduleNameMapper: { + '^(\\.{1,2}/.*)\\.js$': '$1', + }, // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader // modulePathIgnorePatterns: [], diff --git a/src/lib/foo.test.ts b/src/lib/foo.spec.ts similarity index 100% rename from src/lib/foo.test.ts rename to src/lib/foo.spec.ts