Skip to content

Commit 4c286d2

Browse files
committed
added new test
1 parent 39ea696 commit 4c286d2

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

test/parallel/test-node-run.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,25 @@ describe('node --run [command]', () => {
233233
{ cwd: fixtures.path('run-script/sub-directory') }
234234
);
235235

236-
const outputPath = child.stdout.trim();
237-
const stat = fs.lstatSync(outputPath);
238-
239-
assert.ok(stat.isDirectory(), `Output path ${outputPath} is not a directory`);
240236
assert.strictEqual(child.stdout.trim(), customDir);
241237
assert.strictEqual(child.stderr, '');
242238
assert.strictEqual(child.code, 0);
243239
});
240+
241+
it('returns error on non-directory path for --run-dir', async () => {
242+
const nonDirPath = fixtures.path('run-script/non-directory-file');
243+
fs.writeFileSync(nonDirPath, 'dummy content');
244+
245+
const child = await common.spawnPromisified(
246+
process.execPath,
247+
[ '--run-dir', nonDirPath, '--run', 'pwd' ],
248+
{ cwd: fixtures.path('run-script') }
249+
);
250+
251+
assert.match(child.stderr, /not a directory/);
252+
assert.strictEqual(child.stdout, '');
253+
assert.strictEqual(child.code, 1);
254+
255+
fs.unlinkSync(nonDirPath);
256+
});
244257
});

0 commit comments

Comments
 (0)