File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import * as nock from "nock";
44import { configstore } from "./configstore" ;
55import * as track from "./track" ;
66import * as auth from "./auth" ;
7+ import { setFirebaseMcp } from "./env" ;
78
89// eslint-disable-next-line @typescript-eslint/no-var-requires
910const pkg = require ( "../package.json" ) ;
@@ -25,7 +26,7 @@ describe("track", () => {
2526 sandbox . restore ( ) ;
2627 nock . enableNetConnect ( ) ;
2728 delete process . env . IS_FIREBASE_CLI ;
28- delete process . env . IS_FIREBASE_MCP ;
29+ setFirebaseMcp ( false ) ;
2930 delete process . env . FIREBASE_CLI_MP_VALIDATE ;
3031 track . GA4_PROPERTIES . cli . currentSession = undefined ;
3132 track . GA4_PROPERTIES . emulator . currentSession = undefined ;
@@ -39,8 +40,8 @@ describe("track", () => {
3940 expect ( track . usageEnabled ( ) ) . to . be . true ;
4041 } ) ;
4142
42- it ( "should return true if usage is enabled and IS_FIREBASE_MCP is true" , ( ) => {
43- process . env . IS_FIREBASE_MCP = " true" ;
43+ it ( "should return true if usage is enabled and isFirebaseMcp() is true" , ( ) => {
44+ setFirebaseMcp ( true ) ;
4445 configstoreGetStub . withArgs ( "usage" ) . returns ( true ) ;
4546 expect ( track . usageEnabled ( ) ) . to . be . true ;
4647 } ) ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { getGlobalDefaultAccount } from "./auth";
44
55import { configstore } from "./configstore" ;
66import { logger } from "./logger" ;
7- import { isFirebaseStudio , detectAIAgent } from "./env" ;
7+ import { isFirebaseStudio , detectAIAgent , isFirebaseMcp } from "./env" ;
88const pkg = require ( "../package.json" ) ;
99
1010type cliEventNames =
@@ -66,9 +66,7 @@ export const GA4_PROPERTIES: Record<GA4Property, GA4Info> = {
6666 * 2) User opted-in.
6767 */
6868export function usageEnabled ( ) : boolean {
69- return (
70- ( ! ! process . env . IS_FIREBASE_CLI || ! ! process . env . IS_FIREBASE_MCP ) && ! ! configstore . get ( "usage" )
71- ) ;
69+ return ( ! ! process . env . IS_FIREBASE_CLI || isFirebaseMcp ( ) ) && ! ! configstore . get ( "usage" ) ;
7270}
7371
7472// Prop name length must <= 24 and cannot begin with google_/ga_/firebase_.
You can’t perform that action at this time.
0 commit comments