-
Notifications
You must be signed in to change notification settings - Fork 904
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
@firebase/rules-unit-testing
stalls on dbRef.set()
with package.json
settings jest.preset:"jest-expo"
but succeeds with jest.preset:"ts-jest"
#8708
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Hey @DrStoop, we'd be glad to investigate whether this is an issue with our SDK. Since we are not familiar with |
Hi @dlarocque, thanks for getting back to me. I get your point, that's why I also raised this issue in the expo repository first - unfortunately without response so far. I will be working on this problem and update you on the results if the issue is on the firebase or expo side. Thanks for now! |
Just to be clear, the information we'd need to pinpoint if this is a Firebase issue or not is basically "what does the |
Thanks @hsubox76 for looking into the issue. That's a good point comparing |
Operating System
Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
Environment (if applicable)
Expo, React Native
Firebase SDK Version
@firebase/[email protected]
Firebase SDK Product(s)
Database
Project Tooling
React-Native app managed with Expo for Android & iOS:
Minimal reproducible example
https://github.com/DrStoop/expoWithJestFirebaseDatabaseEmulator.git
Detailed Problem Description
Minimal reproducible example
https://github.com/DrStoop/expoWithJestFirebaseDatabaseEmulator.git
What platform(s) does this occur on?
Jest testing environment with
jest-expo
presetSummary
jest-expo
preset causesdbRef.set()
to stall when testing database rules with@firebase/rules-unit-testing
I am using firebase realtime database in my expo app and am writing database rules unit tests using
@firebase/rules-unit-testing
and the firebase emulator locally. I encountered the issue that the commandawait assertSucceeds(dbRef.set(5));
in__tests__/firebaseRealtimeDatabaseRules.test.ts
stalls (infinitely) in my test. I created a minimal reproducible example and could nail the cause of the stalling down to thejest.preset: "jest-expo"
inpackage.json
. The test passes without stalling when setting it tojest.preset: "ts-jest"
and it throws a timeout fail when set tojest.preset:"jest-expo"
(also with increases timeouts):I'm running the firebase database emulator with initial command:
jest-expo
presetlocalhost:9000
and initializes the database rules.dbRef.set(value)
method does not send thevalue
itself to the database and the database does not set any values, see emulator debug log:dbRef.set()
methods show the same issue.ts-jest
presetvalue
withdbRef.set(value)
, see database debug log:value
(5
) and displays it in the UI:Question
Why is the jest preset
"jest-expo"
interfering with@firebase/rules-unit-testing
and how can it be fixed? Or am I just missing something? Changing the preset to"ts-jest"
is not an option unless I would run database rules unit tests in isolation in a separate project (which is also not really an option).Thanks in advance!
Note
As this seems like a bug in the interface between an Expo preset
jest-expo
and the firebase emulator, I posted this issue already in the expo repository, but without getting feedback. So I'm hoping to get some hints from the firebase community here, THX!Environment
Expo Doctor Diagnostics
Steps and code to reproduce issue
Minimal reproducible example
https://github.com/DrStoop/expoWithJestFirebaseDatabaseEmulator.git
Steps
npm install
firebase emulators:start --only database --project database
npm run test
will fail as this issue describes due to the{"jest":{"preset": "jest-expo"}}
{"jest":{"preset": "ts-jest"}}
and kill & re-run the test withnpm run test
and the test will succeed without errors because it's not relying onjest-expo
preset anymoreThe text was updated successfully, but these errors were encountered: