Empty refs (i.e. '', [], or {}) don't have anything in the ref to not be in the values, so misses is false, so in the following block:
if (options.only) {
if (misses || !options.once) {
return !misses;
}
}
If only is true and once isn't, contain will always return true.
This bug was introduced in https://github.com/hapijs/hoek/pull/276. That's Hoek 6.0.2, and I found it via its effects on Code (expect(ref).to.only.include(value)) after version 5.2.2.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Empty refs (i.e.
''
,[]
, or{}
) don't have anything in the ref to not be in the values, somisses
is false, so in the following block:If
only
is true andonce
isn't,contain
will always return true.This bug was introduced in https://github.com/hapijs/hoek/pull/276. That's Hoek 6.0.2, and I found it via its effects on Code (
expect(ref).to.only.include(value)
) after version 5.2.2.