firebase/quickstart-nodejs

Timeout

tolotrasamuel opened this issue · 6 comments

After npm test
I get this

test://"before all" hook in "{root}"

Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

We need more information to diagnose this. Which tests are you running? What setup did you do before running the tests?

Firestore emulator https://github.com/firebase/quickstart-nodejs/tree/master/firestore-emulator/javascript-quickstart

I changed the port back to 8080 and the error disappears but a new one appears:

app.firestore is not a function

I have firebase-admin 8.2.0 and "@firebase/testing": "^0.11.5", installed

I modified the javascript-quickstart's package.json to look like

{
  "name": "cloud-firestore-emulator-javascript-quickstart",
  "version": "1.0.2",
  "description": "Cloud Firestore emulator testing",
  "scripts": {
    "format": "prettier --write **/*.js",
    "test": "mocha"
  },
  "devDependencies": {
    "@firebase/testing": "0.11.5",
    "firebase-admin": "8.2.0",
    "mocha": "5.2.0",
    "prettier": "1.15.2"
  }
}

and ran rm -rf node_modules/ && npm install && npm test. Would you mind trying to the same and telling me what happens?

Just wanted to say, I had the same issue, tried using this.timeout(10000);, didn't work. I solved it by changing the timeout in the script using the --timeout 10000 option. Final package.json looked something like this:

{
  "name": "cloud-firestore-emulator-javascript-quickstart",
  "version": "1.0.0",
  "description": "Cloud Firestore emulator testing",
  "scripts": {
    "format": "prettier --write **/*.js",
    "test": "mocha --timeout 10000"
  },
  "devDependencies": {
    "@firebase/testing": "0.11.8",
    "filesystem": "1.0.1",
    "mocha": "5.2.0",
    "prettier": "1.15.2"
  }
}

Gotcha, these tests can definitely be slow depending on your hardware. I'll add the --timeout flag to the quickstarts.

Make sure you have two terminals:

  • One running firebase emulators:start
  • A second one where you run npm test