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 ea13794
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions packages/jest-transform/src/ScriptTransformer.ts
Expand Up @@ -542,26 +542,35 @@ 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 (transformer) {
// if (cacheFilePath) {
// createDirectory(path.dirname(cacheFilePath));
// }
// 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));
createDirectory(path.dirname(cacheFilePath));
return this._buildTransformResult(
filename,
cacheFilePath,
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 ea13794

Please sign in to comment.