Skip to content
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

Fix RUTv2 compat instances not working with modular. #5500

Merged
merged 2 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fast-brooms-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/rules-unit-testing": patch
---

Fix typing issues where Database/Firestore/Storage compat instances returned by RulesTestContext are not compatible with v9 modular APIs.
6 changes: 6 additions & 0 deletions packages/rules-unit-testing/src/public_types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
import { FirebaseSignInProvider } from '@firebase/util';
import firebase from 'firebase/compat/app';

// These import statements allow v9 compat instances (created by RulesTestContext) to be used in v9
// modular APIs, e.g. `doc(context.firestore(), 'a/b')` in developer code. (a.k.a. "interop mode".)
import 'firebase/compat/database';
import 'firebase/compat/firestore';
import 'firebase/compat/storage';

/**
* More options for the mock user token to be used for testing, including developer-specfied custom
* claims or optional overrides for Firebase Auth token payloads.
Expand Down