Skip to content

Commit

Permalink
expose all options via docblock comment
Browse files Browse the repository at this point in the history
  • Loading branch information
k-rajat19 committed Aug 4, 2024
1 parent 9caaf3c commit 4223489
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/jest-config/src/readConfigFileAndSetRootDir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {isNativeError} from 'util/types';
import * as fs from 'graceful-fs';
import parseJson = require('parse-json');
import stripJsonComments = require('strip-json-comments');
import type {RegisterOptions} from 'ts-node';
import type {Config} from '@jest/types';
import {extract, parse} from 'jest-docblock';
import {interopRequireDefault, requireOrImportModule} from 'jest-util';
Expand Down Expand Up @@ -90,7 +89,7 @@ export default async function readConfigFileAndSetRootDir(
}

// Load the TypeScript configuration
let extraTSLoaderOptions: RegisterOptions;
let extraTSLoaderOptions: Record<string, unknown>;

const loadTSConfigFile = async (
configPath: string,
Expand Down Expand Up @@ -150,8 +149,7 @@ async function registerTsLoader(loader: TsLoaderModule): Promise<TsLoader> {
moduleTypes: {
'**': 'cjs',
},
swc: extraTSLoaderOptions?.swc,
transpileOnly: extraTSLoaderOptions?.transpileOnly,
...extraTSLoaderOptions,
});
} else if (loader === 'esbuild-register') {
const tsLoader = await import(
Expand All @@ -165,6 +163,7 @@ async function registerTsLoader(loader: TsLoaderModule): Promise<TsLoader> {
if (bool) {
instance = tsLoader.register({
target: `node${process.version.slice(1)}`,
...extraTSLoaderOptions,
});
} else {
instance?.unregister();
Expand Down

0 comments on commit 4223489

Please sign in to comment.