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
Install JS Teleporter - Visual Studio Marketplace.
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.
- Explorer the test (or same name) file in the 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.
Currently, the suffix of the test file is always added to the end of the file name (default: .test
).
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.
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 |