Categories: firebase

jestでfirestoreのunit testしたときに、INTERNAL ASSERTION FAILED: value must be undefined or Uint8Arrayが出る件

jestでfirestore emulatorへの書き込みをすると、
[2020-05-08T10:09:51.957Z] @firebase/firestore: Firestore (7.14.3): FIRESTORE (7.14.3) INTERNAL ASSERTION FAILED: value must be undefined or Uint8Array

というエラーがでるのでその対策
答えはここにあった。
@firebase/firestore: Firestore (7.9.2): FIRESTORE (7.9.2) INTERNAL ASSERTION FAILED: value must be undefined or Uint8Array #2701

どうやら、jest-environment-uint8arrayをいれるだけでいいようだ。

解決手順

まずインストールする
npm i jest-environment-uint8array -D

その後、jest.config.jsもしくはpackage.jsonのjestの項目に下記を追加
    "testEnvironment": "jest-environment-uint8array"


以上でなおった。
mogmet

View Comments

  • Your article gave me a lot of inspiration, I hope you can explain your point of view in more detail, because I have some doubts, thank you.

  • Thanks for sharing. I read many of your blog posts, cool, your blog is very good.

  • Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.

  • I don't think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.

  • Thanks for sharing. I read many of your blog posts, cool, your blog is very good.

  • Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.