From 283d1b6436c120f489c68ecc85001fcc8c83f8c6 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Thu, 4 Jun 2026 15:30:06 -0400 Subject: [PATCH] Stop printing "error: too many arguments" during tests. Fixes #6079. --- src/test/unit/profiler-edit.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/unit/profiler-edit.test.ts b/src/test/unit/profiler-edit.test.ts index 20a83c0dad..01ff263120 100644 --- a/src/test/unit/profiler-edit.test.ts +++ b/src/test/unit/profiler-edit.test.ts @@ -154,6 +154,10 @@ describe('makeOptionsFromArgv', function () { }); it('throws when -i has no value because next token is a flag', function () { + // Commander writes "error: too many arguments" to stderr before throwing + // (it takes `-o` as the value of `-i` and then sees the output path as an + // unexpected positional). Silence it so it doesn't clutter test output. + jest.spyOn(process.stderr, 'write').mockImplementation(() => true); expect(() => makeOptionsFromArgv([...commonArgs, '-i', '-o', '/path/to/output.json']) ).toThrow();