diff --git a/jest.config.ts b/jest.config.ts index 3b2dd0b..f4c8f2c 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,11 +1,20 @@ import { pathsToModuleNameMapper } from "ts-jest"; -import { compilerOptions } from "./tsconfig.test.json"; +import { readFileSync } from 'fs'; +import { fileURLToPath } from 'url'; +import { dirname, join } from 'path'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const tsConfig = JSON.parse( + readFileSync(join(__dirname, 'tsconfig.test.json'), 'utf8') +); export default { preset: "ts-jest", testEnvironment: "node", moduleDirectories: ["node_modules", ""], - moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: "/" }), + moduleNameMapper: pathsToModuleNameMapper(tsConfig.compilerOptions.paths, { prefix: "/" }), roots: ["/tests"], testMatch: ["**/*.test.ts"], transform: { diff --git a/tests/core/internal/factory-context/auto-counter.test.ts b/tests/core/internal/factory-context/auto-counter.test.ts index 46a2650..bf0437d 100644 --- a/tests/core/internal/factory-context/auto-counter.test.ts +++ b/tests/core/internal/factory-context/auto-counter.test.ts @@ -32,4 +32,4 @@ describe(AutoCounter.name, () => { expect(instance.getNextValue("bar")).toBe(2); }); }); -}); +}); \ No newline at end of file