Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(prhls): テストが動作するよう修正 #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cu39
Copy link
Contributor

@cu39 cu39 commented Dec 20, 2019

スナップショットテストっぽいことができるように修正してみました。OK/NG時のメッセージなど適当に決めてしまったところもあり、叩き台と考えていただいて問題ありません。JSON-RPC応答もうまくいってないところがあればご指摘ください。

  • concurrentlyを削除。
  • ts-nodeを追加、テスト実行はこちらで。
  • diffを追加、差分表示用。
  • Handlerクラスをlib/handler.tsに分離しlib/index.tsからインポート。
  • テスト用のcreateConnection()に入出力ストリームを明示して渡す。
  • 出力ストリームはTransform
    • スナップショットを記録する場合のみファイルストリームにpipeする。
    • サーバーからのレスポンスだけを、pipeされたストリームと標準出力へ流す。
  • exitイベントハンドラーでレスポンスを比較。
    • レスポンスはassert()===で雑に比較。
    • 一致しないときはunified diffを表示。

cu39 added 2 commits December 20, 2019 23:33
- concurrentlyを削除。
- ts-nodeを追加、テスト実行はこちらで。
- diffを追加、差分表示用。
- Handlerクラスをlib/handler.tsに分離しlib/index.tsからインポート。
- テスト用のcreateConnection()に入出力ストリームを明示して渡す。
- 出力ストリームはTransform。
  - スナップショットを記録する場合のみファイルストリームにpipeする。
  - サーバーからのレスポンスだけを、pipeされたストリームと標準出力へ流す。
- exitイベントハンドラーでレスポンスを比較。
  - レスポンスはassert()と===で雑に比較。
  - 一致しないときはunified diffを表示。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant