3.4.1 • Published 3 months ago
firebase-functions-test v3.4.1
Firebase Test SDK for Cloud Functions
The firebase-functions-test
is unit testing library for Cloud Functions for Firebase. It is a companion to firebase-functions.
NOTE: This library can only be used with firebase-functions
v3.20.1 or above.
Usage
- Write some Firebase Functions
- With your testing framework of choice, write a unit-test that imports your Firebase Functions.
wrap
your Firebase Functions. You can invoke the Firebase Function's handler by invoking thewrap
call.
Eg.
import {myFirebaseFunction} from "../index"; // Your Firebase Functions
import firebaseFunctionsTest from "firebase-functions-test";
// Extracting `wrap` out of the lazy-loaded features
const {wrap} = firebaseFunctionsTest();
// `jest-ts` example
test('my unit test', () => {
const wrappedFirebaseFunction = wrap(myFirebaseFunction);
// Invoke the firebase function
wrappedFirebaseFunction();
// Invoke the firebase function with CloudEvent overrides
wrappedFirebaseFunction({data: {arbitrary: 'values'}});
});
Examples
- Unit Testing Gen-1 Cloud Functions using Mocha
- Unit Testing Gen-2 Cloud Functions using Mocha
- Unit Testing Gen-2 Cloud Functions using Jest
- Unit Testing Gen-2 Cloud Functions using Jest-Ts
Learn more
Learn more about unit testing Cloud Functions here.
Contributing
To contribute a change, check out the contributing guide.
License
© Google, 2018. Licensed under The MIT License.
3.4.1
3 months ago
3.4.0
6 months ago
3.3.0
1 year ago
3.2.0
1 year ago
3.1.1
1 year ago
3.1.0
2 years ago
3.0.0
3 years ago
2.4.0
3 years ago
2.3.0
3 years ago
2.2.0
3 years ago
2.1.0
3 years ago
2.0.2
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
0.3.3
4 years ago
0.3.2
4 years ago
0.3.1
4 years ago
0.3.0
4 years ago
0.2.3
5 years ago
0.2.2
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.1.7
6 years ago
0.1.6
7 years ago
0.1.5
7 years ago
0.1.4
7 years ago
0.1.3
7 years ago
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago