1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jestでFirestoreテストしようとして TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object

Last updated at Posted at 2020-04-29

jestを使って「ローカルでない」Firestoreに関連するテストをしようとしたところ以下のエラーが発生しました。

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object

process.env.GOOGLE_APPLICATION_CREDENTIALS には正しい認証ファイルのパスが設定されており以下のコードでエラーが発生。

const Firestore = require('@google-cloud/firestore');
const firestore = new Firestore();

jest.config.jsに以下を追記することで解決しました。

testEnvironment: 'node'

参考
https://github.com/firebase/firebase-admin-node/issues/793#issuecomment-592867589

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?