diff --git a/scripts/functions-discover-tests/fixtures/esm/firebase.json b/scripts/functions-discover-tests/fixtures/esm/firebase.json index 9e26dfeeb6e..93f83c8cfa7 100644 --- a/scripts/functions-discover-tests/fixtures/esm/firebase.json +++ b/scripts/functions-discover-tests/fixtures/esm/firebase.json @@ -1 +1,3 @@ -{} \ No newline at end of file +{ + "functions": {} +} diff --git a/scripts/functions-discover-tests/fixtures/pnpm/firebase.json b/scripts/functions-discover-tests/fixtures/pnpm/firebase.json index 9e26dfeeb6e..93f83c8cfa7 100644 --- a/scripts/functions-discover-tests/fixtures/pnpm/firebase.json +++ b/scripts/functions-discover-tests/fixtures/pnpm/firebase.json @@ -1 +1,3 @@ -{} \ No newline at end of file +{ + "functions": {} +} diff --git a/scripts/functions-discover-tests/fixtures/simple/firebase.json b/scripts/functions-discover-tests/fixtures/simple/firebase.json index 9e26dfeeb6e..93f83c8cfa7 100644 --- a/scripts/functions-discover-tests/fixtures/simple/firebase.json +++ b/scripts/functions-discover-tests/fixtures/simple/firebase.json @@ -1 +1,3 @@ -{} \ No newline at end of file +{ + "functions": {} +} diff --git a/src/config.ts b/src/config.ts index 9da92c32d28..3e514f61b23 100644 --- a/src/config.ts +++ b/src/config.ts @@ -76,15 +76,17 @@ export class Config { } }); - // Inject default functions config and source if missing. - if (this.projectDir && fsutils.dirExistsSync(this.path(Config.DEFAULT_FUNCTIONS_SOURCE))) { - if (Array.isArray(this.get("functions"))) { - if (!this.get("functions.[0].source")) { - this.set("functions.[0].source", Config.DEFAULT_FUNCTIONS_SOURCE); - } - } else { - if (!this.get("functions.source")) { - this.set("functions.source", Config.DEFAULT_FUNCTIONS_SOURCE); + // Inject default functions source if missing. + if (this.get("functions")) { + if (this.projectDir && fsutils.dirExistsSync(this.path(Config.DEFAULT_FUNCTIONS_SOURCE))) { + if (Array.isArray(this.get("functions"))) { + if (!this.get("functions.[0].source")) { + this.set("functions.[0].source", Config.DEFAULT_FUNCTIONS_SOURCE); + } + } else { + if (!this.get("functions.source")) { + this.set("functions.source", Config.DEFAULT_FUNCTIONS_SOURCE); + } } } }