Skip to content

feat: Add support for running functions emulator per codebase #8422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

taeold
Copy link
Contributor

@taeold taeold commented Apr 10, 2025

Functions emulator now only loads function codebases that are specified by the --only flag, e.g.

Given the following function configuration in firebase.json:

{
  "functions": [
    {
      "source": "js",
      "codebase": "javascript"
    },
    {
      "source": "ts",
      "codebase": "typescript",
      "predeploy": "npm --prefix \"$RESOURCE_DIR\" run build"
    }
  ],
}

You can start the emulator to only start the typescript codebase by using the --only flag like this:

$ firebase emulators:start  --only functions:typescript
i  emulators: Starting emulators: functions
i  functions: Skipping codebase javascript due to --only filter

✔  functions: Loaded functions definitions from source: helloTS.

Fixes #4878

@taeold taeold requested a review from Copilot April 10, 2025 09:10
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

};

for (const cfg of functionsCfg) {
const codebase = cfg.codebase ?? "default";
Copy link
Preview

Copilot AI Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] There is an inconsistency: the computed default value ('default') is used for filtering, but the pushed backend still uses the original cfg.codebase (which may be undefined). Consider assigning the computed value to the backend (or clarifying the intended behavior) so that filtering and backend configuration are consistent.

Copilot uses AI. Check for mistakes.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 74.28571% with 9 lines in your changes missing coverage. Please review.

Project coverage is 51.23%. Comparing base (c5f77ed) to head (c3f9131).

Files with missing lines Patch % Lines
src/emulator/controller.ts 66.66% 7 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8422      +/-   ##
==========================================
+ Coverage   51.20%   51.23%   +0.03%     
==========================================
  Files         425      425              
  Lines       30394    30418      +24     
  Branches     6232     6238       +6     
==========================================
+ Hits        15562    15584      +22     
  Misses      13442    13442              
- Partials     1390     1392       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Firebase start local emulators for specified codebase only
2 participants