frisby
frisby copied to clipboard
Latest joi version does not work
If i set up the Joi assertions like in the readme with
require('joi');
type assertion does not work.
If i use the the one coming with frisby
frisby.Joi
it work.
There seems to be a problem with the latest one?
Can confirm. The last working major version seems to be @hapi/joi@15
. Later versions of @hapi/joi
and (from 17 on) joi
fail with this error:
Message:
Invalid schema content: (someArray.$_root.alternatives)
at Object.<anonymous>.exports.schema (node_modules/frisby/node_modules/joi/lib/cast.js:55:10)
at Object.<anonymous>.internals.Object.keys (node_modules/frisby/node_modules/joi/lib/types/object/index.js:359:35)
at Object.<anonymous>.exports.schema (node_modules/frisby/node_modules/joi/lib/cast.js:36:29)
at Object.<anonymous>.internals.Object.keys (node_modules/frisby/node_modules/joi/lib/types/object/index.js:359:35)
at Object.<anonymous>.exports.schema (node_modules/frisby/node_modules/joi/lib/cast.js:36:29)
at Object.<anonymous>.internals.Object.keys (node_modules/frisby/node_modules/joi/lib/types/object/index.js:359:35)
at Object.<anonymous>.exports.schema (node_modules/frisby/node_modules/joi/lib/cast.js:36:29)
at Object.<anonymous>.module.exports.internals.Any.root.compile (node_modules/frisby/node_modules/joi/lib/index.js:158:25)
at Object.<anonymous>.module.exports.internals.Any.root.validate (node_modules/frisby/node_modules/joi/lib/index.js:144:29)
at jsonTypesAssertion (node_modules/frisby/src/frisby/expects.js:122:24)
at node_modules/frisby/src/frisby/utils.js:67:7
at arrayEach (node_modules/lodash/lodash.js:530:11)
at Function.forEach (node_modules/lodash/lodash.js:9410:14)
at Object.withPath (node_modules/frisby/src/frisby/utils.js:66:7)
at FrisbySpec.jsonTypes (node_modules/frisby/src/frisby/expects.js:121:11)
at node_modules/frisby/src/frisby/spec.js:421:23
at node_modules/frisby/src/frisby/spec.js:250:34
when the expectation is this:
.expect('jsonTypes', '*', {
someArray Joi.array()
})
❯ npm ls frisby
<my project name>@ /<my project path>
└── [email protected]
❯ node -v
v19.5.0
Actually it is not released yet. Try npm i -D github:vlucas/frisby
instead.
Time to release 3.0.0 then, I guess? :)