Skip to content
New issue

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

Latest joi version does not work #586

Open
flogr opened this issue Jan 30, 2023 · 3 comments
Open

Latest joi version does not work #586

flogr opened this issue Jan 30, 2023 · 3 comments
Assignees

Comments

@flogr
Copy link

flogr commented Jan 30, 2023

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?

@jonasholtkamp
Copy link

jonasholtkamp commented Jan 30, 2023

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>
└── frisby@2.1.3

❯ node -v
v19.5.0

@koooge
Copy link
Collaborator

koooge commented Feb 1, 2023

Actually it is not released yet. Try npm i -D github:vlucas/frisby instead.

@jonasholtkamp
Copy link

Time to release 3.0.0 then, I guess? :)

@koooge koooge assigned koooge and vlucas and unassigned koooge Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants