From a198613177582dbf7c7d4b4377afeb72d24fdb8e Mon Sep 17 00:00:00 2001 From: LiuHanZhi Date: Tue, 7 Jul 2026 00:38:26 +0800 Subject: [PATCH] test: add regression for non-count option with value 1 Refs: https://github.com/yargs/yargs-parser/issues/506 --- test/yargs-parser.mjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/yargs-parser.mjs b/test/yargs-parser.mjs index 4c692375..6e188ed5 100644 --- a/test/yargs-parser.mjs +++ b/test/yargs-parser.mjs @@ -1529,6 +1529,13 @@ describe('yargs-parser', function () { }) }) + + it('should not increment non-count options when value equals 1', function () { + const result = parser('-x 3 -x 1') + result.should.have.property('x') + result.x.should.eql([3, 1]) + }) + describe('count', function () { it('should count the number of times a boolean is present', function () { let parsed