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(build): spawn watcher tools directly instead of via npx (#41034)
Simon Knotte8916e894be5
diff --git a/utils/build/build.js b/utils/build/build.jsindex 814da980b2..e748eca252 100644--- a/utils/build/build.js+++ b/utils/build/build.js@@ -80,12 +80,21 @@ function filePath(relative) {}/**- * @param {string} path+ * Resolve a CLI shipped by a node_modules package to an absolute path, so we+ * can spawn it via `node` directly instead of going through `npx`/`npm exec`+ * (which adds a shell + npm wrapper process per concurrent build).+ * @param {string} pkg+ * @param {string} binName* @returns {string}*/-function quotePath(path) {- return "\"" + path + "\"";+function resolveNodeBin(pkg, binName) {+ // Resolve via package.json (always allowed) rather than a subpath that may+ // be excluded by the package's `exports` field.+ const pkgJson = require.resolve(`${pkg}/package.json`, { paths: [ROOT] });+ return path.join(path.dirname(pkgJson), require(pkgJson).bin[binName]);}+const VITE_BIN = resolveNodeBin('vite', 'vite');+const TSC_BIN = resolveNodeBin('typescript', 'tsc');class Step {/**@@ -866,15 +875,15 @@ const pkgSizePlugin = {const webPackages = ['html-reporter', 'recorder', 'trace-viewer', 'dashboard'];for (const webPackage of webPackages) {steps.push(new ProgramStep({- command: 'npx',+ command: process.execPath,args: [- 'vite',+ VITE_BIN,'build',...(watchMode ? ['--watch', '--minify=false'] : []),...(withSourceMaps ? ['--sourcemap=inline'] : []),'--clearScreen=false',],- shell: true,+ shell: false,cwd: path.join(__dirname, '..', '..', 'packages', webPackage),concurrent: true,}));@@ -882,15 +891,15 @@ for (const webPackage of webPackages) {// Build/watch extensionsteps.push(new ProgramStep({- command: 'npx',+ command: process.execPath,args: [- 'vite',+ VITE_BIN,'build',...(watchMode ? ['--watch', '--minify=false'] : []),...(withSourceMaps ? ['--sourcemap=inline'] : []),'--clearScreen=false',],- shell: true,+ shell: false,cwd: path.join(__dirname, '..', '..', 'packages', 'extension'),concurrent: true,}));@@ -1014,9 +1023,9 @@ copyFiles.push({if (watchMode) {// Run TypeScript for type checking.steps.push(new ProgramStep({- command: 'npx',- args: ['tsc', '-w', '--preserveWatchOutput', '-p', quotePath(filePath('.'))],- shell: true,+ command: process.execPath,+ args: [TSC_BIN, '-w', '--preserveWatchOutput', '-p', filePath('.')],+ shell: false,concurrent: true,}));}