Skip to content

Commit

Permalink
test: fix subtest nodejs#1, nodejs#2 of test-node-run
Browse files Browse the repository at this point in the history
Subtest nodejs#1, nodejs#2 of test-node-run.js originally matched the error message
"Can't read package.json" on non-existent file. However, the subtests
failed on Ubuntu20.04. we found that attempting to run a non-existent
script like `node --run foo` using the latest version of node results in
an error message like `Can't find “scripts” field in package.json`
(on Ubuntu20.04, regardless of whether package.json is present in the
subpath or not). So we modified the subtest so that if we match either
of the two messages, the test passes.
  • Loading branch information
sungpaks committed Jul 29, 2024
1 parent 5210cd8 commit 0837107
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/parallel/test-node-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('node --run [command]', () => {
{ cwd: __dirname },
);
assert.match(child.stderr, /ExperimentalWarning: Task runner is an experimental feature and might change at any time/);
assert.match(child.stderr, /Can't read package\.json/);
assert.match(child.stderr, /Can't read package\.json|Can't find "scripts" field in package\.json/);
assert.strictEqual(child.stdout, '');
assert.strictEqual(child.code, 1);
});
Expand All @@ -26,7 +26,7 @@ describe('node --run [command]', () => {
[ '--no-warnings', '--run', 'test'],
{ cwd: __dirname },
);
assert.match(child.stderr, /Can't read package\.json/);
assert.match(child.stderr, /Can't read package\.json|Can't find "scripts" field in package\.json/);
assert.strictEqual(child.stdout, '');
assert.strictEqual(child.code, 1);
});
Expand Down

0 comments on commit 0837107

Please sign in to comment.