Code Monkey home page Code Monkey logo

js-teleporter's Introduction

JS Teleporter

JS Teleporter is VSCode extension to teleport between code like following in JavaScript/TypeScript project.

  • .js(x) or .ts(x) file <-> test file
  • .jsx or tsx file <-> storybook

Demo

Test - Demo

usage test

Storybook - Demo

usage storybook

Installation

Install JS Teleporter - Visual Studio Marketplace.

Usage

Test

In the .js(x) or .ts(x) file, push Ctrl + Alt + T. Teleport to the test file according to the following rules.

  • Explorer the test file in the same folder.
    • e.g. src/foo/bar.ts teleports to src/foo/bar.test.ts.
    • test in same folder
  • Explorer the test (or same name) file in the test folder.
    • The folders have the same directory structure from the root of source.
    • e.g. src/foo/bar.ts teleports to __test__/foo/bar.test.ts, src/__tests__/foo/bar.test.ts or src/foo/__tests__/bar.test.ts. If there is more than one, it will be created in the closest folder.
    • test in test folder
  • If a test file was opened, do the reverse.

If the test file does not exist, a new test file can be created.

test not found

Currently, the suffix of the test file is always added to the end of the file name (default: .test).

Storybook

In the .jsx or tsx file, push Ctrl + Alt + S. The rules of teleport are exactly the same as in the test, differing only in filename suffixes and directories to be searched.

Config

name type descriptions default
sourceRoot string Root directory of source. "src"
testSourceRoots array of string Root directories of tests. Files under configured directories are considered tests. ["__tests__", "__specs__", "__test__", "__spec__", "tests", "specs", "test", "spec"]
testFileSuffix string Suffix to determine if the file is a test. ".test"
testSourceRoots array of string Root directories of tests. Files under configured directories are considered tests. ["__tests__", "__specs__", "__test__", "__spec__", "tests", "specs", "test", "spec"]
testFileSuffix string Suffix to determine if the file is a test. ".test"
storybookSourceRoots array of string Root directories of storybook. Files under configured directories are considered storybook ["stories"]
storybookFileSuffix string Suffix to determine if the file is a story book .stories

js-teleporter's People

Contributors

sa2taka avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.