Open raaaahman opened 1 year ago
Possibly a duplicate of: https://github.com/firebase/firebase-js-sdk/issues/6658. We will be looking into this.
I am having additional warning message with @firebase/firestore
version 9.15.0:
@firebase/firestore: Firestore (9.15.0): Connection GRPC stream error. Code: 13 Message: 13 INTERNAL: Response message parsing error: index out of range: 34 + 1 > 34
I'm not sure if this is related though.
I realize that in my original steps I did:
- run Firebase Emulators with firebase emulators:start
- run tests with npm test
This was two commands in separate terminals. But I since had a better outcome running firebase emulators:exec "node ./path/to/my/test-script.js"
: it worked with every Testing SDK feature (9.15.0).
Are the aforementioned steps 5 and 6 supposed to work just as well as the emulators:exec command?
Hello,
Solved this error by setting testEnvironment
to node
as suggested in the answer on SO : https://stackoverflow.com/a/63465382
You can do this either by creating a jest.config.js
file or by passing the --env=node
flag to the jest
command.
As I understand it, jsdom implements a browser environment and is useful for UI tests. While testing firebase security rules, we want a node 'server' environment.
This may seem obvious to many, but perhaps it could be included in the firebase documentation ?
I get this error when I setup firestore listeners on multiple docs. It happens both when I'm using firestore emulator and also in production.
Mine is Error: FIRESTORE (9.18.0) INTERNAL ASSERTION FAILED: Unexpected state
9.18.0
Describe your environment
Describe the problem
I am trying to test my cloud Firestore Security rules using the Firebase Emulators. Emulators work fine for manual tests, but when I try to run automated tests with Jest (React Scripts to be specific), I have the following error:
Stack trace points here: https://github.com/firebase/firebase-js-sdk/blob/afe6e22845f7b91f19bd9a6b8179764e95e27254/packages/firestore/src/util/async_queue_impl.ts#L186
Steps to reproduce:
npx create-react-app my-project
myTest.test.js
firebase emulators:start
npm test
Relevant Code:
Test code:
First test pass and fail for the correct reason. Second test exit the Node process with the aforementioned error message.
Firestore rules
package.json dependencies