From c1421bc9f2be2388b0b3d5fd5c601977689fa897 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Mon, 26 Feb 2024 15:26:05 -0800 Subject: [PATCH] docs: typescript compiler invocation before tests (#29667) Fixes https://github.com/microsoft/playwright/issues/29618 --- docs/src/test-typescript-js.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/src/test-typescript-js.md b/docs/src/test-typescript-js.md index 465f2c2d93..12a1173ea4 100644 --- a/docs/src/test-typescript-js.md +++ b/docs/src/test-typescript-js.md @@ -5,7 +5,26 @@ title: "TypeScript" ## Introduction -Playwright supports TypeScript out of the box. You just write tests in TypeScript, and Playwright will read them, transform to JavaScript and run. +Playwright supports TypeScript out of the box. You just write tests in TypeScript, and Playwright will read them, transform to JavaScript and run. Note that Playwright does not check the types and will run tests even if there are non-critical TypeScript compilation errors. + +We recommend you run TypeScript compiler alongside Playwright. For example on GitHub actions: + +```yaml +jobs: + test: + runs-on: ubuntu-latest + steps: + ... + - name: Run type checks + run: npx tsc -p tsconfig.json --noEmit + - name: Run Playwright tests + run: npx playwright test +``` + +For local development, you can run `tsc` in [watch](https://www.typescriptlang.org/docs/handbook/configuring-watch.html) mode like this: +```sh +npx tsc -p tsconfig.json --noEmit -w +``` ## tsconfig.json