Gathering detailed insights and metrics for firebase-jest-testing
Gathering detailed insights and metrics for firebase-jest-testing
Gathering detailed insights and metrics for firebase-jest-testing
Gathering detailed insights and metrics for firebase-jest-testing
firebase-jest-testing-fs
Tools for testing Firebase back-end features, using Jest.
firebase-jest-testing-codeofficer
Tools for testing Firebase back-end features, using Jest.
@firestore-emulator/jest
This package contains a [`Jest`](https://jestjs.io/) environment for setup `@firestore-emulator/server`.
jest-environment-firebase-functions
Jest testing environment for firebase functions
npm install firebase-jest-testing
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (99.47%)
Shell (0.53%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
21 Stars
169 Commits
3 Forks
2 Watchers
11 Branches
1 Contributors
Updated on Sep 16, 2022
Latest Version
0.0.3-beta.1
Package Id
firebase-jest-testing@0.0.3-beta.1
Unpacked Size
73.77 kB
Size
26.17 kB
File Count
25
NPM Version
7.13.0
Node Version
16.1.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
2
This README
is for the developers.
For using the package, see package/README.md (that ships with the package).
Tools for testing Firebase back-end features, using Jest.
This repo provides a "one stop", opinionated approach to testing Firebase projects. Using it may save you from reading countless pages of documentation and evaluating different testing strategies and libraries.
Also, the tools handle configuring emulation for you. In all, this tries to give a simpler development experience than the current (Aug 2021) Firebase tooling does.
The idea is that you don't have to pull in either firebase-admin
nor firebase
in your own testing project, but get all the tools through here.
The package itself is placed under package
.
The sample
folder contains a sample Firebase backend used for testing:
sample/functions
has the definitions of the Cloud Functionssample/firestore.rules
has the Firestore Security Rulessample/test-fns
contains Cloud Function testssample/test-rules
contains Security Rules testsYou can use this sample as a template for your own Firebase backend testing project.
Fetch dependencies:
$ npm install
Now, you're ready to start the emulation and run tests against it.
There are two ways to run the tests, each with their own pros and cons. We'll call them the "CI" (Continuous Integration) and "dev" (development) flows, according to their main use cases.
Let's start with the simpler one.
Launching the tests is this easy:
$ cd sample
$ npm install
...
$ npm test
...
Test Suites: 2 passed, 2 total
Tests: 3 passed, 3 total
Snapshots: 0 total
Time: 2.547 s, estimated 3 s
...
Test Suites: 5 passed, 5 total
Tests: 29 passed, 29 total
Snapshots: 0 total
Time: 5.389 s
There are two separate Jest test suites run here, one after the other. One for Cloud Functions and another for Security Rules tests. It is possible to merge these but the author currently thinks it's best to keep them separate.
In "CI mode", each run launches the emulators anew. This takes ~5s that we can spare, by using the "dev" mode.
In dev mode, a server runs continuously on the background so repeated runs of the tests are a bit faster. This same server can be used for both Cloud Functions and Security Rules testing - even in parallel.
$ cd sample # unless you already are there
Starting the emulator
Start the emulator in one terminal, and leave it running:
$ npm run start
Once we run tests, it's worth checking the emulator output, occasionally.
Running tests
In another terminal:
$ npm run test:fns:greet
$ npm run test:fns:userInfo
...
For testing Security Rules:
$ npm run test:rules:invites
$ npm run test:rules:projects
$ npm run test:rules:symbols
$ npm run test:rules:userInfo
$ npm run test:rules:visited
Sure you get the gist of it. 🤓
These are prepared for you in package.json
. When developing something, it's meaningful to run only one suite, at a time.
Once you think things are rolling fine, run npm test
to confirm.
Note: Since both CI and dev use the same emulator ports (defined in
firebase.json
), one cannot launchnpm test
while the emulator is running. Shut it down by Ctrl-C.
This is a more advanced (complex) setup, but one you should study for your own projects. It has some advantages:
concurrently
or firebase-tools
npm modules.See sample.dc/README
for details.
Continuous Integration uses Docker Compose, to run the same tests.
See ci/README
for details.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 0/22 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More