From a0f541a048da12d4b9c64f0ddcae439c18ce7827 Mon Sep 17 00:00:00 2001 From: John Gee Date: Sat, 7 Oct 2023 16:45:23 +1300 Subject: [PATCH] Comment out new misuse check until a major version --- lib/command.js | 6 +++--- tests/commander.configureCommand.test.js | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/command.js b/lib/command.js index 1f933cead..21e90e40b 100644 --- a/lib/command.js +++ b/lib/command.js @@ -751,9 +751,9 @@ Expecting one of '${allowedValues.join("', '")}'`); if (this.options.length) { throw new Error('call .storeOptionsAsProperties() before adding options'); } - if (Object.keys(this._optionValues).length) { - throw new Error('call .storeOptionsAsProperties() before setting option values'); - } + // if (Object.keys(this._optionValues).length) { + // throw new Error('call .storeOptionsAsProperties() before setting option values'); + // } this._storeOptionsAsProperties = !!storeAsProperties; return this; } diff --git a/tests/commander.configureCommand.test.js b/tests/commander.configureCommand.test.js index 60940ec18..9c5a72d03 100644 --- a/tests/commander.configureCommand.test.js +++ b/tests/commander.configureCommand.test.js @@ -85,10 +85,10 @@ test('when storeOptionsAsProperties() after adding option then throw', () => { }).toThrow(); }); -test('when storeOptionsAsProperties() after setting option value then throw', () => { - const program = new commander.Command(); - program.setOptionValue('foo', 'bar'); - expect(() => { - program.storeOptionsAsProperties(); - }).toThrow(); -}); +// test('when storeOptionsAsProperties() after setting option value then throw', () => { +// const program = new commander.Command(); +// program.setOptionValue('foo', 'bar'); +// expect(() => { +// program.storeOptionsAsProperties(); +// }).toThrow(); +// });