YSNHatenaBlog

主にアプリやWebサービス開発について

2021-02-01から1ヶ月間の記事一覧

firebaseの設定ファイルをpushしたくない

テストはfirebaseの設定ファイルいらないはずなので、pushしなくてもGitHub Actionsを回せるのだが、手元の開発環境では設定ファイル参照して、GitHub Actions実行時は設定ファイルを無視あるいはダミーする、みたいなことがいい感じにできないか考え中。 一…

GitHub ActionsでFirestore Emulatorを使ったCIをやりたい

この辺が参考になりそう。 qiita.com 調べてみるとDocker Composeでやってる例が多そう。 firestore local emulator を docker-composeで動かす - Qiita DockerでFirebase Local Emulator Suiteを起動する。 - Qiita これも参考になりそう。 zenn.dev import…

algoliasearchをモックする

algoliasearch がmockできない。 i Running script: jest FAIL src/functions/__tests__/index.test.ts ● Test suite failed to run TypeError: algoliasearch_1.default is not a function 2 | import * as functions from 'firebase-functions' 3 | > 4 | …

Cloud Functionsのテスト導入中

CloudFunctionsテスト導入。 このエラーが出る。 % yarn test yarn run v1.16.0 $ firebase emulators:exec 'jest' i emulators: Starting emulators: functions, firestore, hosting ⚠ functions: The following emulators are not running, calls to these…

Firebaseのプロジェクトにテストを導入してみる(Jest入れるまで)

firebaseプロジェクトにテストを導入してみる。 馴染みがあるjestを使う。やり方は2種類。 Babelで使う Getting Started · Jest ts-jestを使う Jest - TypeScript Deep Dive 日本語版 直接Babelは使ってないのでts-jestで。型チェックも効く。 yarn add -D j…

Firestoreの設定をfirebase.jsonに入れる

そろそろテストを書いてみる。 firestoreのルールもテストしたいので、この際firestoreの設定も含めるようにしてみる。 index取得。 firebase firestore:indexes > firestore.indexes.json ルールはコピペするしかない? firestore.rulesに書く。現状の内容…

reduxのデバッグ・リファクタリング

redux-dev-tools入れた https://github.com/zalmoxisus/redux-devtools-extension import { devToolsEnhancer } from 'redux-devtools-extension/developmentOnly' import { createFirestoreInstance, firestoreReducer } from 'redux-firestore' const init…

編集機能を作る

編集画面作った。 新規登録のフォームを再利用する感じで。 フォームのコンポーネントが編集用の処理を含んでしまって複雑化している。 型の定義の仕方もあまりよくなかったかも。明日はリファクタだろうか。