Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: include transpilation mode in the compute cache hash (#11521)

Pavel Feldman50fa839e64d1
diff --git a/packages/playwright-test/src/runner.ts b/packages/playwright-test/src/runner.ts
index 11713f7d45..f1e92758c9 100644
--- a/packages/playwright-test/src/runner.ts
+++ b/packages/playwright-test/src/runner.ts
@@ -239,7 +239,8 @@ export class Runner {
}
// 4. Filter only
- filterOnly(preprocessRoot);
+ if (!list)
+ filterOnly(preprocessRoot);
// 5. Complain about clashing.
const clashingTests = getClashingTestsPerSuite(preprocessRoot);
diff --git a/packages/playwright-test/src/transform.ts b/packages/playwright-test/src/transform.ts
index 29694fb430..a3e3d7f7b1 100644
--- a/packages/playwright-test/src/transform.ts
+++ b/packages/playwright-test/src/transform.ts
@@ -48,7 +48,7 @@ sourceMapSupport.install({
});
function calculateCachePath(content: string, filePath: string): string {
- const hash = crypto.createHash('sha1').update(content).update(filePath).update(String(version)).digest('hex');
+ const hash = crypto.createHash('sha1').update(process.env.PW_EXPERIMENTAL_TS_ESM ? 'esm' : 'no_esm').update(content).update(filePath).update(String(version)).digest('hex');
const fileName = path.basename(filePath, path.extname(filePath)).replace(/\W/g, '') + '_' + hash;
return path.join(cacheDir, hash[0] + hash[1], fileName);
}
@@ -60,7 +60,7 @@ export function transformHook(code: string, filename: string, tsconfig: TsConfig
const codePath = cachePath + '.js';
const sourceMapPath = cachePath + '.map';
sourceMaps.set(filename, sourceMapPath);
- if (fs.existsSync(codePath))
+ if (!process.env.PW_IGNORE_COMPILE_CACHE && fs.existsSync(codePath))
return fs.readFileSync(codePath, 'utf8');
// We don't use any browserslist data, but babel checks it anyway.
// Silence the annoying warning.