1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

rails + typescript で開発を始める時に毎回使うテスト用のtasks.jsonの覚書

Last updated at Posted at 2024-12-02

新規プロジェクトで大概同じ様な設定をしているのに毎回探すので覚書。
dockerのコンテナ名なんかは適時変更、ここではrailsが backend 、jestは yarn で実行しています。

開いているファイルをrspec

    {
      "label": "rspec",
      "type": "shell",
      "command": "filepath=$(printf %q '${relativeFile}'); docker-compose exec -e RAILS_ENV=test backend bundle exec rspec ${filepath}",
      "presentation": {
        "reveal": "always",
        "panel": "shared",
        "focus": true
      },
    },

選択中の行をrspec

    {
      "label": "rspec:line",
      "type": "shell",
      "command": "filepath=$(printf %q '${relativeFile}'); docker-compose exec -e RAILS_ENV=test backend bundle exec rspec ${filepath}:${lineNumber}",
      "presentation": {
        "reveal": "always",
        "panel": "shared",
        "focus": true
      },
    },

開いているファイルをjest

    {
      "label": "jest",
      "type": "shell",
      "command": "filepath=$(printf %q '${relativeFile}'); yarn jest --silent $filepath$",
      "presentation": {
        "reveal": "always",
        "panel": "shared",
        "focus": true
      }
    },

開いているファイルをjestでログを全出力(差分みたい時とか)

    {
      "label": "jest:log all",
      "type": "shell",
      "command": "filepath=$(printf %q '${relativeFile}'); DEBUG_PRINT_LIMIT=999999 yarn jest --silent=false --verbose $filepath$",
      "presentation": {
        "reveal": "always",
        "panel": "shared",
        "focus": true
      }
    },
1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?