Skip to content

Commit

Permalink
DEV CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchhentgesspotify committed Nov 8, 2022
1 parent 7bbae34 commit 52a97df
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions packages/jest-transform/src/ScriptTransformer.ts
Expand Up @@ -542,23 +542,32 @@ class ScriptTransformer {

let shouldCallTransform = false;

if (transformer && this.shouldTransform(filename)) {
shouldCallTransform = true;
const process = transformer.processAsync ?? transformer.process;

// This is probably dead code since `_getTransformerAsync` already asserts this
invariant(
typeof process === 'function',
'A transformer must always export either a `process` or `processAsync`',
);
// success
// success
if (cacheFilePath) {
createDirectory(path.dirname(cacheFilePath));
}
if (transformer) {
// failure
if (this.shouldTransform(filename)) {
// failed
shouldCallTransform = true;
const process = transformer.processAsync ?? transformer.process;

// This is probably dead code since `_getTransformerAsync` already asserts this
invariant(
typeof process === 'function',
'A transformer must always export either a `process` or `processAsync`',
);

processed = await process(content, filename, {
...options,
cacheFS: this._cacheFS,
config: this._config,
configString: this._cache.configString,
transformerConfig,
});
processed = await process(content, filename, {
...options,
cacheFS: this._cacheFS,
config: this._config,
configString: this._cache.configString,
transformerConfig,
});
}
}

createDirectory(path.dirname(filename));
Expand Down Expand Up @@ -811,10 +820,12 @@ class ScriptTransformer {
}

shouldTransform(filename: string): boolean {
// failed
const ignoreRegexp = this._cache.ignorePatternsRegExp;
const isIgnored = ignoreRegexp ? ignoreRegexp.test(filename) : false;

return this._config.transform.length !== 0 && !isIgnored;
// failed
}
}

Expand Down

0 comments on commit 52a97df

Please sign in to comment.