Skip to content

Commit

Permalink
feat: allow configuration of configFile in jestTransformer
Browse files Browse the repository at this point in the history
  • Loading branch information
andrenanninga committed Nov 16, 2020
1 parent 8f5d8be commit e59286a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/jestTransformer.ts
Expand Up @@ -8,6 +8,7 @@ import { createPaths } from './lib/paths';
import { createHash } from './lib/hash';

type JestTransformerOptions = {
configFile?: string;
subsequentTransformer?: string;
};

Expand All @@ -25,7 +26,8 @@ const jestTransformer: Transformer = {
},
process(input, filePath, jestConfig, transformOptions) {
const { rootDir: cwd } = jestConfig;
const [config, configHash] = loadConfigSync(cwd);
const { configFile, subsequentTransformer } = getOption(jestConfig);
const [config, configHash] = loadConfigSync(cwd, configFile);
const execContext = createExecContext(cwd, config, configHash);

const { tsxFullPath } = createPaths(
Expand All @@ -35,7 +37,6 @@ const jestTransformer: Transformer = {
const tsxContent = readFileSync(tsxFullPath, 'utf-8');

// Let users customize a subsequent transformer
const { subsequentTransformer } = getOption(jestConfig);
if (subsequentTransformer) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
return require(subsequentTransformer).process(
Expand Down

0 comments on commit e59286a

Please sign in to comment.