Skip to content

Commit 45ff8c2

Browse files
committed
Maintenance: Updated approach used for TS config in jest config
1 parent 59b5f4a commit 45ff8c2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

jest.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
import type {Config} from 'jest';
77
import {pathsToModuleNameMapper} from "ts-jest";
8-
import { createRequire } from 'module';
9-
const { compilerOptions } = createRequire(import.meta.url)('./tsconfig.json');
8+
import fs from "node:fs";
109

10+
const { compilerOptions } = JSON.parse(fs.readFileSync('./tsconfig.json', 'utf8'));
1111
const compilerPaths = compilerOptions.paths as Record<string, string[]>;
1212
const cleanedPaths: Record<string, string[]> = {};
1313
Object.keys(compilerPaths).forEach((key) => {
@@ -119,7 +119,7 @@ const config: Config = {
119119
// notifyMode: "failure-change",
120120

121121
// A preset that is used as a base for Jest's configuration
122-
// preset: undefined,
122+
preset: 'ts-jest',
123123

124124
// Run tests from one or more projects
125125
// projects: undefined,

0 commit comments

Comments
 (0)