From edb75aebd7cc4386307b8a13f4cf2cb46806c188 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 21 Jul 2024 17:53:07 +0200 Subject: [PATCH] test: use `PYTHON` executable from env in `assertSnapshot` PR-URL: https://github.com/nodejs/node/pull/53938 Reviewed-By: Luigi Pinca Reviewed-By: Benjamin Gruenbaum --- test/common/assertSnapshot.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/common/assertSnapshot.js b/test/common/assertSnapshot.js index c4a30a5bae5db7..a22455160bd9f7 100644 --- a/test/common/assertSnapshot.js +++ b/test/common/assertSnapshot.js @@ -78,8 +78,11 @@ async function spawnAndAssert(filename, transform = (x) => x, { tty = false, ... return; } const flags = common.parseTestFlags(filename); - const executable = tty ? path.join(__dirname, '../..', 'tools/pseudo-tty.py') : process.execPath; - const args = tty ? [process.execPath, ...flags, filename] : [...flags, filename]; + const executable = tty ? (process.env.PYTHON || 'python3') : process.execPath; + const args = + tty ? + [path.join(__dirname, '../..', 'tools/pseudo-tty.py'), process.execPath, ...flags, filename] : + [...flags, filename]; const { stdout, stderr } = await common.spawnPromisified(executable, args, options); await assertSnapshot(transform(`${stdout}${stderr}`), filename); }