Closed
Description
[REQUIRED] Describe your environment
- Operating System version: Ubuntu 20.10
- Browser version: n/a
- Firebase SDK version: @firebase/rules-unit-testing@1.2.6
- Firebase Product: firestore
[REQUIRED] Describe the problem
@firebase/rules-unit-testing depends on @firebase/component at this code:
but the package.json of the former does not list the latter in the dependencies section. This makes it difficult to use the former with Yarn 2 Plug'n'Play. See https://yarnpkg.com/advanced/rulebook#packages-should-only-ever-require-what-they-formally-list-in-their-dependencies for details of the restrictions Yarn 2 Plug'n'Play puts.
Steps to reproduce:
Set up Yarn 2 with the default settings, which enable Plug'n'Play:
$ mkdir firebase-testcase
$ cd firebase-testcase
$ cat > package.json
{
"name": "firebase-testcase",
"private": true
}
^D
$ yarn set version berry
Install @firebase/rules-unit-testing and jest:
$ yarn add -D @firebase/rules-unit-testing jest
Create a dummy test file:
$ cat > test.js
const testFirebase = require("@firebase/rules-unit-testing");
test('Do nothing', () => {});
^D
Run the test:
$ yarn jest
This results in an error:
@firebase/rules-unit-testing tried to access @firebase/component, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: @firebase/component (via "@firebase/component")
Required by: @firebase/rules-unit-testing@virtual:1d9273e5f68268c40e08b7f99e80cf4710c78cbaac3826d945414a5b397a0f5f22b53cc2698d26ce2c1e26bf0fc5d219aa5f31558a8fde3204ffebed140e1f69#npm:1.2.6 (via /tmp/firebase-testcase/.yarn/$$virtual/@firebase-rules-unit-testing-virtual-083cacfd56/0/cache/@firebase-rules-unit-testing-npm-1.2.6-b87f90698b-2f74f80241.zip/node_modules/@firebase/rules-unit-testing/dist/)