diff --git a/test/fixtures/parse-args.js b/test/fixtures/parse-args.js new file mode 100644 index 00000000000000..104cabbf679e8a --- /dev/null +++ b/test/fixtures/parse-args.js @@ -0,0 +1,5 @@ +const { parseArgs } = require('util'); + +const parsedArgs = parseArgs({ strict: false }).values; + +process.stdout.write(JSON.stringify(parsedArgs)); diff --git a/test/parallel/test-parse-args.mjs b/test/parallel/test-parse-args.mjs index 23d55ff4d899cc..665ec357c95fbc 100644 --- a/test/parallel/test-parse-args.mjs +++ b/test/parallel/test-parse-args.mjs @@ -1,4 +1,5 @@ import { spawnPromisified } from '../common/index.mjs'; +import { path } from '../common/fixtures.mjs'; import assert from 'node:assert'; import { suite, test } from 'node:test'; import { parseArgs } from 'node:util'; @@ -212,6 +213,8 @@ test('order of option and positional does not matter (per README)', () => { }); suite('correct default args', () => { + const expected = { code: 0, signal: null, stderr: '', stdout: { foo: true, bar: true } }; + suite('with CLI flags', () => { const evalCode = "JSON.stringify(require('util').parseArgs({ strict: false }).values)"; const evalCodePrinted = `process.stdout.write(${evalCode})`; @@ -225,33 +228,21 @@ suite('correct default args', () => { '--print --eval