mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
test: add subtests to test-node-run
Added two subtests to test-node-run. First one is about unparsable package.json file, and the second one is about there is no "script" fields in package.json PR-URL: https://github.com/nodejs/node/pull/54204 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
1 parent
a5a320cd5b
commit
6bcbfcd7bc
3 files changed
+26
No files matched your search
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"types" : ""
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "non-parsable package.json"
|
||||
@@ -113,4 +113,26 @@ describe('node --run [command]', () => {
|
||||
assert.strictEqual(child.stderr, '');
|
||||
assert.strictEqual(child.code, 0);
|
||||
});
|
||||
|
||||
it('returns error on unparsable file', async () => {
|
||||
const child = await common.spawnPromisified(
|
||||
process.execPath,
|
||||
[ '--no-warnings', '--run', 'test'],
|
||||
{ cwd: fixtures.path('run-script/cannot-parse') },
|
||||
);
|
||||
assert.match(child.stderr, /Can't parse package\.json/);
|
||||
assert.strictEqual(child.stdout, '');
|
||||
assert.strictEqual(child.code, 1);
|
||||
});
|
||||
|
||||
it('returns error when there is no "scripts" field file', async () => {
|
||||
const child = await common.spawnPromisified(
|
||||
process.execPath,
|
||||
[ '--no-warnings', '--run', 'test'],
|
||||
{ cwd: fixtures.path('run-script/cannot-find-script') },
|
||||
);
|
||||
assert.match(child.stderr, /Can't find "scripts" field in package\.json/);
|
||||
assert.strictEqual(child.stdout, '');
|
||||
assert.strictEqual(child.code, 1);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user