{"id":"eyycheev/jest-mock-genv","name":"jest-mock-genv","scope":"eyycheev","platform":"roblox","description":"Mirrored from the Wally registry.","version":"3.14.0-rbx.2","latest":"3.14.0-rbx.2","versions":["3.14.0-rbx.0","3.14.0-rbx.1","3.14.0-rbx.2"],"license":"MIT","licenseRating":"safe","licenseCaveats":["The package archive does not include its license text; the license is declared in its manifest metadata."],"licenseVerified":false,"dependencies":{"jsdotlua/luau-polyfill":{"version":"^1.2.7","alias":"LuauPolyfill"}},"integrity":"5495cfbab97c14b7696a3f1aa0d139669c4bd878cb07c623d9cec4568c757c41","likes":0,"downloads":0,"install":"forest install eyycheev/jest-mock-genv","url":"https://forest.dev/p/roblox/eyycheev/jest-mock-genv","files":"https://api.forest.dev/ai/package/roblox/eyycheev/jest-mock-genv/files","readme":"# jest-mock-genv\n\n*No upstream. Roblox only.*\n\nThis module houses the `GlobalMocker` class, the type definitions used for global\nmocking utilities, and the `MOCKABLE_GLOBALS` constant which determines the global\nenvironment members that are allowed to be mocked.\n\n## :pencil2: Notes\n\n- **Changing `MOCKABLE_GLOBALS` should be done with care.**\n    - By whitelisting a new global to be mocked, you may subtly affect any code\n      which uses that global, or allow users to do the same.\n        - Jest only generates mock functions for the globals that are\n          whitelisted, and doesn't generate anything for globals that are not\n          whitelisted. This can subtly change how a global appears to user code.\n        - Possible breakage will need to be investigated.\n    - Adding a new global to this list is not breaking, but removing a global\n      from this list *is* breaking.\n        - It is better to be selective than to be generous, because if the\n          whitelisting causes breakage, it's might be hard to undo.\n        - We also don't want to encourage bad practice, and mocking certain\n          globals could lead to unintended use cases which aren't idiomatic or\n          cause problems for ourselves later.\n    - Certain globals are not safe to mock right now, including task scheduling\n      functions and `require()`, because they already have customised\n      implementations in Jest that would be bypassed.\n        - This can probably be fixed down the line if there's a pressing need to\n          do it, but it would introduce more complexity.\n    - **Above all else, come talk to us first - we will help you 🙂** \n- The `GlobalMocker` class does not implement any mocking capabilities itself;\n  instead, mock functions are stored in `GlobalMocker` by a `ModuleMocker`.\n- Globals should *always* be mocked whenever a test is running, because the\n  test's sandbox environment redirects to these mock functions at all times -\n  even if the user has not used `spyOn`.\n    - This ensures that all modules can see mocked implementations, even if they\n      are required later than the call to `spyOn` which mocks the global.\n","readmeTruncated":false}