Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
514 views
in Technique[技术] by (71.8m points)

google cloud firestore - Firebase emulator leaking when using with Jest

I am using firebase emulators to run my jest tests:

package.json:

{
"scripts": {
    "test": "firebase emulators:exec --only firestore --project sample jest",
  },
}

jest.config.json:

{
  "preset": "ts-jest",
  "testEnvironment": "node",
  "modulePathIgnorePatterns": ["<rootDir>/lib/"]
}

When I run, I got the following message

A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks.

Running with --detectOpenHandles I don't see anything

npm test

> functions@ test /home/ubuntu/workspace/blinktrade/otc/firebase/functions
> firebase emulators:exec --only firestore --project sample 'jest --detectOpenHandles'

i  emulators: Starting emulators: firestore
i  firestore: Firestore Emulator logging to firestore-debug.log
i  Running script: jest --detectOpenHandles
 PASS  tests/index.test.ts
  ● Console

    console.warn
      {"severity":"WARNING","message":"Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail"}

      at write (node_modules/firebase-functions/lib/logger.js:39:78)
      at Object.warn (node_modules/firebase-functions/lib/logger.js:90:5)
      at Object.setup (node_modules/firebase-functions/lib/setup.js:46:22)
      at Object.<anonymous> (node_modules/firebase-functions/lib/index.js:69:9)

    console.log
      {"_fieldsProto":{"kind":{"stringValue":"text"},"content":{"stringValue":"test"},"author":{"stringValue":"user1"},"room":{"stringValue":"room1"},"timestamp":{"timestampValue":{"seconds":1611687728,"nanos":749000000}}},"_ref":{"_firestore":{"_settings":{"projectId":"not-a-project","firebaseVersion":"9.4.2","libName":"gccl","libVersion":"4.8.1 fire/9.4.2","ssl":false,"servicePath":"localhost","port":8080},"_settingsFrozen":false,"_serializer":{"allowUndefined":false},"_projectId":"not-a-project","registeredListenersCount":0,"bulkWritersCount":0,"_backoffSettings":{"initialDelayMs":100,"maxDelayMs":60000,"backoffFactor":1.3},"_clientPool":{"concurrentOperationLimit":100,"maxIdleClients":1,"activeClients":{},"failedClients":{},"terminated":false,"terminateDeferred":{"promise":{}}}},"_path":{"segments":["messages","uo3QAC73RkNuoK445lDx"],"projectId":"sample","databaseId":"(default)"},"_converter":{}},"_serializer":{"allowUndefined":false},"_readTime":{"_seconds":1611687729,"_nanoseconds":274000000},"_createTime":{"_seconds":1611687729,"_nanoseconds":274000000},"_updateTime":{"_seconds":1611687729,"_nanoseconds":274000000}}

      at Function.run (src/index.ts:10:13)

    console.log
      {"eventId":"8ypi6ez73efk39maxif8p","resource":{"service":"firestore.googleapis.com","name":"projects/sample/databases/(default)/documents/messages/uo3QAC73RkNuoK445lDx"},"eventType":"providers/cloud.firestore/eventTypes/document.create","timestamp":"2021-01-26T19:02:09.275Z","params":{"uid":"uo3QAC73RkNuoK445lDx"}}

      at Function.run (src/index.ts:11:13)

(node:2767) V8: /home/ubuntu/workspace/blinktrade/otc/firebase/functions/node_modules/openpgp/dist/openpgp.js:2491 Linking failure in asm.js: Unexpected stdlib member
(node:2767) V8: /home/ubuntu/workspace/blinktrade/otc/firebase/functions/node_modules/openpgp/dist/openpgp.js:1083 Linking failure in asm.js: Unexpected stdlib member
 PASS  tests/crypto.test.ts
 PASS  tests/helpers.test.ts

Test Suites: 3 passed, 3 total
Tests:       5 passed, 5 total
Snapshots:   0 total
Time:        2.994 s, estimated 3 s
Ran all test suites.
?  Script exited successfully (code 0)
i  emulators: Shutting down emulators.
i  firestore: Stopping Firestore Emulator
i  hub: Stopping emulator hub

Is it normal?

question from:https://stackoverflow.com/questions/65907608/firebase-emulator-leaking-when-using-with-jest

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...