1.0.0 • Published 1 year ago

jest-environment-firebase-functions v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Jest Environment - Firebase Functions

A Jest testing environment for Firebase functions.

Version Downloads Stats

Installation

npm i --save-dev jest-environment-firebase-functions

Usage

Configuring Jest

// jest.config.js
/** @type {import('jest').Config} */
module.exports = {
	preset: 'ts-jest',
	testEnvironment: 'jest-environment-firebase-functions',
	/** @type {import('jest-environment-firebase-functions').Options} */
	testEnvironmentOptions: {
		firebaseMode: 'online',
		projectId: 'my-project',
		storageBucket: 'my-project.appspot.com',
		databaseURL: 'https://my-project.firebaseio.com',
		keyPath: './serviceAccountKey.json'
	}
}

For more on writing tests, see the Firebase documentation.

Options

OptionRequiredNotes
projectIdYes
firebaseModeNo"online" or "offline" (default)
keyPathNofirebaseMode defaults to "online" when set
storageBucketNo
databaseURLNo