{"id":22855062,"url":"https://github.com/deinsoftware/vscode-vitest-snippets","last_synced_at":"2025-04-30T12:17:41.255Z","repository":{"id":88005133,"uuid":"606577619","full_name":"deinsoftware/vscode-vitest-snippets","owner":"deinsoftware","description":"VS Code Vitest snippets for JS and TS","archived":false,"fork":false,"pushed_at":"2024-08-03T23:24:34.000Z","size":201,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-04T23:28:51.531Z","etag":null,"topics":["hacktoberfest","javascript","node","nodejs","react","reactjs","snippets","snippets-collection","typescript","visual-studio-code","vscode","vscode-extension","vue","vuejs"],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=deinsoftware.vitest-snippets","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deinsoftware.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["deinsoftware"],"custom":["https://paypal.me/equiman/3"]}},"created_at":"2023-02-25T22:44:57.000Z","updated_at":"2024-08-04T23:28:51.532Z","dependencies_parsed_at":null,"dependency_job_id":"116fd194-4219-4450-a17d-2482642d3176","html_url":"https://github.com/deinsoftware/vscode-vitest-snippets","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deinsoftware%2Fvscode-vitest-snippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deinsoftware%2Fvscode-vitest-snippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deinsoftware%2Fvscode-vitest-snippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deinsoftware%2Fvscode-vitest-snippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deinsoftware","download_url":"https://codeload.github.com/deinsoftware/vscode-vitest-snippets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229504576,"owners_count":18083397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","javascript","node","nodejs","react","reactjs","snippets","snippets-collection","typescript","visual-studio-code","vscode","vscode-extension","vue","vuejs"],"created_at":"2024-12-13T07:09:43.636Z","updated_at":"2024-12-13T07:09:44.084Z","avatar_url":"https://github.com/deinsoftware.png","language":"JavaScript","funding_links":["https://github.com/sponsors/deinsoftware","https://paypal.me/equiman/3","https://img.shields.io/badge/-GitHub%20Sponsors-gray?style=flat\u0026labelColor=171515\u0026logo=github\u0026logoColor=white\u0026link=https://github.com/sponsors/deinsoftware","https://img.shields.io/badge/-PayPal-gray?style=flat\u0026labelColor=00457C\u0026logo=paypal\u0026logoColor=white\u0026link=https://paypal.me/equiman/3"],"categories":[],"sub_categories":[],"readme":"# Vitest Snippets\n\n[![Version](https://img.shields.io/visual-studio-marketplace/v/deinsoftware.vitest-snippets.svg)](https://marketplace.visualstudio.com/items?itemName=deinsoftware.vitest-snippets)\n[![Installs](https://img.shields.io/visual-studio-marketplace/i/deinsoftware.vitest-snippets.svg)](https://marketplace.visualstudio.com/items?itemName=deinsoftware.vitest-snippets)\n[![Ratings](https://img.shields.io/visual-studio-marketplace/stars/deinsoftware.vitest-snippets.svg)](https://marketplace.visualstudio.com/items?itemName=deinsoftware.vitest-snippets)\n[![license](https://img.shields.io/github/license/deinsoftware/vscode-vitest-snippets)](LICENSE.md)\n[![Open in VS Code](https://img.shields.io/static/v1?logo=visualstudiocode\u0026label=\u0026message=Open%20in%20Visual%20Studio%20Code\u0026labelColor=2c2c32\u0026color=007acc\u0026logoColor=007acc)](https://open.vscode.dev/deinsoftware/vscode-vitest-snippets)\n\n![Vitest](https://raw.githubusercontent.com/deinsoftware/vscode-vitest-snippets/main/.github/social/preview.png)\n\nThe quick and easy way to create and use Vitest with [VS Code](https://code.visualstudio.com/).\n\n\u003e We also **recommend** installing his complement extension [Testing Library Snippets](https://marketplace.visualstudio.com/items?itemName=deinsoftware.testing-library-snippets)\n\n## Menu\n\n- [Installation](#installation)\n  - [Quick Launch](#quick-launch)\n  - [Extension Manager](#extension-manager)\n  - [Marketplace](#marketplace)\n- [Supported Languages](#supported-languages)\n- [Snippets](#snippets)\n  - [Import](#import)\n  - [Setup](#setup)\n  - [Describe](#describe)\n  - [Mock](#mock)\n  - [It](#it)\n  - [Test](#test)\n  - [Expect](#expect)\n  - [Any](#any)\n  - [Assertion](#assertion)\n  - [Skeleton](#skeleton)\n- [Keyboard](#keyboard)\n- [Settings](#settings)\n- [About](#about)\n\n---\n\n## Installation\n\n### Quick Launch\n\nOpen the quick launch with \u003ckbd\u003ectrl\u003c/kbd\u003e+\u003ckbd\u003eshift\u003c/kbd\u003e+\u003ckbd\u003eP\u003c/kbd\u003e (Win/Linux) or \u003ckbd\u003ecmd\u003c/kbd\u003e+\u003ckbd\u003eshift\u003c/kbd\u003e+\u003ckbd\u003eP\u003c/kbd\u003e (macOS).\n\nPaste the following command and press `Enter`:\n\n```shell\next install deinsoftware.vitest-snippets\n```\n\n### Extension Manager\n\nOpen the extension manager with \u003ckbd\u003ectrl\u003c/kbd\u003e+\u003ckbd\u003eshift\u003c/kbd\u003e+\u003ckbd\u003eX\u003c/kbd\u003e (Win/Linux) or \u003ckbd\u003ecmd\u003c/kbd\u003e+\u003ckbd\u003eshift\u003c/kbd\u003e+\u003ckbd\u003eX\u003c/kbd\u003e (macOS), search for `Vitest Snippets` and click on `[Install]` button.\n\n### Marketplace\n\n[Vitest Snippets](https://marketplace.visualstudio.com/items?itemName=deinsoftware.vitest-snippets)\n\n⇧ [Back to menu](#menu)\n\n---\n\n## Supported Languages\n\n| Language         | Extension |\n| ---------------- | --------- |\n| JavaScript       | `.js`     |\n| TypeScript       | `.ts`     |\n| JavaScript React | `.jsx`    |\n| TypeScript React | `.tsx`    |\n| Vue              | `.vue`    |\n\n⇧ [Back to menu](#menu)\n\n---\n\n## Snippets\n\nBelow is a list of all available snippets and the triggers of each one. The `░` means the `TAB` jump position and `█` the final cursor position.\n\n### Import\n\n|  Trigger | Result                                                                       |\n| -------: | ---------------------------------------------------------------------------- |\n|    `iv→` | `import { it, expect, describe } from 'vitest'█`                             |\n|   `ive→` | `import { beforeEach, afterEach, it, expect, describe, vi } from 'vitest'█`  |\n\n### Setup\n\n|  Trigger | Result                                                          |\n| -------: | --------------------------------------------------------------- |\n|    `ba→` | \u003ccode\u003ebeforeAll(() =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e         |\n|   `baa→` | \u003ccode\u003ebeforeAll(async () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e   |\n|    `be→` | \u003ccode\u003ebeforeEach(() =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e        |\n|   `bea→` | \u003ccode\u003ebeforeEach(async () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e  |\n|    `ae→` | \u003ccode\u003eafterEach(() =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e         |\n|    `aa→` | \u003ccode\u003eafterAll(() =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e          |\n\n### Describe\n\n|  Trigger | Result                                                                 |\n| -------: | ---------------------------------------------------------------------- |\n|     `d→` | \u003ccode\u003edescribe('░group', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e       |\n|  `desc→` | \u003ccode\u003edescribe('░group', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e       |\n|    `do→` | \u003ccode\u003edescribe.only('░group', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e  |\n|    `ds→` | \u003ccode\u003edescribe.skip('░group', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e  |\n\n### Mock\n\n|  Trigger | Result                                                                                                        |\n| -------: | ------------------------------------------------------------------------------------------------------------- |\n| `aevcr→` | \u003ccode\u003eafterEach(() =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;vi.clearAllMocks()\u003cbr/\u003e\u0026nbsp;\u0026nbsp;vi.resetAllMocks()\u003cbr/\u003e})█\u003c/code\u003e  |\n|    `vm→` | `vi.mock('░path')█`                                                                                                    |\n|  `vmrv→` | `vi.mock('░path').mockResolvedValue(█)`                                                                                |\n|    `vf→` | `vi.fn()█`                                                                                                    |\n|  `vfrv→` | `vi.fn().mockResolvedValue(█)`                                                                                |\n|    `cf→` | `const ░nameMock = vi.fn()█`                                                                                  |\n|  `cfrv→` | `const ░nameMock = vi.fn().mockResolvedValue(█)`                                                              |\n|   `mrv→` | `░mock.mockReturnValue(█)`                                                                                    |\n|  `mrvo→` | `░mock.mockReturnValueOnce(█)`                                                                                |\n|    `vs→` | `vi.spyOn(░global, '░method')█`                                                                               |\n|   `vsi→` | `vi.spyOn(░global, '░method').mockImplementation(() =\u003e █)`                                                    |\n|    `cs→` | `const ░methodSpy = vi.spyOn(░global, '░method')█`                                                            |\n|   `csi→` | `const ░methodSpy = vi.spyOn(░global, '░method').mockImplementation(() =\u003e █)`                                 |\n\n### It\n\n|  Trigger | Result                                                             |\n| -------: | ------------------------------------------------------------------ |\n|     `i→` | \u003ccode\u003eit('░should', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e        |\n|    `it→` | \u003ccode\u003eit('░should', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e        |\n|    `io→` | \u003ccode\u003eit.only('░should', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e   |\n|    `is→` | \u003ccode\u003eit.skip('░should', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e   |\n|   `itd→` | `it.todo('░should')█`                                              |\n|    `ia→` | \u003ccode\u003eit('░should', async () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e  |\n\n### Test\n\n|  Trigger | Result                                                              |\n| -------: | ------------------------------------------------------------------- |\n|     `t→` | \u003ccode\u003etest('░should', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e       |\n|    `to→` | \u003ccode\u003etest.only('░should', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e  |\n|    `ts→` | \u003ccode\u003etest.skip('░should', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e  |\n|   `ttd→` | `test.todo('░should')█`                                             |\n|    `ta→` | \u003ccode\u003etest('░should', async () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e})\u003c/code\u003e |\n\n### Expect\n\n|  Trigger | Result                     |\n| -------: | -------------------------- |\n|     `e→` | `expect(█)`                |\n|    `ea→` | `expect.assertions(█)`     |\n|   `eha→` | `expect.hasAssertions()█`  |\n|   `erj→` | `expect(░).rejects█`       |\n|   `ers→` | `expect(░).resolves█`      |\n\n### Any\n\n|  Trigger | Result                   |\n| -------: | ------------------------ |\n|   `eav→` | `expect.any(░)█`         |\n|   `eas→` | `expect.any(String)█`    |\n|   `ean→` | `expect.any(Number)█`    |\n|   `eab→` | `expect.any(Boolean)█`   |\n|   `ead→` | `expect.any(Date)█`      |\n|   `eaf→` | `expect.any(Function)█`  |\n|   `eaa→` | `expect.any(Array)█`     |\n|   `eat→` | `expect.anything()█`     |\n\n### Assertion\n\n|   Trigger | Result                                                                                      |\n| --------: | ------------------------------------------------------------------------------------------- |\n|     `tb→` | `expect(░).toBe(░)█`                                                                        |\n|   `tbct→` | `expect(░).toBeCloseTo(░number, ░delta)█`                                                   |\n|    `tbd→` | `expect(░).toBeDefined()█`                                                                  |\n|    `tbf→` | `expect(░).toBeFalsy()█`                                                                    |\n|   `tbgt→` | `expect(░).toBeGreaterThan(░)█`                                                             |\n|  `tbgte→` | `expect(░).toBeGreaterThanOrEqual(░)█`                                                      |\n|   `tbid→` | `expect(░).toBeInTheDocument()█`                                                            |\n|    `tbi→` | `expect(░).toBeInstanceOf(░)█`                                                              |\n|   `tblt→` | `expect(░).toBeLessThan(░)█`                                                                |\n|  `tblte→` | `expect(░).toBeLessThanOrEqual(░)█`                                                         |\n|    `tbn→` | `expect(░).toBeNull()█`                                                                     |\n|    `tbt→` | `expect(░).toBeTruthy()█`                                                                   |\n|    `tbu→` | `expect(░).toBeUndefined()█`                                                                |\n|     `tc→` | `expect(░list).toContain(░)█`                                                               |\n|    `tce→` | `expect(░list).toContainEqual(░)█`                                                          |\n|     `te→` | `expect(░).toEqual(░)█`                                                                     |\n|   `thbc→` | `expect(░).toHaveBeenCalled()█`                                                             |\n|  `thbct→` | `expect(░).toHaveBeenCalledTimes(░)█`                                                       |\n|  `thbcw→` | `expect(░).toHaveBeenCalledWith(░)█`                                                        |\n| `thblcw→` | `expect(░).toHaveBeenLastCalledWith(░)█`                                                    |\n|    `thl→` | `expect(░).toHaveLength(░)█`                                                                |\n|    `thp→` | `expect(░).toHaveProperty(░keyPath, ░value)█`                                               |\n|   `thpd→` | `expect(░).toHaveProperty('disabled')█`                                                     |\n|   `thps→` | `expect(░).toHaveProperty('selected')█`                                                     |\n|     `tm→` | `expect(░).toMatch(░)█`                                                                     |\n|   `tmis→` | `expect(░).toMatchInlineSnapshot(░)█`                                                       |\n|    `tmo→` | `expect(░).toMatchObject(░)█`                                                               |\n|    `tse→` | `expect(░).toStrictEqual(░)█`                                                               |\n|     `tt→` | \u003ccode\u003eexpect(() =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e}).toThrow(░)\u003c/code\u003e                             |\n|    `tte→` | \u003ccode\u003eexpect(() =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e}).toThrowError(░)\u003c/code\u003e                        |\n| `ttemis→` | \u003ccode\u003eexpect(() =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e}).toThrowErrorMatchingInlineSnapshot()\u003c/code\u003e   |\n|  `ttems→` | \u003ccode\u003eexpect(() =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;█\u003cbr/\u003e}).toThrowErrorMatchingSnapshot()\u003c/code\u003e         |\n\n### Skeleton\n\n|   Trigger | Result                                                                                      |\n| --------: | ------------------------------------------------------------------------------------------- |\n|    `vsb→` | \u003ccode\u003eimport { it, expect, describe } from 'vitest'\u003cbr/\u003e\u003cbr/\u003edescribe('░group', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;it('░should', () =\u003e {\u003cbr/\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;const expected = '░expected'\u003cbr/\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;const actual = ░group(░argument)\u003cbr/\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;expect(actual).toBe(expected)█\u003cbr/\u003e\u0026nbsp;\u0026nbsp;})\u003cbr /\u003e})\u003c/code\u003e |\n\n⇧ [Back to menu](#menu)\n\n---\n\n## Keyboard\n\nRemember to complement the snippets with these keyboard shortcuts that can be used without needing to move the cursor to the start or to the end.\n\n| Action            | Win/Linux          | macOS             |\n| ----------------- | -----------------: | ----------------: |\n| Insert line above | `ctrl+shift+enter` | `cmd+shift+enter` |\n| Insert line below | `ctrl+enter`       | `cmd+enter`       |\n\n⇧ [Back to menu](#menu)\n\n---\n\n## Settings\n\nThe `editor.snippetSuggestions` setting in vscode `settings.json` will show snippets on top of the suggestion list.\n\n```json\n\"editor.snippetSuggestions\": \"top\"\n```\n\n⇧ [Back to menu](#menu)\n\n---\n\n## About\n\n### Fork\n\n- [vscode-jest-snippets](https://github.com/andys8/vscode-jest-snippets) - Jest snippets extension for VS Code\n\n### Built With\n\n- [VS Code](https://code.visualstudio.com/) - Code editing redefined.\n- [Figma](https://www.figma.com/) - The collaborative interface design tool.\n- [SWPM](https://www.npmjs.com/package/swpm) - One Package Manager to command them all.\n\n### Contributing\n\nPlease read [CONTRIBUTING](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n### Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [Const \u0026 Props Snippets](https://github.com/deinsoftware/vscode-vitest-snippets/tags) on GitHub.\n\n### Authors\n\n- **Camilo Martinez** [[Equiman](http://github.com/equiman)]\n\nSee also the list of [contributors](https://github.com/deinsoftware/vscode-vitest-snippets/contributors) who participated in this project.\n\n### Sponsors\n\nIf this project helps you, consider buying me a cup of coffee.\n\n[![GitHub Sponsors](https://img.shields.io/badge/-GitHub%20Sponsors-gray?style=flat\u0026labelColor=171515\u0026logo=github\u0026logoColor=white\u0026link=https://github.com/sponsors/deinsoftware)](https://github.com/sponsors/deinsoftware)\n[![paypal](https://img.shields.io/badge/-PayPal-gray?style=flat\u0026labelColor=00457C\u0026logo=paypal\u0026logoColor=white\u0026link=https://paypal.me/equiman/3)](https://paypal.me/equiman/3)\n\n### License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.\n\n⇧ [Back to menu](#menu)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeinsoftware%2Fvscode-vitest-snippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeinsoftware%2Fvscode-vitest-snippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeinsoftware%2Fvscode-vitest-snippets/lists"}