We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@hapi/[email protected]
The module does not ignore the prototype during a comparison.
const Code = require('@hapi/code'); const noProto = Object.create(null); noProto.a = Object.create(null); noProto.a.b = 1; Code.settings.comparePrototypes = false; Code.expect([noProto]).to.once.include({ a: { b: 1 } });
** By using simple objects {} the comparison works as expected.
{}
/Users/manuel_spigolon/dev/misc/hapi/code/lib/index.js:139 throw error; ^ Error: Expected [ [Object: null prototype] { a: [Object: null prototype] { b: 1 } } ] to include { a: { b: 1 } } once at internals.Assertion.internals.include (/Users/manuel_spigolon/dev/misc/hapi/code/lib/index.js:239:17) at Object.<anonymous> (/Users/manuel_spigolon/dev/misc/hapi/code/asd.js:8:32) at Module._compile (node:internal/modules/cjs/loader:1155:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10) at Module.load (node:internal/modules/cjs/loader:1033:32) at Function.Module._load (node:internal/modules/cjs/loader:868:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:22:47 { actual: undefined, expected: undefined, }
No error due to the default comparePrototypes = false setting
comparePrototypes = false
The text was updated successfully, but these errors were encountered:
comparePrototypes is only supposed to work for equal() / equals().
comparePrototypes
equal()
equals()
You should be able to workaround this by checking each array element yourself using equal().
Sorry, something went wrong.
Would you mind accepting a PR to support it with arrays too?
No branches or pull requests
Support plan
Context
@hapi/[email protected]
What are you trying to achieve or the steps to reproduce?
The module does not ignore the prototype during a comparison.
** By using simple objects
{}
the comparison works as expected.What was the result you got?
What result did you expect?
No error due to the default
comparePrototypes = false
settingThe text was updated successfully, but these errors were encountered: