arrow-left Back to topicQuizTypeScriptCheck yourself1.You have a TypeScript error in your test file — a method call with the wrong argument type. You run 'npx playwright test' and the tests execute. What's happening?Playwright fixed the type error automaticallyPlaywright transpiles TypeScript but doesn't type-check — type errors are ignored at runtimeTypeScript errors in tests don't matter because tests use dynamic typing2.Where should you add a separate tsconfig.json for tests so that test-specific TypeScript settings don't affect the main app?Inside the node_modules/playwright directoryIn the tests directory (e.g. tests/tsconfig.json) — Playwright picks it up by searching upward from the test filesIn the project root alongside the main tsconfig.json, named tsconfig.test.jsonInside playwright.config.ts as an inline object3.Which tsconfig options does Playwright actually read when transpiling test files?All options including strict, target, and libOnly allowJs, baseUrl, paths, and referencesOnly strict and targetPlaywright reads every option but only applies a subset at runtime4.You want to import test fixtures using @fixtures/auth instead of ../../fixtures/auth. What do you need to configure?Install a Babel plugin to resolve path aliases at build timeAdd baseUrl and paths mapping in tests/tsconfig.json — Playwright resolves aliases automaticallyConfigure webpack aliases in playwright.config.tsPath aliases are not supported in Playwright test files5.What is the correct CLI command to run type-checking on test files without executing them?npx playwright test --typechecknpx tsc -p tsconfig.json --noEmitnpx playwright lintnpx ts-node --dry-run tests/6.How does Playwright handle TypeScript without requiring a separate compilation step before running tests?It calls the official TypeScript compiler (tsc) internally before loading each fileIt uses its own esbuild-based transpiler that strips types on the fly, skipping type checking entirelyIt converts TypeScript to JavaScript using Babel with the TypeScript presetTypeScript support in Playwright requires ts-jest to be installed7.How do you explicitly point Playwright to a specific tsconfig file instead of relying on auto-detection?Set the TS_CONFIG environment variable before running testsAdd tsconfig: './tests/tsconfig.json' in playwright.config.ts, or pass --tsconfig=tests/tsconfig.json via CLIRename the file to playwright.tsconfig.json so Playwright finds it automaticallyImport it at the top of every test file using /// <reference path='...' />8.You are adding a custom fixture that extends the base test. How does TypeScript know the type of the new fixture property (e.g. loggedInPage) when used inside tests?You must use any for custom fixture types — generics are not supportedThe type is inferred from the generic type argument passed to test.extend<{ loggedInPage: Page }>() — TypeScript propagates it to the test callback automaticallyPlaywright auto-generates TypeScript types for fixtures into a .d.ts file after the first test runYou need to manually declare a global augmentation for the PlaywrightTestArgs interfaceSubmit answersarrow-left PreviousTrace viewerShardingNext arrow-right