Skip to content

Commit

Permalink
perf: only register ts-node once when loading TS config files (#12160)
Browse files Browse the repository at this point in the history
  • Loading branch information
grxy committed Dec 20, 2021
1 parent 9969060 commit 4113c1d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,8 @@

### Performance

- `jest-config` perf: only register ts-node once when loading TS config files ([#12160](https://github.com/facebook/jest/pull/12160))

## 27.4.5

### Fixes
Expand Down
6 changes: 3 additions & 3 deletions packages/jest-config/src/readConfigFileAndSetRootDir.ts
Expand Up @@ -79,15 +79,15 @@ export default async function readConfigFileAndSetRootDir(
return configObject;
}

let registerer: Service;

// Load the TypeScript configuration
const loadTSConfigFile = async (
configPath: Config.Path,
): Promise<Config.InitialOptions> => {
let registerer: Service;

// Register TypeScript compiler instance
try {
registerer = require('ts-node').register({
registerer ||= require('ts-node').register({
compilerOptions: {
module: 'CommonJS',
},
Expand Down

0 comments on commit 4113c1d

Please sign in to comment.