Skip to content
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

Emulator Suite in Google Cloud Shell - TypeError: firebase.initializeTestApp not a function #241

Open
JollyRen opened this issue May 1, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@JollyRen
Copy link

JollyRen commented May 1, 2022

Environment info

firebase-tools:

Platform: Windows 11 / Google Cloud Shell - Emulator Suite, CS Walkthrough

Test case

Trying to just follow the quickstart testing through Cloud Shell for rules. Getting to step 4 of 11 and it gives the error in the subject line.

"TypeError: firebase.initializeTestApp not a function"

I've looked through the node_modules folder for all the test modules and, no it isn't in the module that the script is looking through. I did see that sometime recently, in a closed issue, initializeTestApp was moved to a different module than it was in before. Perhaps this is the issue.

Steps to reproduce

Just follow the Cloud Shell tutorial explicitly

Expected behavior

The Mocha test starts and runs. Test App is initialized. The CS Walkthrough works out of the box.

Actual behavior

jollyren@cloudshell:~/rules-tutorial/quickstart-testing/cs-walkthrough/functions$ npm run test

> test
> mocha --timeout 5000 --exit

/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/node_modules/yargs/yargs.js:1163
      else throw err
           ^

TypeError: firebase.initializeTestApp is not a function
    at Suite.<anonymous> (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/test.js:53:23)
    at Object.create (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/lib/interfaces/common.js:140:19)
    at context.describe.context.context (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/lib/interfaces/bdd.js:42:27)
    at Object.<anonymous> (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/test.js:51:1)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Module.require (node:internal/modules/cjs/loader:1013:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at /home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/lib/mocha.js:334:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/lib/mocha.js:331:14)
    at Mocha.run (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/lib/mocha.js:811:10)
    at Object.exports.singleRun (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/lib/cli/run-helpers.js:108:16)
    at exports.runMocha (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/lib/cli/run-helpers.js:142:13)
    at Object.exports.handler (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/lib/cli/run.js:292:3)
    at Object.runCommand (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/node_modules/yargs/lib/command.js:242:26)
    at Object.parseArgs [as _parseArgs] (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/node_modules/yargs/yargs.js:1104:24)
    at Object.parse (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/node_modules/yargs/yargs.js:566:25)
    at Object.exports.main (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/lib/cli/cli.js:68:6)
    at Object.<anonymous> (/home/jollyren/rules-tutorial/quickstart-testing/cs-walkthrough/functions/node_modules/mocha/bin/mocha:164:29)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47
@JollyRen JollyRen added the bug Something isn't working label May 1, 2022
@yuchenshi yuchenshi transferred this issue from firebase/firebase-tools May 2, 2022
@yuchenshi
Copy link
Member

Thanks for bringing this up. In the meantime, please use git clone https://github.com/firebase/quickstart-testing -b release in tutorial Step 3 (note the additional -b release) and see if it works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants