Skip to content

Does not work with "parameterized config" #196

Closed
@sbuys

Description

@sbuys

Version info

firebase-functions-test:
3.0.0

firebase-functions:
4.2.1

firebase-admin:
11.5.0

Steps to reproduce

  1. 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
  }
}
  1. Create .env file with variable defined OR set via cli when deploying with firebase-tools
FOO="bar"

The above works when deployed.

  1. 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()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions