You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's the test case that mimics the issue I encountered:
it.only('shouldn\'t fail if an option implies on a number option where value is 0', () => {
let failCalled = false
const argv = yargs('--bool --num 0')
.boolean('bool')
.number('num')
.implies('bool', 'num')
.fail((msg) => {
failCalled = true
})
.argv
failCalled.should.be.false
expect(argv.bool).to.be.true
expect(argv.num).equals(0)
})
Running mocha, this prints the following:
validation tests
implies
1) shouldn't fail if an option implies on a number option where value is 0
0 passing (57ms)
1 failing
1) validation tests implies shouldn't fail if an option implies on a number option where value is 0:
AssertionError: expected true to be false
+ expected - actual
-true
+false
at Context.it.only (test\validation.js:171:28)
This should clearly not be failing as 0 is a valid number but on my project, I get implication error when 0 is passed as the value. Note that other values work fine. I believe this is because the code relies on JS coercion to determine if the implied key exists or not. I have already tried and made a quick-fix which currently passes all the tests including this one but JIC, need to know if I'm missing something regarding this issue.
The text was updated successfully, but these errors were encountered:
Here's the test case that mimics the issue I encountered:
Running
mocha
, this prints the following:This should clearly not be failing as 0 is a valid number but on my project, I get implication error when 0 is passed as the value. Note that other values work fine. I believe this is because the code relies on JS coercion to determine if the implied key exists or not. I have already tried and made a quick-fix which currently passes all the tests including this one but JIC, need to know if I'm missing something regarding this issue.
The text was updated successfully, but these errors were encountered: