rjz / supertest-session

Persistent sessions for supertest
Other
88 stars 21 forks source link

Dependency declarations missing for clean load in Yarn PnP / Berry #45

Closed mxro closed 4 years ago

mxro commented 4 years ago

When running supertest-session in a project that uses Yarn PnP / Berry, the following two errors are reported:

supertest-session tried to access methods, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

    Required package: methods (via "methods")
    Required by: supertest-session@virtual:640d59121dc50aef8c4e2e9c0fc24c425951c20d64b04f5476f7080bfeeaf953e8d8f92366ff62026e8f3b035a2de8fa49aa2900c07271fe8ad998892fded072#npm:4.0.0 (via .yarn/$$virtual/supertest-session-virtual-c7c934f209/0/cache/supertest-session-npm-4.0.0-30aab972e9-4b62b93e4e.zip/node_modules/supertest-session/)
supertest-session tried to access cookiejar, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

    Required package: cookiejar (via "cookiejar")
    Required by: supertest-session@virtual:640d59121dc50aef8c4e2e9c0fc24c425951c20d64b04f5476f7080bfeeaf953e8d8f92366ff62026e8f3b035a2de8fa49aa2900c07271fe8ad998892fded072#npm:4.0.0 (via .yarn/$$virtual/supertest-session-virtual-c7c934f209/0/cache/supertest-session-npm-4.0.0-30aab972e9-4b62b93e4e.zip/node_modules/supertest-session/)

This is using version supertest@4.0.0.

Workaround

Add the following to .yarnrc.yml:

packageExtensions:
  supertest-session@*:
    dependencies:
      methods: '*'
      cookiejar: '*
rjz commented 4 years ago

Thanks for this, @mxro! I'd also be very happy to merge an update to this project's package.json if you (or anyone else) is willing to submit a PR.