Skip to content

Commit 20c7cfa

Browse files
committed
Throw error on options-as-properties config after setting option values
1 parent 43c455f commit 20c7cfa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/command.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
748748
*/
749749

750750
storeOptionsAsProperties(storeAsProperties = true) {
751-
this._storeOptionsAsProperties = !!storeAsProperties;
752751
if (this.options.length) {
753752
throw new Error('call .storeOptionsAsProperties() before adding options');
754753
}
754+
if (Object.keys(this._optionValues).length) {
755+
throw new Error('call .storeOptionsAsProperties() before setting option values');
756+
}
757+
this._storeOptionsAsProperties = !!storeAsProperties;
755758
return this;
756759
}
757760

0 commit comments

Comments
 (0)