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
This issue seems to arise with the v4.0.0 release, but I finally got around to investigating with v4.2.0. I'm not sure this is specific to joi, but that's where I'm seeing the issue. It's not obvious to me what the problem is because it appears to be related to a simple require() statement, which seems unlikely. If you have better ideas of what to dig into from the details below, I'm happy to help investigate.
I'm running cucumber tests that stub fs for writing a json file and then the tests read the file and verify it's structure using joi. When calling either joi.assert() or joi.validate(), I get the following error related to the require() statement here
Error: ENOENT, no such file or directory '/path/to/my/project/node_modules'
at Binding.<anonymous> (/path/to/my/project/node_modules/mock-fs/lib/binding.js:988:13)
at maybeCallback (/path/to/my/project/node_modules/mock-fs/lib/binding.js:43:17)
at Binding.lstat (/path/to/my/project/node_modules/mock-fs/lib/binding.js:985:10)
at Object.fs.lstatSync (fs.js:893:18)
at Object.realpathSync (fs.js:1527:21)
at toRealPath (module.js:132:13)
at tryFile (module.js:128:22)
at tryExtensions (module.js:140:22)
at Function.Module._findPath (module.js:192:20)
at Function.Module._resolveFilename (module.js:470:25)
at Function.Module._load (module.js:420:25)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)
at Object.checkOptions (/path/to/my/project/node_modules/joi/lib/any.js:81:25)
at Object._validateWithOptions (/path/to/my/project/node_modules/joi/lib/any.js:602:18)
at Object.root.validate (/path/to/my/project/node_modules/joi/lib/index.js:121:23)
If I call .restore() after reading the file from the stubbed filesystem, but before running joi things work as I would expect. (I was already calling .restore() after each test)
The text was updated successfully, but these errors were encountered:
This issue seems to arise with the
v4.0.0
release, but I finally got around to investigating withv4.2.0
. I'm not sure this is specific tojoi
, but that's where I'm seeing the issue. It's not obvious to me what the problem is because it appears to be related to a simplerequire()
statement, which seems unlikely. If you have better ideas of what to dig into from the details below, I'm happy to help investigate.I'm running cucumber tests that stub fs for writing a
json
file and then the tests read the file and verify it's structure usingjoi
. When calling eitherjoi.assert()
orjoi.validate()
, I get the following error related to therequire()
statement hereIf I call
.restore()
after reading the file from the stubbed filesystem, but before runningjoi
things work as I would expect. (I was already calling.restore()
after each test)The text was updated successfully, but these errors were encountered: