-
Notifications
You must be signed in to change notification settings - Fork 872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initializeTestApp
from @firebase/rules-unit-testing
with jest, file scope variables are unset
#3920
Comments
@ScottPierce i have the similar problem. Try downgrading This serves as changelog: https://github.com/firebase/firebase-js-sdk/compare/@firebase/[email protected]...@firebase/[email protected] |
@ScottPierce sorry about that this one is my fault, fixing it here: In the meantime if you downgrade your |
How is this even possible? How did you unset variables in the parent scope, a |
If you look at the PR you'll see I was doing
const x = { a: 1 };
// This is allowed
x.a = 2;
// This is not allowed
x = { a: 2 }; |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
When I use
initializeTestApp
with the@firebase/rules-unit-testing
, any variables that I set in the root scope of the file are invalidated in jest tests. The first test will pass, but then, when the second test is run, andinitializeTestApp
is called, the second test won't pass because file scoped variables are unset.initializeTestApp
is removed, the test passes just fine.@firebase/rules-unit-testing
to@firebase/testing
, the test passes just fine.Likely Unrelated:
I'm doing this in an nx react application.
Steps to reproduce:
Run the given code sample with Jest. The second test will fail, even though it shouldn't, because
testData.uid
will be unset.Again, simply changing the import from
rules-unit-testing
totesting
fixes the problem.Relevant Code:
The text was updated successfully, but these errors were encountered: