Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andys8/vscode-jest-snippets
Jest snippets extension for VS Code
https://github.com/andys8/vscode-jest-snippets
extension jest snippets testing visual-studio-code vscode vscode-extension
Last synced: 11 days ago
JSON representation
Jest snippets extension for VS Code
- Host: GitHub
- URL: https://github.com/andys8/vscode-jest-snippets
- Owner: andys8
- License: mit
- Created: 2017-04-22T19:30:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-26T16:58:12.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T21:46:37.023Z (7 months ago)
- Topics: extension, jest, snippets, testing, visual-studio-code, vscode, vscode-extension
- Language: JavaScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=andys8.jest-snippets
- Size: 965 KB
- Stars: 39
- Watchers: 3
- Forks: 28
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# vscode-jest-snippets
[![Version](https://img.shields.io/visual-studio-marketplace/v/andys8.jest-snippets?label=VS%20Marketplace&logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=andys8.jest-snippets)
[![Node CI](https://github.com/andys8/vscode-jest-snippets/actions/workflows/test.yaml/badge.svg)](https://github.com/andys8/vscode-jest-snippets/actions/workflows/test.yaml)[Jest](https://facebook.github.io/jest) snippets extension for [Visual Studio Code](https://code.visualstudio.com/).
## Snippets
Below is a list of all available snippets and the triggers of each one. The **→** means the `TAB` key.
### Globals
| Trigger | Content |
| -------: | --------------------- |
| `desc→` | describe |
| `desco→` | describe.only |
| `descs→` | describe.skip |
| `desce→` | describe.each |
| `ae→` | afterEach |
| `aa→` | afterAll |
| `be→` | beforeEach |
| `bea→` | beforeEach(async ...) |
| `ba→` | beforeAll |
| `baa→` | beforeAll(async ...) |### Tests
| Trigger | Content |
| --------: | -------------------- |
| `it→` | it |
| `ito→` | it.only |
| `its→` | it.skip |
| `itt→` | it.todo |
| `ite→` | it.each |
| `ita→` | it(..., async ...) |
| `test→` | test |
| `testo→` | test.only |
| `tests→` | test.skip |
| `testt→` | test.todo |
| `teste→` | test.each |
| `testet→` | test.each (table) |
| `testa→` | test(..., async ...) |### Expect
| Trigger | Content |
| --------: | ---------------------------------- |
| `exp→` | expect |
| `expr→` | expect.resolves |
| `exprj→` | expect.rejects |
| `expas→` | expect.assertions(count) |
| `expha→` | expect.hasAssertions() |
| `tb→` | toBe |
| `tbct→` | toBeCloseTo |
| `tbd→` | toBeDefined |
| `tbf→` | toBeFalsy |
| `tbgt→` | toBeGreaterThan |
| `tbgte→` | toBeGreaterThanOrEqual |
| `tbi→` | toBeInstanceOf |
| `tblt→` | toBeLessThan |
| `tblte→` | toBeLessThanOrEqual |
| `tbn→` | toBeNull |
| `tbt→` | toBeTruthy |
| `tbu→` | toBeUndefined |
| `tc→` | toContain |
| `tce→` | toContainEqual |
| `te→` | toEqual |
| `tse→` | toStrictEqual |
| `thbc→` | toHaveBeenCalled |
| `thbct→` | toHaveBeenCalledTimes |
| `thbcw→` | toHaveBeenCalledWith |
| `thblcw→` | toHaveBeenLastCalledWith |
| `thl→` | toHaveLength |
| `thp→` | toHaveProperty |
| `tm→` | toMatch |
| `tmo→` | toMatchObject |
| `tms→` | toMatchSnapshot |
| `tmis→` | toMatchInlineSnapshot |
| `tt→` | toThrow |
| `tte→` | toThrowError |
| `ttems→` | toThrowErrorMatchingSnapshot |
| `ttemis→` | toThrowErrorMatchingInlineSnapshot |### Templates
| Trigger | Content |
| ------: | ----------------------- |
| `cut→` | test a class under test |
| `jfn→` | jest.fn |## Settings
The `editor.snippetSuggestions` setting in vscode `settings.json` will show snippets on top of the suggestion list.
```json
"editor.snippetSuggestions": "top"
```## Credits
- Thanks to [xabikos](https://github.com/xabikos) for [vscode-jasmine](https://github.com/xabikos/vscode-jasmine)
- Thanks to [martinlechner1](https://github.com/martinlechner1) for initial contributions
- Thanks to all [contributors](https://github.com/andys8/vscode-jest-snippets/graphs/contributors)