Does not declare any runtime dependencies
robross0606 opened this issue ยท 4 comments
Description
This project only declares devDependencies
which is not really accurate. devDependencies
are not transitory which means there is not currently any declared version compatibility limitation with respect to Jest and this project when used together in another project. However, this project breaks with jest
and jest-jasmine2
^28:
Cannot find module 'expect/build/jasmineUtils' from 'node_modules/expect-more-jest/dist/to-be-array-of.js'
Require stack:
node_modules/expect-more-jest/dist/to-be-array-of.js
node_modules/expect-more-jest/dist/index.js
at Resolver._throwModNotFoundError (node_modules/jest-runtime/node_modules/jest-resolve/build/resolver.js:491:11)
at Object.<anonymous> (node_modules/expect-more-jest/dist/to-be-array-of.js:5:22)
Suggested Solution
This project should be declaring regular runtime dependencies or peer dependencies for any version requirements it needs to run. Otherwise, users of this library are not alerted that this library even requires jest
let alone that it only works with certain versions.
good spot, thanks ๐๐ป
Thanks @robross0606, the expect/build/jasmineUtils
issue should hopefully now be fixed in expect-more-jest@5.4.1.
On dependencies, expect-more-jest
defines its runtime dependencies at:
expect-more/packages/expect-more-jest/package.json
Lines 10 to 14 in 1289cfb
Something I'm not completely sure about that you can maybe help with โ the package being depended on was expect
rather than jest
and that was defined in dependencies
โ but it still broke. jest
depends on this too and maybe it won out(?) I'm not entirely sure.
Diff: 3ebb252#diff-7d360743c6462dda3f5045aae1eb86d4a140e9f709033fa04fab9d4a980547da
I'd have to compare the versions of jest
too to be sure. The real question is whether your true dependency was on expect
or was on expect-utils
. If you make calls that rely on a specific version of expect-utils
then you need to declare that, regardless of whether you're declaring expect
too. It is entirely possible that expect-utils
could make a breaking change to their API while still using the same version of expect
. I'm not well versed enough in how jest
sets up all its packages to know for sure how the transitive dependencies were shaking out.
I think this can be closed.