All Projects → hardikmodha → Vscode Create Tests

hardikmodha / Vscode Create Tests

Licence: other
A vscode extension to quickly create test files.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Vscode Create Tests

Vscode Bookmarks
Bookmarks Extension for Visual Studio Code
Stars: ✭ 804 (+4925%)
Mutual labels:  vscode, vscode-extension
Vscode Material Icon Theme
Available on the VSCode Marketplace
Stars: ✭ 773 (+4731.25%)
Mutual labels:  vscode, vscode-extension
Evermonkey
Evernote Editing. Redefined. 关于 token 的问题请去 https://github.com/michalyao/evermonkey/issues/94 中查看!
Stars: ✭ 542 (+3287.5%)
Mutual labels:  vscode, vscode-extension
Shades Of Purple Vscode
🦄 Shades of Purple — A professional theme with hand-picked & bold shades of purple to go along with your VSCode. Reviewed by several designers and 75+ theme versions released to keep it updated. One of the top rated best VSCode themes on VS Code Marketplace. Download →
Stars: ✭ 486 (+2937.5%)
Mutual labels:  vscode, vscode-extension
Vscode Git Graph
View a Git Graph of your repository in Visual Studio Code, and easily perform Git actions from the graph.
Stars: ✭ 767 (+4693.75%)
Mutual labels:  vscode, vscode-extension
Vscode Live Sass Compiler
Compile Sass or Scss file to CSS at realtime with live browser reload feature.
Stars: ✭ 488 (+2950%)
Mutual labels:  vscode, vscode-extension
Vscode Markdown Pdf
Markdown converter for Visual Studio Code
Stars: ✭ 571 (+3468.75%)
Mutual labels:  vscode, vscode-extension
Gistpad
VS Code extension for managing and sharing code snippets, notes and interactive samples using GitHub Gists
Stars: ✭ 443 (+2668.75%)
Mutual labels:  vscode, vscode-extension
Tabnine Vscode
Visual Studio Code client for TabNine. https://marketplace.visualstudio.com/items?itemName=TabNine.tabnine-vscode
Stars: ✭ 770 (+4712.5%)
Mutual labels:  vscode, vscode-extension
Vscode Terraform
A Visual Studio Code extension for Hashicorp Terraform
Stars: ✭ 672 (+4100%)
Mutual labels:  vscode, vscode-extension
Vscode Sqltools
Database management for VSCode
Stars: ✭ 741 (+4531.25%)
Mutual labels:  vscode, vscode-extension
Coderoad Vscode
👩‍💻 Create or play Interactive coding tutorials in VSCode
Stars: ✭ 757 (+4631.25%)
Mutual labels:  vscode, vscode-extension
Chat
Chat with your team while you collaborate over code using VS Live Share
Stars: ✭ 468 (+2825%)
Mutual labels:  vscode, vscode-extension
Vscode Angular Snippets
Angular Snippets for VS Code
Stars: ✭ 530 (+3212.5%)
Mutual labels:  vscode, vscode-extension
Vscode R
R Extension for Visual Studio Code (execution, snippet, lint, R documantation, R Markdown)
Stars: ✭ 445 (+2681.25%)
Mutual labels:  vscode, vscode-extension
Vscode Php Debug
PHP Debug Adapter for Visual Studio Code 🐞⛔
Stars: ✭ 569 (+3456.25%)
Mutual labels:  vscode, vscode-extension
Edamagit
Magit for VSCode
Stars: ✭ 440 (+2650%)
Mutual labels:  vscode, vscode-extension
Marp Vscode
Marp for VS Code: Create slide deck written in Marp Markdown on VS Code
Stars: ✭ 442 (+2662.5%)
Mutual labels:  vscode, vscode-extension
Discord Vscode
🖋️ Update your discord status with a rich presence
Stars: ✭ 587 (+3568.75%)
Mutual labels:  vscode, vscode-extension
Vscode Gitlens
Supercharge the Git capabilities built into Visual Studio Code — Visualize code authorship at a glance via Git blame annotations and code lens, seamlessly navigate and explore Git repositories, gain valuable insights via powerful comparison commands, and so much more
Stars: ✭ 6,483 (+40418.75%)
Mutual labels:  vscode, vscode-extension

vscode-create-tests (v1.1.1)

Quickly create test files for your JavaScript/Typescript/React projects with just one click.

License: MIT

Motivation

While working on a project in my organization, We followed a pattern to keep tests files outside the main source directory. (Same structure as this). It was working fine until the project got bigger. It was becoming really very difficult to mimic the same directory structure as the source file and create a test file in it manually. So this extension solves the problem. It helps you to quickly generate test files with many possible customizations.

Features

  • Create test file from the file explorer view/editor title view or from the editor.
  • Specifying the default location to keep the test files. Currently supports
    1. Location same as the file location.
    2. Project root
  • If for some reasons default locations don't work for you. Don't worry, you can specify the custom location as well.
  • Custom name for the test directory.
  • Ability to specify the various template(s) to use for test files for the different languages.
  • Automatically switching to test cases when you create them.

How to use this extension?

Install and open Visual Studio Code. Press Ctrl+Shift+X or Cmd+Shift+X to open the Extensions pane. Type create tests in the search box and hit enter. You can also install the extension from the Marketplace. Currently, It supports Typescript and Javascript files. (Supported file extensions: .ts, .tsx, .js, .jsx)

Demo

Configuration options

Property Type Default Allowed Values Description
createTests.defaultLocationForTestFiles string same location as source file 1. same location as source file,     2. project root Location where you want to keep the test files.
createTests.sourceDir string src any string value Name of directory which contains all source files. This directory is not created when generating the directory structure for the test file.
createTests.testDirectoryName string tests any string value (allows empty string) Name of the directory which should contain all the test files. If this config option value is set to an empty string then it keeps the test file next to the source file.
createTests.customLocationForTestFiles string - any valid path Set this property in case you want to specify the custom location for test files.
createTests.testFilesSuffix string 'test' any string value Suffix to append for every created test file
createTests.shouldSwitchToTestFile boolean true true | false Whether to switch to the created test file or not
createTests.template.default array | object ["import {${moduleName}} from '${modulePath}';"] any string array or object Default template to use for all test file
createTests.template.* array | object - string array or object Language specific templates that you want to use.

Template types

Templates are used to initialize test files with default content. It eases the task and removes boilerplate code. Following template types are supported.

1. Default template

The default template for any file can be specified by overriding the configuration createTests.template.default. Default value for this template is: "import ${moduleName} from '${modulePath}';" Here, moduleName and modulePath are special placeholders, which gets replaces with the source file name and the relative path to the source file respectively.

2. Language-specific templates

When creating the test files, this extension reads the configuration for the template specified by createTests.template.<file-extension>. So if your file name is MyFile.js then the extension will read the configuration createTests.template.js for the template. If it finds one then it will write the content of the template into the created test file.

Note: Language-specific templates have higher priority over the default template.

Supported templates

For this extension, The templates can vary from as simple as

"import { ${moduleName} } from '${modulePath}';"

to

[
    "import { ${moduleName} } from '${modulePath}';"
    "",
    "describe('${moduleName}', () => {",
    "\tit('', () => {",
    "",
    "\t})",
    "})"
]

and can be as complex as

{
    "Template for basic files": [
        "import { ${moduleName} } from '${modulePath}';"
    ],
    "Template for awesome files": [
        "import { ${moduleName} } from '${modulePath}';",
        "describe('${moduleName}', () => {",
	"\tit('', () => {",
	"",
	"\t})",
	"})"
    ]
}

When you specify a template object, The extension will ask you to choose the template when you create a file as shown in the below image.

Multiple Templates Demo

TODO

  • [ ] Add test cases.
  • [ ] Add support for creating the test files via keyboard shortcut.
  • [ ] Add support for more placeholders to make templating more usable.
  • [ ] Add support for different languages.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].