Skip to content

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

chore: use single tsc for monorepo (#39413)

Pavel Feldman1abd8076303d
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 915ce5e867..4c70f39d8c 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -297,14 +297,7 @@ function reactPackageSection(packageName) {
`packages/web/src/**/*.ts`,
`packages/web/src/**/*.tsx`,
],
- languageOptions: {
- parser: tsParser,
- ecmaVersion: 9,
- sourceType: "module",
- parserOptions: {
- project: path.join(__dirname, "packages", packageName, "tsconfig.json"),
- },
- },
+ languageOptions: languageOptionsWithTsConfig,
rules: {
...baseRules,
"no-console": 2,
diff --git a/package.json b/package.json
index f0081fd89c..65ef07ae16 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
"test-mcp": "playwright test --config=tests/mcp/playwright.config.ts",
"ctest-mcp": "playwright test --config=tests/mcp/playwright.config.ts --project=chrome",
"eslint": "eslint --cache",
- "tsc": "tsc -p . && tsc -p packages/html-reporter/",
+ "tsc": "tsc -p .",
"doc": "node utils/doclint/cli.js",
"lint": "npm run eslint && npm run tsc && npm run doc && npm run check-deps && node utils/generate_channels.js && node utils/generate_types/ && npm run lint-tests && npm run test-types && npm run lint-packages",
"lint-packages": "node utils/workspace.js --ensure-consistent",
diff --git a/packages/devtools/tsconfig.json b/packages/devtools/tsconfig.json
deleted file mode 100644
index a812bf63e9..0000000000
--- a/packages/devtools/tsconfig.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "compilerOptions": {
- "target": "ESNext",
- "useDefineForClassFields": true,
- "lib": ["DOM", "DOM.Iterable", "ESNext"],
- "allowJs": true,
- "skipLibCheck": true,
- "esModuleInterop": true,
- "allowSyntheticDefaultImports": true,
- "strict": true,
- "module": "ESNext",
- "moduleResolution": "bundler",
- "resolveJsonModule": true,
- "isolatedModules": true,
- "noEmit": true,
- "jsx": "react-jsx",
- "useUnknownInCatchVariables": false,
- "paths": {
- "@devtools/*": ["./src/*"],
- "@injected/*": ["../injected/src/*"],
- "@isomorphic/*": ["../playwright-core/src/utils/isomorphic/*"],
- "@protocol/*": ["../protocol/src/*"],
- "@recorder/*": ["../recorder/src/*"],
- "@trace/*": ["../trace/src/*"],
- "@web/*": ["../web/src/*"],
- "playwright-core/lib/*": ["../playwright-core/src/*"],
- }
- },
- "include": ["src"],
- "references": [{ "path": "./tsconfig.node.json" }]
-}
diff --git a/packages/devtools/tsconfig.node.json b/packages/devtools/tsconfig.node.json
deleted file mode 100644
index a336f895aa..0000000000
--- a/packages/devtools/tsconfig.node.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "compilerOptions": {
- "composite": true,
- "module": "esnext",
- "moduleResolution": "node",
- "allowSyntheticDefaultImports": true
- },
- "include": ["vite.config.ts"]
-}
diff --git a/packages/html-reporter/tsconfig.json b/packages/html-reporter/tsconfig.json
deleted file mode 100644
index 142ae8c993..0000000000
--- a/packages/html-reporter/tsconfig.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "compilerOptions": {
- "target": "ESNext",
- "useDefineForClassFields": true,
- "lib": ["DOM", "DOM.Iterable", "ESNext"],
- "allowJs": true,
- "skipLibCheck": true,
- "esModuleInterop": false,
- "allowSyntheticDefaultImports": true,
- "strict": true,
- "module": "ESNext",
- "moduleResolution": "Node",
- "resolveJsonModule": true,
- "isolatedModules": true,
- "noEmit": true,
- "jsx": "react-jsx",
- "useUnknownInCatchVariables": false,
- "paths": {
- "@protocol/*": ["../protocol/src/*"],
- "@web/*": ["../web/src/*"],
- "@playwright/*": ["../playwright/src/*"],
- "@recorder/*": ["../recorder/src/*"],
- "@testIsomorphic/*": ["../playwright/src/isomorphic/*"],
- "playwright-core/lib/*": ["../playwright-core/src/*"],
- "playwright/lib/*": ["../playwright/src/*"],
- }
- },
- "include": ["src", "../web/src"],
- "references": [{ "path": "./tsconfig.node.json" }]
-}
diff --git a/packages/html-reporter/tsconfig.node.json b/packages/html-reporter/tsconfig.node.json
deleted file mode 100644
index 5ea435ac82..0000000000
--- a/packages/html-reporter/tsconfig.node.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "compilerOptions": {
- "composite": true,
- "module": "esnext",
- "moduleResolution": "node",
- "esModuleInterop": true,
- "allowSyntheticDefaultImports": true
- },
- "include": ["playwright.config.ts", "vite.config.ts", "bundle.ts"]
-}
diff --git a/packages/recorder/tsconfig.json b/packages/recorder/tsconfig.json
deleted file mode 100644
index 5674b1a325..0000000000
--- a/packages/recorder/tsconfig.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "compilerOptions": {
- "target": "ESNext",
- "useDefineForClassFields": true,
- "lib": ["DOM", "DOM.Iterable", "ESNext"],
- "allowJs": true,
- "skipLibCheck": false,
- "esModuleInterop": true,
- "allowSyntheticDefaultImports": true,
- "strict": true,
- "module": "ESNext",
- "moduleResolution": "bundler",
- "resolveJsonModule": true,
- "isolatedModules": true,
- "noEmit": true,
- "jsx": "react-jsx",
- "useUnknownInCatchVariables": false,
- "paths": {
- "@isomorphic/*": ["../playwright-core/src/utils/isomorphic/*"],
- "@protocol/*": ["../protocol/src/*"],
- "@recorder/*": ["../recorder/src/*"],
- "@testIsomorphic/*": ["../playwright/src/isomorphic/*"],
- "@web/*": ["../web/src/*"],
- }
- },
- "include": ["src", "../web/src"],
- "references": [{ "path": "./tsconfig.node.json" }]
-}
diff --git a/packages/recorder/tsconfig.node.json b/packages/recorder/tsconfig.node.json
deleted file mode 100644
index a336f895aa..0000000000
--- a/packages/recorder/tsconfig.node.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "compilerOptions": {
- "composite": true,
- "module": "esnext",
- "moduleResolution": "node",
- "allowSyntheticDefaultImports": true
- },
- "include": ["vite.config.ts"]
-}
diff --git a/packages/trace-viewer/tsconfig.json b/packages/trace-viewer/tsconfig.json
deleted file mode 100644
index 3705426109..0000000000
--- a/packages/trace-viewer/tsconfig.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "compilerOptions": {
- "target": "ESNext",
- "useDefineForClassFields": true,
- "lib": ["DOM", "DOM.Iterable", "ESNext"],
- "allowJs": true,
- "skipLibCheck": false,
- "allowSyntheticDefaultImports": true,
- "strict": true,
- "module": "ESNext",
- "moduleResolution": "bundler",
- "resolveJsonModule": true,
- "isolatedModules": true,
- "noEmit": true,
- "jsx": "react-jsx",
- "paths": {
- "@injected/*": ["../injected/src/*"],
- "@isomorphic/*": ["../playwright-core/src/utils/isomorphic/*"],
- "@protocol/*": ["../protocol/src/*"],
- "@recorder/*": ["../recorder/src/*"],
- "@testIsomorphic/*": ["../playwright/src/isomorphic/*"],
- "@trace/*": ["../trace/src/*"],
- "@web/*": ["../web/src/*"],
- // Resolving type dependencies will start processing types in @playwright/test
- // which in turn will start parsing the files and hence stumble upon the core
- // imports.
- "playwright-core/lib/*": ["../playwright-core/src/*"],
- },
- "useUnknownInCatchVariables": false,
- },
- "include": ["src", "../web/src"],
- "references": [{ "path": "./tsconfig.node.json" }]
-}
diff --git a/packages/trace-viewer/tsconfig.node.json b/packages/trace-viewer/tsconfig.node.json
deleted file mode 100644
index 77fef63cae..0000000000
--- a/packages/trace-viewer/tsconfig.node.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "compilerOptions": {
- "composite": true,
- "module": "esnext",
- "moduleResolution": "node",
- "esModuleInterop": true,
- "allowSyntheticDefaultImports": true
- },
- "include": ["vite.config.ts", "vite.sw.config.ts", "bundle.ts"]
-}
diff --git a/tsconfig.json b/tsconfig.json
index 2b8a7d80ed..7a7eab952d 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,8 +1,9 @@
{
"compilerOptions": {
- "target": "ES2019",
- "module": "commonjs",
- "lib": ["esnext", "dom", "DOM.Iterable"],
+ "target": "ESNext",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
"paths": {
/*
The following two serve different purposes:
@@ -20,21 +21,24 @@
"@web/*": ["./packages/web/src/*"],
"playwright-core/lib/*": ["./packages/playwright-core/src/*"],
"playwright/lib/*": ["./packages/playwright/src/*"],
+ "@playwright/*": ["./packages/playwright/src/*"],
},
"esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
"strict": true,
"allowJs": false,
"jsx": "react-jsx",
"resolveJsonModule": true,
+ "isolatedModules": true,
"noEmit": true,
"noImplicitOverride": true,
"useUnknownInCatchVariables": false,
+ "useDefineForClassFields": false,
"skipLibCheck": true,
},
"compileOnSave": true,
"include": ["packages"],
"exclude": [
"packages/*/lib",
- "packages/html-reporter/",
]
}
diff --git a/utils/build/build.js b/utils/build/build.js
index 543a3eb76f..9769f480d5 100644
--- a/utils/build/build.js
+++ b/utils/build/build.js
@@ -663,18 +663,10 @@ if (watchMode) {
// Run TypeScript for type checking.
steps.push(new ProgramStep({
command: 'npx',
- args: ['tsc', ...(watchMode ? ['-w'] : []), '--preserveWatchOutput', '-p', quotePath(filePath('.'))],
+ args: ['tsc', '-w', '--preserveWatchOutput', '-p', quotePath(filePath('.'))],
shell: true,
concurrent: true,
}));
- for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer', 'devtools']) {
- steps.push(new ProgramStep({
- command: 'npx',
- args: ['tsc', ...(watchMode ? ['-w'] : []), '--preserveWatchOutput', '-p', quotePath(filePath(`packages/${webPackage}`))],
- shell: true,
- concurrent: true,
- }));
- }
}
let cleanupCalled = false;