Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: migrate html reporter to vite (#13116)
Pavel Feldman8758cf8cbf75
diff --git a/package-lock.json b/package-lock.jsonindex 366b58b577..5fb0d39a95 100644--- a/package-lock.json+++ b/package-lock.json@@ -7841,7 +7841,9 @@"url": "https://github.com/sponsors/sindresorhus"}},- "packages/html-reporter": {},+ "packages/html-reporter": {+ "version": "0.0.0"+ },"packages/playwright": {"version": "1.21.0-next","hasInstallScript": true,diff --git a/packages/html-reporter/.gitignore b/packages/html-reporter/.gitignoreindex 466e24805a..a547bf36d8 100644--- a/packages/html-reporter/.gitignore+++ b/packages/html-reporter/.gitignore@@ -1 +1,24 @@-out/\ No newline at end of file+# Logs+logs+*.log+npm-debug.log*+yarn-debug.log*+yarn-error.log*+pnpm-debug.log*+lerna-debug.log*++node_modules+dist+dist-ssr+*.local++# Editor directories and files+.vscode/*+!.vscode/extensions.json+.idea+.DS_Store+*.suo+*.ntvs*+*.njsproj+*.sln+*.sw?diff --git a/packages/html-reporter/bundle.js b/packages/html-reporter/bundle.jsnew file mode 100644index 0000000000..478e48357f--- /dev/null+++ b/packages/html-reporter/bundle.js@@ -0,0 +1,53 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import fs, { existsSync } from 'fs';+import path from 'path';++/**+ * @returns {import('vite').Plugin}+ */+export function bundle() {+ let config;+ return {+ name: 'playwright-bundle',+ config(c) {+ config = c;+ },+ transformIndexHtml: {+ transform(html, ctx) {+ if (!ctx || !ctx.bundle)+ return html;+ for (const [, value] of Object.entries(ctx.bundle)) {+ if (value.code)+ html = html.replace(/<script type="module".*<\/script>/, () => `<script type="module">${value.code}</script>`);+ else+ html = html.replace(/<link rel="stylesheet"[^>]*>/, () => `<style type='text/css'>${value.source}</style>`);+ }+ return html;+ },+ },+ closeBundle: () => {+ if (existsSync(path.join(config.build.outDir, 'index.html'))) {+ const targetDir = path.join(__dirname, '..', 'playwright-core', 'lib', 'webpack', 'htmlReport');+ fs.mkdirSync(targetDir, { recursive: true });+ fs.copyFileSync(+ path.join(config.build.outDir, 'index.html'),+ path.join(targetDir, 'index.html'));+ }+ },+ }+}\ No newline at end of filediff --git a/packages/html-reporter/bundleJsPlugin.js b/packages/html-reporter/bundleJsPlugin.jsdeleted file mode 100644index bd47fd5993..0000000000--- a/packages/html-reporter/bundleJsPlugin.js+++ /dev/null@@ -1,66 +0,0 @@-/*- Copyright (c) Microsoft Corporation.-- Licensed under the Apache License, Version 2.0 (the "License");- you may not use this file except in compliance with the License.- You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0-- Unless required by applicable law or agreed to in writing, software- distributed under the License is distributed on an "AS IS" BASIS,- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- See the License for the specific language governing permissions and- limitations under the License.-*/--const path = require('path');-const HtmlWebpackPlugin = require('html-webpack-plugin');--class BundleJsPlugin {- constructor() {- }-- apply(compiler) {- compiler.hooks.compilation.tap('bundle-js-plugin', compilation => {- HtmlWebpackPlugin.getHooks(compilation).alterAssetTagGroups.tapAsync('bundle-js-plugin', (htmlPluginData, callback) => {- callback(null, this.processTags(compilation, htmlPluginData));- });- });- };-- processTags(compilation, pluginData) {- const headTags = pluginData.headTags.map(tag => this.processTag(compilation, tag));- const bodyTags = pluginData.bodyTags.map(tag => this.processTag(compilation, tag));- return { ...pluginData, headTags, bodyTags };- }-- processTag(compilation, tag) {- if (tag.tagName !== 'script' || !tag.attributes.src)- return tag;-- const asset = getAssetByName(compilation.assets, tag.attributes.src);- const innerHTML = asset.source().replace(/(<)(\/script>)/g, '\\x3C$2');- return {- tagName: 'script',- attributes: {- type: 'text/javascript'- },- closeTag: true,- innerHTML,- };- }-}--function getAssetByName (assets, assetName) {- for (var key in assets) {- if (assets.hasOwnProperty(key)) {- var processedKey = path.posix.relative('', key);- if (processedKey === assetName) {- return assets[key];- }- }- }-}--module.exports = BundleJsPlugin;diff --git a/packages/html-reporter/src/index.html b/packages/html-reporter/index.htmlsimilarity index 91%rename from packages/html-reporter/src/index.htmlrename to packages/html-reporter/index.htmlindex 143c311aaa..054507220c 100644--- a/packages/html-reporter/src/index.html+++ b/packages/html-reporter/index.html@@ -23,6 +23,7 @@<title>Playwright Test Report</title></head><body>- <div id=root></div>+ <div id='root'></div>+ <script type='module' src='/src/index.tsx'></script></body></html>diff --git a/packages/html-reporter/package.json b/packages/html-reporter/package.jsonindex aee4ad9f33..b11334c5b1 100644--- a/packages/html-reporter/package.json+++ b/packages/html-reporter/package.json@@ -1,4 +1,10 @@{- "name": "html-reporter",- "private": true+ "name": "html-reporter",+ "private": true,+ "version": "0.0.0",+ "scripts": {+ "dev": "vite",+ "build": "vite build && tsc",+ "preview": "vite preview"+ }}diff --git a/packages/html-reporter/playwright.config.ts b/packages/html-reporter/playwright.config.tsindex 05d2dfaff7..20278b3753 100644--- a/packages/html-reporter/playwright.config.ts+++ b/packages/html-reporter/playwright.config.ts@@ -15,8 +15,6 @@*/import { PlaywrightTestConfig, devices } from '@playwright/test';-import path from 'path';-import url from 'url';const config: PlaywrightTestConfig = {testDir: 'src',@@ -27,8 +25,14 @@ const config: PlaywrightTestConfig = {] : [['html', { open: 'on-failure' }]],+ webServer: {+ url: 'http://localhost:3101/tests.html',+ command: 'npm run dev',+ cwd: __dirname,+ reuseExistingServer: !process.env.CI,+ },use: {- baseURL: url.pathToFileURL(path.join(__dirname, 'out', 'index.html')).toString(),+ baseURL: 'http://localhost:3101/tests.html',trace: 'on-first-retry',},projects: [diff --git a/packages/html-reporter/src/filter.ts b/packages/html-reporter/src/filter.tsindex 66467eb2f8..c41b93f94a 100644--- a/packages/html-reporter/src/filter.ts+++ b/packages/html-reporter/src/filter.ts@@ -14,7 +14,7 @@limitations under the License.*/-import type { TestCaseSummary } from '@playwright/test/src/reporters/html';+import type { TestCaseSummary } from '@playwright-test/reporters/html';export class Filter {project: string[] = [];diff --git a/packages/html-reporter/src/headerView.tsx b/packages/html-reporter/src/headerView.tsxindex 641de1dca9..9eb45b029b 100644--- a/packages/html-reporter/src/headerView.tsx+++ b/packages/html-reporter/src/headerView.tsx@@ -14,7 +14,7 @@limitations under the License.*/-import type { Stats } from '@playwright/test/src/reporters/html';+import type { Stats } from '@playwright-test/reporters/html';import * as React from 'react';import './colors.css';import './common.css';diff --git a/packages/html-reporter/src/index.tsx b/packages/html-reporter/src/index.tsxindex f227b58809..7eed862ec6 100644--- a/packages/html-reporter/src/index.tsx+++ b/packages/html-reporter/src/index.tsx@@ -14,13 +14,17 @@* limitations under the License.*/-import type { HTMLReport, TestAttachment } from '@playwright/test/src/reporters/html';+import type { HTMLReport, TestAttachment } from '@playwright-test/reporters/html';import type zip from '@zip.js/zip.js';+// @ts-ignore+import zipImport from '@zip.js/zip.js/dist/zip-no-worker-inflate.min.js';import * as React from 'react';import * as ReactDOM from 'react-dom';import './colors.css';import { LoadedReport } from './loadedReport';import { ReportView } from './reportView';+// @ts-ignore+const zipjs = zipImport as typeof zip;export type Metadata = Partial<{'generatedAt': number;@@ -75,8 +79,6 @@ const extractMetadata = (attachments: TestAttachment[]): Metadata | undefined =>return out;};-const zipjs = (self as any).zip;-const ReportLoader: React.FC = () => {const [report, setReport] = React.useState<LoadedReport | undefined>();React.useEffect(() => {@@ -97,7 +99,7 @@ class ZipReport implements LoadedReport {private _json!: HTMLReport & { metadata?: Metadata };async load() {- const zipReader = new zipjs.ZipReader(new zipjs.Data64URIReader(window.playwrightReportBase64), { useWebWorkers: false }) as zip.ZipReader;+ const zipReader = new zipjs.ZipReader(new zipjs.Data64URIReader((window as any).playwrightReportBase64), { useWebWorkers: false }) as zip.ZipReader;for (const entry of await zipReader.getEntries())this._entries.set(entry.filename, entry);this._json = await this.entry('report.json') as HTMLReport;diff --git a/packages/html-reporter/src/links.tsx b/packages/html-reporter/src/links.tsxindex dbcd125974..1aeba80230 100644--- a/packages/html-reporter/src/links.tsx+++ b/packages/html-reporter/src/links.tsx@@ -14,7 +14,7 @@limitations under the License.*/-import type { TestAttachment } from '@playwright/test/src/reporters/html';+import type { TestAttachment } from '@playwright-test/reporters/html';import * as React from 'react';import * as icons from './icons';import { TreeItem } from './treeItem';diff --git a/packages/html-reporter/src/loadedReport.ts b/packages/html-reporter/src/loadedReport.tsindex ae5b930979..7234598f99 100644--- a/packages/html-reporter/src/loadedReport.ts+++ b/packages/html-reporter/src/loadedReport.ts@@ -14,8 +14,8 @@* limitations under the License.*/-import { HTMLReport } from '@playwright/test/src/reporters/html';-import { Metadata } from '.';+import { HTMLReport } from '@playwright-test/reporters/html';+import { Metadata } from './index';export interface LoadedReport {json(): HTMLReport & { metadata?: Metadata };diff --git a/packages/html-reporter/src/reportView.tsx b/packages/html-reporter/src/reportView.tsxindex cc7977b028..7d2bc6374a 100644--- a/packages/html-reporter/src/reportView.tsx+++ b/packages/html-reporter/src/reportView.tsx@@ -14,7 +14,7 @@limitations under the License.*/-import type { TestCase, TestFile } from '@playwright/test/src/reporters/html';+import type { TestCase, TestFile } from '@playwright-test/reporters/html';import * as React from 'react';import './colors.css';import './common.css';@@ -27,7 +27,7 @@ import { TestCaseView } from './testCaseView';import { TestFilesView } from './testFilesView';import './theme.css';import * as icons from './icons';-import { Metadata } from '.';+import { Metadata } from './index';declare global {interface Window {diff --git a/packages/html-reporter/src/testCaseView.tsx b/packages/html-reporter/src/testCaseView.tsxindex 1ae2224d0c..397fc02dce 100644--- a/packages/html-reporter/src/testCaseView.tsx+++ b/packages/html-reporter/src/testCaseView.tsx@@ -14,7 +14,7 @@limitations under the License.*/-import type { TestCase } from '@playwright/test/src/reporters/html';+import type { TestCase } from '@playwright-test/reporters/html';import * as React from 'react';import { TabbedPane } from './tabbedPane';import { AutoChip } from './chip';diff --git a/packages/html-reporter/src/testFileView.tsx b/packages/html-reporter/src/testFileView.tsxindex b969a52deb..1d41a05b94 100644--- a/packages/html-reporter/src/testFileView.tsx+++ b/packages/html-reporter/src/testFileView.tsx@@ -14,7 +14,7 @@limitations under the License.*/-import type { HTMLReport, TestFileSummary } from '@playwright/test/src/reporters/html';+import type { HTMLReport, TestFileSummary } from '@playwright-test/reporters/html';import * as React from 'react';import { msToString } from './uiUtils';import { Chip } from './chip';diff --git a/packages/html-reporter/src/testFilesView.tsx b/packages/html-reporter/src/testFilesView.tsxindex 5d7f24944b..659619415f 100644--- a/packages/html-reporter/src/testFilesView.tsx+++ b/packages/html-reporter/src/testFilesView.tsx@@ -14,7 +14,7 @@limitations under the License.*/-import type { HTMLReport, TestFileSummary } from '@playwright/test/src/reporters/html';+import type { HTMLReport, TestFileSummary } from '@playwright-test/reporters/html';import * as React from 'react';import { Filter } from './filter';import { TestFileView } from './testFileView';diff --git a/packages/html-reporter/src/testResultView.tsx b/packages/html-reporter/src/testResultView.tsxindex c4e9384f3a..5cdaad4a69 100644--- a/packages/html-reporter/src/testResultView.tsx+++ b/packages/html-reporter/src/testResultView.tsx@@ -14,7 +14,7 @@limitations under the License.*/-import type { TestAttachment, TestCase, TestResult, TestStep } from '@playwright/test/src/reporters/html';+import type { TestAttachment, TestCase, TestResult, TestStep } from '@playwright-test/reporters/html';import ansi2html from 'ansi-to-html';import * as React from 'react';import { TreeItem } from './treeItem';diff --git a/packages/html-reporter/tests/tests.ts b/packages/html-reporter/src/tests.tssimilarity index 81%rename from packages/html-reporter/tests/tests.tsrename to packages/html-reporter/src/tests.tsindex 366fdcba3c..aa05b5c62a 100644--- a/packages/html-reporter/tests/tests.ts+++ b/packages/html-reporter/src/tests.ts@@ -14,10 +14,10 @@* limitations under the License.*/-import { AutoChip, Chip } from '../src/chip';-import { HeaderView } from '../src/headerView';-import { TestCaseView } from '../src/testCaseView';-import '../src/theme.css';+import { AutoChip, Chip } from './chip';+import { HeaderView } from './headerView';+import { TestCaseView } from './testCaseView';+import './theme.css';import register from '@playwright/experimental-ct-react/register';diff --git a/packages/html-reporter/src/vite-env.d.ts b/packages/html-reporter/src/vite-env.d.tsnew file mode 100644index 0000000000..11f02fe2a0--- /dev/null+++ b/packages/html-reporter/src/vite-env.d.ts@@ -0,0 +1 @@+/// <reference types="vite/client" />diff --git a/packages/html-reporter/tests/tests.html b/packages/html-reporter/tests.htmlsimilarity index 70%rename from packages/html-reporter/tests/tests.htmlrename to packages/html-reporter/tests.htmlindex c88687e04d..3bc696a058 100644--- a/packages/html-reporter/tests/tests.html+++ b/packages/html-reporter/tests.html@@ -15,14 +15,15 @@--><!DOCTYPE html>-<html>+<html lang="en"><head>- <meta charset='UTF-8'>- <meta name='color-scheme' content='dark light'>- <meta name='viewport' content='width=device-width, initial-scale=1.0'>- <title>Playwright CT</title>+ <meta charset="UTF-8" />+ <link rel="icon" href="/favicon.ico" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Tests</title></head><body>- <div id=root></div>+ <div id="root"></div>+ <script type="module" src="/src/tests.ts"></script></body></html>diff --git a/packages/html-reporter/tests/webpack.config.js b/packages/html-reporter/tests/webpack.config.jsdeleted file mode 100644index 493c5bb15a..0000000000--- a/packages/html-reporter/tests/webpack.config.js+++ /dev/null@@ -1,62 +0,0 @@-/*- Copyright (c) Microsoft Corporation.-- Licensed under the Apache License, Version 2.0 (the "License");- you may not use this file except in compliance with the License.- You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0-- Unless required by applicable law or agreed to in writing, software- distributed under the License is distributed on an "AS IS" BASIS,- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- See the License for the specific language governing permissions and- limitations under the License.-*/--const path = require('path');-const HtmlWebPackPlugin = require('html-webpack-plugin');--const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development';--module.exports = {- mode,- entry: {- tests: path.join(__dirname, 'tests.ts'),- },- resolve: {- extensions: ['.ts', '.js', '.tsx', '.jsx']- },- devtool: mode === 'production' ? false : 'source-map',- output: {- globalObject: 'self',- filename: '[name].bundle.js',- path: path.resolve(__dirname, '..', 'out')- },- module: {- rules: [- {- test: /\.(j|t)sx?$/,- loader: 'babel-loader',- options: {- presets: [- "@babel/preset-typescript",- "@babel/preset-react"- ]- },- exclude: /node_modules/- },- {- test: /\.css$/,- use: ['style-loader', 'css-loader']- },- ]- },- plugins: [- new HtmlWebPackPlugin({- title: 'Playwright CT',- template: path.join(__dirname, 'tests.html'),- inject: true,- }),- ]-};diff --git a/packages/html-reporter/tsconfig.json b/packages/html-reporter/tsconfig.jsonnew file mode 100644index 0000000000..31c2e167d1--- /dev/null+++ b/packages/html-reporter/tsconfig.json@@ -0,0 +1,29 @@+{+ "compilerOptions": {+ "target": "ESNext",+ "useDefineForClassFields": true,+ "lib": ["DOM", "DOM.Iterable", "ESNext"],+ "allowJs": true,+ "skipLibCheck": false,+ "esModuleInterop": false,+ "allowSyntheticDefaultImports": true,+ "strict": true,+ "module": "ESNext",+ "moduleResolution": "Node",+ "resolveJsonModule": true,+ "isolatedModules": true,+ "noEmit": true,+ "jsx": "react-jsx",+ "baseUrl": ".",+ "useUnknownInCatchVariables": false,+ "paths": {+ "@web/*": ["../web/src/*"],+ "@playwright-core/*": ["../playwright-core/src/*"],+ "@playwright-test/*": ["../playwright-test/src/*"],+ "playwright-core/lib/*": ["../playwright-core/src/*"],+ "playwright-test/lib/*": ["../playwright-test/src/*"],+ }+ },+ "include": ["src"],+ "references": [{ "path": "./tsconfig.node.json" }]+}diff --git a/packages/html-reporter/tsconfig.node.json b/packages/html-reporter/tsconfig.node.jsonnew file mode 100644index 0000000000..e993792cb1--- /dev/null+++ b/packages/html-reporter/tsconfig.node.json@@ -0,0 +1,8 @@+{+ "compilerOptions": {+ "composite": true,+ "module": "esnext",+ "moduleResolution": "node"+ },+ "include": ["vite.config.ts"]+}diff --git a/packages/html-reporter/vite.config.ts b/packages/html-reporter/vite.config.tsnew file mode 100644index 0000000000..70dd5d8a14--- /dev/null+++ b/packages/html-reporter/vite.config.ts@@ -0,0 +1,50 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { defineConfig } from 'vite';+import react from '@vitejs/plugin-react';+import { bundle } from './bundle';+import * as path from 'path';++// https://vitejs.dev/config/+export default defineConfig({+ plugins: [+ react(),+ bundle()+ ],+ resolve: {+ alias: {+ '@web': path.resolve(__dirname, '../web/src'),+ '@playwright-core': path.resolve(__dirname, '../playwright-core/src'),+ },+ },+ build: {+ outDir: path.resolve(__dirname, 'dist'),+ emptyOutDir: true,+ assetsInlineLimit: 100000000,+ chunkSizeWarningLimit: 100000000,+ cssCodeSplit: false,+ rollupOptions: {+ inlineDynamicImports: true,+ output: {+ manualChunks: undefined,+ },+ },+ },+ server: {+ port: 3101,+ },+});diff --git a/packages/html-reporter/webpack.config.js b/packages/html-reporter/webpack.config.jsdeleted file mode 100644index 059d769852..0000000000--- a/packages/html-reporter/webpack.config.js+++ /dev/null@@ -1,65 +0,0 @@-/*- Copyright (c) Microsoft Corporation.-- Licensed under the Apache License, Version 2.0 (the "License");- you may not use this file except in compliance with the License.- You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0-- Unless required by applicable law or agreed to in writing, software- distributed under the License is distributed on an "AS IS" BASIS,- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- See the License for the specific language governing permissions and- limitations under the License.-*/--const path = require('path');-const HtmlWebPackPlugin = require('html-webpack-plugin');-const BundleJsPlugin = require('./bundleJsPlugin');--const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development';--module.exports = {- mode,- entry: {- zip: require.resolve('@zip.js/zip.js/dist/zip-no-worker-inflate.min.js'),- app: path.join(__dirname, 'src', 'index.tsx'),- },- resolve: {- extensions: ['.ts', '.js', '.tsx', '.jsx']- },- devtool: mode === 'production' ? false : 'source-map',- output: {- globalObject: 'self',- filename: '[name].bundle.js',- path: path.resolve(__dirname, '..', 'playwright-core', 'lib', 'webpack', 'htmlReport')- },- module: {- rules: [- {- test: /\.(j|t)sx?$/,- loader: 'babel-loader',- options: {- presets: [- "@babel/preset-typescript",- "@babel/preset-react"- ]- },- exclude: /node_modules/- },- {- test: /\.css$/,- use: ['style-loader', 'css-loader']- },- ]- },- plugins: [- new HtmlWebPackPlugin({- title: 'Playwright Test Report',- template: path.join(__dirname, 'src', 'index.html'),- inject: true,- }),- new BundleJsPlugin(),- ]-};diff --git a/packages/playwright-core/src/client/types.ts b/packages/playwright-core/src/client/types.tsindex 0753a76c4a..348fe0239d 100644--- a/packages/playwright-core/src/client/types.ts+++ b/packages/playwright-core/src/client/types.ts@@ -17,7 +17,7 @@import * as channels from '../protocol/channels';import type { Size } from '../common/types';-export { Size, Point, Rect, Quad, URLMatch, TimeoutOptions, HeadersArray } from '../common/types';+export type { Size, Point, Rect, Quad, URLMatch, TimeoutOptions, HeadersArray } from '../common/types';type LoggerSeverity = 'verbose' | 'info' | 'warning' | 'error';export interface Logger {diff --git a/packages/playwright-core/src/protocol/validator.ts b/packages/playwright-core/src/protocol/validator.tsindex f6f0fd1560..c8d4b5f8bb 100644--- a/packages/playwright-core/src/protocol/validator.ts+++ b/packages/playwright-core/src/protocol/validator.ts@@ -17,7 +17,8 @@// This file is generated by generate_channels.js, do not edit manually.import { Validator, ValidationError, tOptional, tObject, tBoolean, tNumber, tString, tAny, tEnum, tArray, tBinary } from './validatorPrimitives';-export { Validator, ValidationError } from './validatorPrimitives';+export type { Validator } from './validatorPrimitives';+export { ValidationError } from './validatorPrimitives';type Scheme = { [key: string]: Validator };diff --git a/packages/playwright-test/src/types.ts b/packages/playwright-test/src/types.tsindex 057f298851..727cff575e 100644--- a/packages/playwright-test/src/types.ts+++ b/packages/playwright-test/src/types.ts@@ -18,7 +18,7 @@ import type { Fixtures, TestError } from '../types/test';import type { Location } from '../types/testReporter';import type { FullConfig as FullConfigPublic } from './types';export * from '../types/test';-export { Location } from '../types/testReporter';+export type { Location } from '../types/testReporter';export type FixturesWithLocation = {fixtures: Fixtures;diff --git a/packages/playwright-test/src/util.ts b/packages/playwright-test/src/util.tsindex 7d249fbaf4..71bcd27283 100644--- a/packages/playwright-test/src/util.ts+++ b/packages/playwright-test/src/util.ts@@ -26,7 +26,7 @@ import { isInternalFileName } from 'playwright-core/lib/utils/stackTrace';import { currentTestInfo } from './globals';import { captureStackTrace as coreCaptureStackTrace, ParsedStackTrace } from 'playwright-core/lib/utils/stackTrace';-export { ParsedStackTrace };+export type { ParsedStackTrace };const PLAYWRIGHT_CORE_PATH = path.dirname(require.resolve('playwright-core'));const EXPECT_PATH = path.dirname(require.resolve('expect'));diff --git a/tsconfig.json b/tsconfig.jsonindex 3bdeb59f29..6791b869f2 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -26,6 +26,7 @@"include": ["packages"],"exclude": ["packages/*/lib",+ "packages/html-reporter","packages/recorder","packages/trace-viewer","packages/web",diff --git a/utils/build/build.js b/utils/build/build.jsindex f8c01a59fe..95afd0439f 100644--- a/utils/build/build.js+++ b/utils/build/build.js@@ -192,8 +192,6 @@ steps.push({// Build injected scripts.const webPackFiles = ['packages/playwright-core/src/server/injected/webpack.config.js',- 'packages/html-reporter/webpack.config.js',- 'packages/html-reporter/tests/webpack.config.js',];for (const file of webPackFiles) {steps.push({@@ -253,34 +251,22 @@ onChanges.push({script: 'utils/generate_types/index.js',});-// Update web clients.-onChanges.push({- committed: false,- inputs: [- 'packages/trace-viewer/index.html',- 'packages/trace-viewer/pubic/',- 'packages/trace-viewer/src/',- 'packages/trace-viewer/view.config.ts',- 'packages/web/src/',- ],- command: 'npx',- args: ['vite', 'build'],- cwd: path.join(__dirname, '..', '..', 'packages', 'trace-viewer'),-});--onChanges.push({- committed: false,- inputs: [- 'packages/recorder/index.html',- 'packages/recorder/pubic/',- 'packages/recorder/src/',- 'packages/recorder/view.config.ts',- 'packages/web/src/',- ],- command: 'npx',- args: ['vite', 'build'],- cwd: path.join(__dirname, '..', '..', 'packages', 'recorder'),-});+// Rebuild web projects on change.+for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {+ onChanges.push({+ committed: false,+ inputs: [+ `packages/${webPackage}/index.html`,+ `packages/${webPackage}/pubic/`,+ `packages/${webPackage}/src/`,+ `packages/${webPackage}/view.config.ts`,+ `packages/web/src/`,+ ],+ command: 'npx',+ args: ['vite', 'build'],+ cwd: path.join(__dirname, '..', '..', 'packages', webPackage),+ });+}// The recorder and trace viewer have an app_icon.png that needs to be copied.copyFiles.push({@@ -321,16 +307,13 @@ if (lintMode) {args: ['tsc', ...(watchMode ? ['-w'] : []), '-p', quotePath(filePath('.'))],shell: true,});- steps.push({- command: 'npx',- args: ['tsc', ...(watchMode ? ['-w'] : []), '-p', quotePath(filePath('packages/recorder'))],- shell: true,- });- steps.push({- command: 'npx',- args: ['tsc', ...(watchMode ? ['-w'] : []), '-p', quotePath(filePath('packages/trace-viewer'))],- shell: true,- });+ for (const webPackage of ['html-reporter', 'recorder', 'trace-viewer']) {+ steps.push({+ command: 'npx',+ args: ['tsc', ...(watchMode ? ['-w'] : []), '-p', quotePath(filePath(`packages/${webPackage}`))],+ shell: true,+ });+ }}watchMode ? runWatch() : runBuild();diff --git a/utils/check_deps.js b/utils/check_deps.jsindex 31b5de466e..53645a107c 100644--- a/utils/check_deps.js+++ b/utils/check_deps.js@@ -146,7 +146,7 @@ async function innerCheckDeps(root, checkDepsFile, checkPackageJson) {while (!depsFile[from]) {if (from.lastIndexOf('/') === -1)- throw new Error(`Cannot find DEPS for ${fromDirectory}`);+ return false;from = from.substring(0, from.lastIndexOf('/'));}@@ -180,7 +180,7 @@ async function innerCheckDeps(root, checkDepsFile, checkPackageJson) {if (error.code !== 'MODULE_NOT_FOUND')throw error;}- return !!packageJSON.dependencies[importName];+ return !!(packageJSON.dependencies || {})[importName];}}diff --git a/utils/generate_channels.js b/utils/generate_channels.jsindex f03eda0c7a..31e4c3edd7 100755--- a/utils/generate_channels.js+++ b/utils/generate_channels.js@@ -150,7 +150,8 @@ const validator_ts = [// This file is generated by ${path.basename(__filename)}, do not edit manually.import { Validator, ValidationError, tOptional, tObject, tBoolean, tNumber, tString, tAny, tEnum, tArray, tBinary } from './validatorPrimitives';-export { Validator, ValidationError } from './validatorPrimitives';+export type { Validator } from './validatorPrimitives';+export { ValidationError } from './validatorPrimitives';type Scheme = { [key: string]: Validator };