From 3beba6b238fb20856cac5d745b1aa54c6dbab8ad Mon Sep 17 00:00:00 2001 From: Raashish Aggarwal <94279692+raashish1601@users.noreply.github.com> Date: Mon, 11 May 2026 16:08:03 +0530 Subject: [PATCH] test: migrate node --run message test Signed-off-by: Raashish Aggarwal <94279692+raashish1601@users.noreply.github.com> --- .../run-script}/node_run_non_existent.js | 4 ++-- .../run-script/node_run_non_existent.snapshot} | 3 ++- test/parallel/test-node-output-run.mjs | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) rename test/{message => fixtures/run-script}/node_run_non_existent.js (82%) rename test/{message/node_run_non_existent.out => fixtures/run-script/node_run_non_existent.snapshot} (81%) create mode 100644 test/parallel/test-node-output-run.mjs diff --git a/test/message/node_run_non_existent.js b/test/fixtures/run-script/node_run_non_existent.js similarity index 82% rename from test/message/node_run_non_existent.js rename to test/fixtures/run-script/node_run_non_existent.js index c40eac49f7abc9..b6b8cdcf4fcd09 100644 --- a/test/message/node_run_non_existent.js +++ b/test/fixtures/run-script/node_run_non_existent.js @@ -1,9 +1,9 @@ 'use strict'; -require('../common'); +require('../../common'); const assert = require('node:assert/strict'); const childProcess = require('node:child_process'); -const fixtures = require('../common/fixtures'); +const fixtures = require('../../common/fixtures'); const child = childProcess.spawnSync( process.execPath, diff --git a/test/message/node_run_non_existent.out b/test/fixtures/run-script/node_run_non_existent.snapshot similarity index 81% rename from test/message/node_run_non_existent.out rename to test/fixtures/run-script/node_run_non_existent.snapshot index 06b2ab0bb16a9a..c609031b681be2 100644 --- a/test/message/node_run_non_existent.out +++ b/test/fixtures/run-script/node_run_non_existent.snapshot @@ -1,4 +1,4 @@ -Missing script: "non-existent-command" for * +Missing script: "non-existent-command" for /test/fixtures/run-script/package.json Available scripts are: test: echo "Error: no test specified" && exit 1 @@ -14,3 +14,4 @@ Available scripts are: special-env-variables-windows: special-env-variables.bat pwd: pwd pwd-windows: cd + diff --git a/test/parallel/test-node-output-run.mjs b/test/parallel/test-node-output-run.mjs new file mode 100644 index 00000000000000..4f1e64f10d2689 --- /dev/null +++ b/test/parallel/test-node-output-run.mjs @@ -0,0 +1,15 @@ +import '../common/index.mjs'; +import * as fixtures from '../common/fixtures.mjs'; +import * as snapshot from '../common/assertSnapshot.js'; +import { describe, it } from 'node:test'; + +describe('node --run output', { concurrency: !process.env.TEST_PARALLEL }, () => { + const tests = [ + { name: 'run-script/node_run_non_existent.js' }, + ]; + for (const { name } of tests) { + it(name, async () => { + await snapshot.spawnAndAssert(fixtures.path(name), snapshot.defaultTransform); + }); + } +});