/vscode-speckle

Speckle - the Visual Studio Code extension that makes working with test files painless.

Primary LanguageTypeScriptOtherNOASSERTION

Speckle

CC BY 4.0 all operating systems supported Version GitHub

icon

Work with test files quickly and easily!

Do you work with unit tests and/or spec files? This extension is for you!

This Visual Studio Code extension is designed to make working with TDD and testing in general much more convenient, by allowing you to:

  • Switch between implementation and test/spec file quickly
  • Open a test/spec file or implementation in a new window.
  • Create a test/spec file from the implementation
    • (Optional) automatically create a test/spec file when attempting to switch to it or open it if the file doesn't already exist

Demonstration Gif

Install at the Microsoft Visual Studio Marketplace

Supported Files and Patterns

  • ✅️ All file extensions (eg. .js, .ts, .py) are supported.
  • ✅️ File extensions can have prefixes (e.g. foo.service.ts)
  • ✅️ Test files prefixes are supported (e.g. foo.spec.ts or foo.service.spec.ts) or can be omitted if the test is in a specific tests directory.
  • ✅️ Test files can be contained in a __tests__ directory, or stored directly next to implementation.

Usage

Speckle provides two commands that you can access in any of three ways:

  • Using the command palette (cmd+P or ctrl+P) and typing in some part of the "action" below
  • Using the provided keyboard shortcut
  • Using a customized keyboard shortcut, using the command name below.
Action / Command Palette Description Default Keyboard Shortcut Command Name
Switch between test/implementation Mac: cmd+shift+alt+t
Windows/Linux: ctrl+shift+alt+t
speckle.switch
Split editor with Test/Implementation Mac: cmd+alt+t
Windows/Linux: ctrl+alt+t
speckle.open

We recommend you customize the keyboard shortcut as the one provided was chosen to avoid collisions with other extensions and functionality.

Configuration

Speckle should work out of the box, but you can customize the settings to fit any .

To configure these options globally, you can add them to your settings.json (type 'User Settings JSON' in command palette). Alternatively, to configure them for just your active workspace, you can add them to your .vscode/settings.json in your project.

{
  "speckle.useTestsDirectoryForCreation": false, // if set to true, then instead of co-locating tests, it will use the __tests__ folder (jest convention)
  "speckle.testExtensionPrefix": "spec", // if your tests are called foo.test.ts, then change this to 'test', or whatever you like
  "speckle.automaticallyCreateTestFile": false // set to true to automatically create a test file if it doesn't exist when attempting to switch/open it
}

Customizing Keyboard Shortcuts

In keybindings.json:

[
  {
    "command": "speckle.open",
    "key": "ctrl+shift+t"
  },
  {
    "command": "speckle.switch",
    "key": "ctrl+alt+shift+t"
  }
]

Credits

Written and maintained by rbutera.

Something wrong? Please submit an Issue!

This project was forked from Go-To-Test and a number of fixes and features were added.

License

Shield:

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International License.

CC BY-NC-ND 4.0