Closed
Description
Version info
firebase-functions-test:
3.0.0
firebase-functions:
4.2.1
firebase-admin:
11.5.0
Steps to reproduce
- Create a function that uses parameterized config. The current recommended approach for defining configuration.
import * as functions from 'firebase-functions'
import { defineString } from 'firebase-functions/params'
const FOO = defineString('FOO')
export const exampleFn = functions.https.onCall(() => {
const message = FOO.value()
functions.logger.log(message)
return {
message
}
}
- Create
.env
file with variable defined OR set via cli when deploying with firebase-tools
FOO="bar"
The above works when deployed.
- Now when attempting to write a unit test for the above function, there is no mechanism for loading configuration parameters. The older (no longer recommended method) for defining configuration via functions.config can be mocked as described here.
Expected behavior
firebase-functions-test
provides a mechanism for loading "parameterized config" into a test environment similar to mockConfig()
Actual behavior
firebase-functions-test
DOES NOT provide any mechanism for loading "parameterized config" into a test environment similar to mockConfig()