docs (test-typescript-js.md): clarify TS ESM config (#18971)

Signed-off-by: Eduardo Vargas Torres <evargast@adobe.com>
This commit is contained in:
Eduardo Vargas Torres 2022-11-21 17:31:37 -06:00 committed by GitHub
parent b5d756686d
commit 490ae796f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,7 @@ test('example', async ({ page }) => {
You can opt into using [ECMAScript modules](https://nodejs.org/api/esm.html) by setting `type: "module"` in your `package.json` file. Playwright Test will switch to the ESM mode once it reads the `playwright.config.ts` file, so make sure you have one.
Playwright Test follows the [experimental support for ESM in TypeScript](https://www.typescriptlang.org/docs/handbook/esm-node.html) and, according to the specification, **requires an extension** when importing from a module, either `'.js'` or `'.ts'`.
Playwright Test follows the [experimental support for ESM in TypeScript](https://www.typescriptlang.org/docs/handbook/esm-node.html) and, according to the specification, **requires a file extension** when importing from a module, either `'.js'` or `'.ts'`.
First, enable modules in your `package.json`: