Skip to content

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

test: no deprecation warning during installation tests (#36576)

Max Schmittdfdd47a19dbb
diff --git a/tests/installation/npmTest.ts b/tests/installation/npmTest.ts
index 9360ce8a50..fef212c0ca 100644
--- a/tests/installation/npmTest.ts
+++ b/tests/installation/npmTest.ts
@@ -158,12 +158,11 @@ export const test = _test
},
exec: async ({ tmpWorkspace, _browsersPath, isolateBrowsers }, use, testInfo) => {
await use(async (cmd: string, ...argsAndOrOptions: [] | [...string[]] | [...string[], ExecOptions] | [ExecOptions]) => {
- let args: string[] = [];
let options: ExecOptions = {};
if (typeof argsAndOrOptions[argsAndOrOptions.length - 1] === 'object')
options = argsAndOrOptions.pop() as ExecOptions;
- args = argsAndOrOptions as string[];
+ const command = [cmd, ...argsAndOrOptions].join(' ');
let result!: {stdout: string, stderr: string, code: number | null, error?: Error};
const cwd = options.cwd ?? tmpWorkspace;
@@ -176,11 +175,10 @@ export const test = _test
...(isolateBrowsers ? { PLAYWRIGHT_BROWSERS_PATH: _browsersPath } : {}),
...options.env,
};
- await test.step(`exec: ${[cmd, ...args].join(' ')}`, async () => {
- result = await spawnAsync(cmd, args, { shell: true, cwd, env });
+ await test.step(`exec: ${command}`, async () => {
+ result = await spawnAsync(command, { shell: true, cwd, env });
});
- const command = [cmd, ...args].join(' ');
const stdio = result.stdout + result.stderr;
const commandEnv = Object.entries(env).map(e => `${e[0]}=${e[1]}`).join(' ');
const fullCommand = `cd ${cwd} && ${commandEnv} ${command}`;