0.0
The project is in a healthy, maintained state
A small gem to toggle between source and test in the Zed editor
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.10
~> 13.0
~> 3.13
~> 0.22
~> 1.49
~> 0.9

Runtime

~> 1.3
 Project Readme

Zed Test Toggle

This small gem is designed to allow developers to switch to the test relative to the file they are editing, and back. It handles both tests in the spec directory if you are a Rspec user and in the test directory if you use Minitest or equivalent.

It is still in the early stages of development. Feel free to propose improvements.

Installation

Install the gem:

gem install zed-test-toggle

Usage

This tool is meant to be called from a Zed task.

[
  {
    "label": "Toggle Test and Target",
    "command": "zed-test-toggle",
    "args": [
      "lookup",
      "-p",
      "\"$ZED_RELATIVE_FILE\"",
      "-r",
      "\"$ZED_WORKTREE_ROOT\""
    ],
    "hide": "always",
    "allow_concurrent_runs": false,
    "use_new_terminal": false,
    "reveal": "never"
  },
]

And called with a keybinding. If called from the Task list, the env variables of the task will not be refreshed, and you will just keep jumping to the same file. The Zed team considers this a feature for now, so using a keybinding with the use of reevaluate_context is mandatory.

[
  {
    "bindings": {
      "ctrl-shift-t": [
        "task::Spawn",
        {
          "task_name": "Toggle Test and Target",
          "reevaluate_context": true
        }
      ]
    }
  }
]