Skip to content

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

fix(esm): don't emit module shorthand warning (#11596)

Pavel Feldman9542b007cf22
diff --git a/packages/playwright-test/src/transform.ts b/packages/playwright-test/src/transform.ts
index f9d48186e7..056bb5bd2c 100644
--- a/packages/playwright-test/src/transform.ts
+++ b/packages/playwright-test/src/transform.ts
@@ -89,9 +89,8 @@ export function transformHook(code: string, filename: string, tsconfig: TsConfig
relative = relative.replace(/\//g, path.sep);
const result = path.resolve(tsconfig.baseUrl || '', relative);
for (const extension of extensions) {
- // TODO: We can't cover this one with the hash!
if (fs.existsSync(result + extension))
- return result;
+ return result + extension;
}
}
return name;
diff --git a/tests/playwright-test/resolver.spec.ts b/tests/playwright-test/resolver.spec.ts
index fc09a7ed06..ef2b508070 100644
--- a/tests/playwright-test/resolver.spec.ts
+++ b/tests/playwright-test/resolver.spec.ts
@@ -135,6 +135,7 @@ test('should respect baseurl w/o paths', async ({ runInlineTest }) => {
`,
});
+ expect(result.output).not.toContain('Could not');
expect(result.passed).toBe(1);
expect(result.exitCode).toBe(0);
});