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
feat(rpc): run generate-channels during lint (#3238)
Dmitry Gozman6297f86cfa68
diff --git a/package.json b/package.jsonindex e738d757d4..09592ea4d6 100644--- a/package.json+++ b/package.json@@ -18,7 +18,7 @@"tsc-installer": "tsc -p ./src/install/tsconfig.json","doc": "node utils/doclint/cli.js","test-infra": "node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js && node utils/testrunner/test/test.js",- "lint": "npm run eslint && npm run tsc && npm run doc && npm run check-deps && npm run test-types && npm run test-infra",+ "lint": "npm run eslint && npm run tsc && npm run doc && npm run check-deps && npm run generate-channels && npm run test-types && npm run test-infra","debug-test": "node --inspect-brk test/test.js","clean": "rimraf lib && rimraf types","prepare": "node install-from-github.js",@@ -26,6 +26,7 @@"watch": "node utils/runWebpack.js --mode='development' --watch --silent | tsc -w -p .","test-types": "npm run generate-types && npx -p [email protected] tsc -p utils/generate_types/test/tsconfig.json && npm run typecheck-tests","generate-types": "node utils/generate_types/",+ "generate-channels": "node utils/generate_channels.js","typecheck-tests": "tsc -p ./test/","roll-browser": "node utils/roll_browser.js","jest": "jest",diff --git a/src/rpc/channels.ts b/src/rpc/channels.tsindex 0a7dbbbced..f89cb117b7 100644--- a/src/rpc/channels.ts+++ b/src/rpc/channels.ts@@ -2034,7 +2034,7 @@ export type RouteAbortParams = {errorCode?: string,};export type RouteAbortOptions = {-+ errorCode?: string,};export type RouteAbortResult = void;export type RouteContinueParams = {@@ -2064,7 +2064,13 @@ export type RouteFulfillParams = {isBase64?: boolean,};export type RouteFulfillOptions = {-+ status?: number,+ headers?: {+ name: string,+ value: string,+ }[],+ body?: string,+ isBase64?: boolean,};export type RouteFulfillResult = void;diff --git a/utils/generate_channels.js b/utils/generate_channels.jsindex aecf1b792f..d70dacad95 100755--- a/utils/generate_channels.js+++ b/utils/generate_channels.js@@ -229,5 +229,18 @@ validator_ts.push(`}`);-fs.writeFileSync(path.join(__dirname, '..', 'src', 'rpc', 'channels.ts'), channels_ts.join('\n'), 'utf-8');-fs.writeFileSync(path.join(__dirname, '..', 'src', 'rpc', 'validator.ts'), validator_ts.join('\n'), 'utf-8');+let hasChanges = false;++function writeFile(filePath, content) {+ const existing = fs.readFileSync(filePath, 'utf8');+ if (existing === content)+ return;+ hasChanges = true;+ const root = path.join(__dirname, '..');+ console.log(`Writing //${path.relative(root, filePath)}`);+ fs.writeFileSync(filePath, content, 'utf8');+}++writeFile(path.join(__dirname, '..', 'src', 'rpc', 'channels.ts'), channels_ts.join('\n'));+writeFile(path.join(__dirname, '..', 'src', 'rpc', 'validator.ts'), validator_ts.join('\n'));+process.exit(hasChanges ? 1 : 0);