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
fix: throw error when workers option is not number or percentage (#31210)
Lee Byonghunabaddc01c9ef
diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.tsindex 015dbc1e71..ac7b313820 100644--- a/packages/playwright/src/common/config.ts+++ b/packages/playwright/src/common/config.ts@@ -107,7 +107,7 @@ export class FullConfigInternal {const cpus = os.cpus().length;this.config.workers = Math.max(1, Math.floor(cpus * (parseInt(workers, 10) / 100)));} else {- this.config.workers = parseInt(workers, 10);+ this.config.workers = parseWorkers(workers);}} else {this.config.workers = workers;@@ -223,6 +223,14 @@ function resolveReporters(reporters: Config['reporter'], rootDir: string): Repor});}+function parseWorkers(workers: string) {+ const parsedWorkers = parseInt(workers, 10);+ if (isNaN(parsedWorkers))+ throw new Error(`Workers ${workers} must be a number or percentage.`);++ return parsedWorkers;+}+function resolveProjectDependencies(projects: FullProjectInternal[]) {const teardownSet = new Set<FullProjectInternal>();for (const project of projects) {