From 9810526a89c2861e8d4f68775eb8ab3f25c7e942 Mon Sep 17 00:00:00 2001 From: Vasily Kuzin Date: Tue, 6 Jun 2023 20:54:33 +0300 Subject: [PATCH 1/4] Fix issue in vue-script --- README.md | 34 +++++++++++++-------------- snippets/vue/vue-script.code-snippets | 4 ++-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 5debe71..da53214 100644 --- a/README.md +++ b/README.md @@ -59,23 +59,23 @@ These snippets were made to speed up Vue 3 development. With it you can write bo ### Script -| Snippet | Purpose | -| ------------------------ | ------------------------------------------- | -| `vref` | Vue `ref` | -| `vreactive` | Vue `reactive` | -| `vcomputed` | Vue `computed` | -| `vwatch` | Watcher | -| `vwatcheffect` | Watch Effect | -| `vonmounted` | onMounted hook | -| `vonbeforemount` | onBeforeMount hook | -| `vonbeforeupdate` | onBeforeUpdate hook | -| `vonupdated` | onUpdated hook | -| `vonerrorcaptured` | onErrorCaptured hook | -| `vonunmounted` | onUnmounted hook | -| `vonbeforeunmount` | onBeforeUnmount hook | -| `vdefineprops` | Define props | -| `vdefineemits` | Define emits | -| `vsingleemit` | Single emit for defineEmits | +| Snippet | Purpose | +| ------------------ | --------------------------- | +| `vref` | Vue `ref` | +| `vreactive` | Vue `reactive` | +| `vcomputed` | Vue `computed` | +| `vwatch` | Watcher | +| `vwatcheffect` | Watch Effect | +| `vonmounted` | onMounted hook | +| `vonbeforemount` | onBeforeMount hook | +| `vonbeforeupdate` | onBeforeUpdate hook | +| `vonupdated` | onUpdated hook | +| `vonerrorcaptured` | onErrorCaptured hook | +| `vonunmounted` | onUnmounted hook | +| `vonbeforeunmount` | onBeforeUnmount hook | +| `vdefineprops` | Define props | +| `vdefineemits` | Define emits | +| `vsingleemit` | Single emit for defineEmits | ### CSS diff --git a/snippets/vue/vue-script.code-snippets b/snippets/vue/vue-script.code-snippets index 602ab31..f9ef317 100644 --- a/snippets/vue/vue-script.code-snippets +++ b/snippets/vue/vue-script.code-snippets @@ -111,7 +111,7 @@ "prefix": "vdefineemits", "body": [ "defineEmits<{", - "\t${1:eventName}: [${2}]", + "\t${1:eventName}: [${0}]", "}>()" ], "description": "Vue defineEmits" @@ -119,7 +119,7 @@ "Vue Single Emit": { "prefix": "vsingleemit", "body": [ - "${1:eventName}: [${2}]", + "${1:eventName}: [${0}]", ], "description": "Vue single emit for defineEmits" }, From 338cbdaf48662b522c828ad4258ede3a10ed84a3 Mon Sep 17 00:00:00 2001 From: Vasily Kuzin Date: Tue, 6 Jun 2023 20:53:48 +0300 Subject: [PATCH 2/4] Vitest snippets #23 --- README.md | 20 ++++ package.json | 8 ++ snippets/vitest/vitest.code-snippets | 131 +++++++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 snippets/vitest/vitest.code-snippets diff --git a/README.md b/README.md index da53214..10701d7 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,26 @@ These snippets were made to speed up Vue 3 development. With it you can write bo | `hcontrols-text` | Histoire controls - Text | | `hcontrols-textarea` | Histoire controls - Textarea | +### Vitest + +| Snippet | Purpose | +| ------------------------- | ------------------------------ | +| `viconfig` | Vitest config for Vue 3 | +| `videscribe` | Vitest Describe | +| `videscribe-concurrent` | Vitest Describe - Concurrent | +| `viit` | Vitest It | +| `viit-concurrent` | Vitest It - Concurrent | +| `viit-async` | Vitest It - Async | +| `viit-async-concurrent` | Vitest It - Async Concurrent | +| `viit-todo` | Vitest It - Todo | +| `vitest` | Vitest Test | +| `vitest-concurrent` | Vitest Test - Concurrent | +| `vitest-async` | Vitest Test - Async | +| `vitest-async-concurrent` | Vitest Test - Async Concurrent | +| `vitest-todo` | Vitest Test - Todo | +| `visnapshot` | Vitest Match Snapshot | +| `visnapshot-inline` | Vitest Match Snapshot - Inline | + ## Contributing This is an open source project open to anyone. Contributors are welcome on [GitHub](https://github.com/exer7um/vue3-vscode-snippets). diff --git a/package.json b/package.json index 45301c8..a789547 100644 --- a/package.json +++ b/package.json @@ -118,6 +118,14 @@ { "language": "typescript", "path": "./snippets/histoire/histoire-script.code-snippets" + }, + { + "language": "javascript", + "path": "./snippets/vitest/vitest.code-snippets" + }, + { + "language": "typescript", + "path": "./snippets/vitest/vitest.code-snippets" } ] } diff --git a/snippets/vitest/vitest.code-snippets b/snippets/vitest/vitest.code-snippets new file mode 100644 index 0000000..ce6944c --- /dev/null +++ b/snippets/vitest/vitest.code-snippets @@ -0,0 +1,131 @@ +{ + "Vitest Config - Vue 3": { + "prefix": "viconfig", + "body": [ + "import { defineConfig } from 'vitest/config'", + "", + "export default defineConfig({", + "\t${0}", + "})" + ], + "description": "Vitest config for Vue 3" + }, + "Vitest Describe": { + "prefix": "videscribe", + "body": [ + "describe('${1:name}'), () => {", + "\t${0}", + "}" + ], + "description": "Vitest Describe" + }, + "Vitest Describe - Concurrent": { + "prefix": "videscribe-concurrent", + "body": [ + "describe.concurrent('${1:name}'), () => {", + "\t${0}", + "}" + ], + "description": "Vitest Describe Concurrent" + }, + "Vitest It": { + "prefix": "viit", + "body": [ + "it('${1:name}'), () => {", + "\t${0}", + "}" + ], + "description": "Vitest It" + }, + "Vitest It - Concurrent": { + "prefix": "viit-concurrent", + "body": [ + "it.concurrent('${1:name}'), () => {", + "\t${0}", + "}" + ], + "description": "Vitest It Concurrent" + }, + "Vitest It - Async": { + "prefix": "viit-async", + "body": [ + "it('${1:name}'), async () => {", + "\t${0}", + "}" + ], + "description": "Vitest It Async" + }, + "Vitest It - Async Concurrent": { + "prefix": "viit-async-concurrent", + "body": [ + "it.concurrent('${1:name}'), async () => {", + "\t${0}", + "}" + ], + "description": "Vitest It Async Concurrent" + }, + "Vitest It - Todo": { + "prefix": "viit-todo", + "body": [ + "it.todo('${1:name}')" + ], + "description": "Vitest It Todo" + }, + "Vitest Test": { + "prefix": "vitest", + "body": [ + "test('${1:name}'), () => {", + "\t${0}", + "}" + ], + "description": "Vitest Test" + }, + "Vitest Test - Concurrent": { + "prefix": "vitest-concurrent", + "body": [ + "test.concurrent('${1:name}'), () => {", + "\t${0}", + "}" + ], + "description": "Vitest Test Concurrent" + }, + "Vitest Test - Async": { + "prefix": "vitest-async", + "body": [ + "test('${1:name}'), async () => {", + "\t${0}", + "}" + ], + "description": "Vitest Test Async" + }, + "Vitest Test - Async Concurrent": { + "prefix": "vitest-async-concurrent", + "body": [ + "test.concurrent('${1:name}'), async () => {", + "\t${0}", + "}" + ], + "description": "Vitest Test Async Concurrent" + }, + "Vitest Test - Todo": { + "prefix": "vitest-todo", + "body": [ + "test.todo('${1:name}')" + ], + "description": "Vitest Test Todo" + }, + "Vitest Match Snapshot": { + "prefix": "visnapshot", + "body": [ + "expect(${0}).toMatchSnapshot()" + ], + "description": "Vitest Match Snapshot" + }, + "Vitest Match Snapshot - Inline": { + "prefix": "visnapshot-inline", + "body": [ + "expect(${0}).toMatchInlineSnapshot()" + ], + "description": "Vitest Match Inline Snapshot" + }, +} From 4d6232bdd7980cb457603acbe9199866c2f864f0 Mon Sep 17 00:00:00 2001 From: Vasily Kuzin Date: Tue, 6 Jun 2023 20:59:33 +0300 Subject: [PATCH 3/4] Vitest vue snippets #23 --- README.md | 2 ++ package.json | 8 ++++++++ snippets/vitest/vue.code-snippets | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 snippets/vitest/vue.code-snippets diff --git a/README.md b/README.md index 10701d7..2be1653 100644 --- a/README.md +++ b/README.md @@ -170,6 +170,8 @@ These snippets were made to speed up Vue 3 development. With it you can write bo | `vitest-todo` | Vitest Test - Todo | | `visnapshot` | Vitest Match Snapshot | | `visnapshot-inline` | Vitest Match Snapshot - Inline | +| `vimount` | Vue Test Utils Mount | +| `vicomponent` | Vue Test Utils Component | ## Contributing diff --git a/package.json b/package.json index a789547..f70ca5a 100644 --- a/package.json +++ b/package.json @@ -126,6 +126,14 @@ { "language": "typescript", "path": "./snippets/vitest/vitest.code-snippets" + }, + { + "language": "javascript", + "path": "./snippets/vitest/vue.code-snippets" + }, + { + "language": "typescript", + "path": "./snippets/vitest/vue.code-snippets" } ] } diff --git a/snippets/vitest/vue.code-snippets b/snippets/vitest/vue.code-snippets new file mode 100644 index 0000000..ea6ec08 --- /dev/null +++ b/snippets/vitest/vue.code-snippets @@ -0,0 +1,22 @@ +{ + "Vitest Vue Mount": { + "prefix": "vimount", + "body": [ + "const wrapper = mount(${0})", + ], + "description": "Vue Test Utils Mount" + }, + "Vitest Test Component": { + "prefix": "vicomponent", + "body": [ + "{", + "\ttemplate: '${0}'", + "\t\tdata() {", + "\t\t\treturn {", + "\t\t${2:variable}", + "\t}", + "}" + ], + "description": "Vue Test Utils Component" + } +} From a00231355fff7d1cec222e38166f8d02bbb21a7e Mon Sep 17 00:00:00 2001 From: Vasily Kuzin Date: Tue, 6 Jun 2023 21:07:04 +0300 Subject: [PATCH 4/4] Vitest Nuxt Snippets #23 --- README.md | 7 ++++- package.json | 8 +++++ snippets/vitest/nuxt.code-snippets | 49 ++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 snippets/vitest/nuxt.code-snippets diff --git a/README.md b/README.md index 2be1653..94d8b77 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,7 @@ These snippets were made to speed up Vue 3 development. With it you can write bo | Snippet | Purpose | | ------------------------- | ------------------------------ | | `viconfig` | Vitest config for Vue 3 | +| `viconfig-nuxt` | Vitest config for Nuxt 3 | | `videscribe` | Vitest Describe | | `videscribe-concurrent` | Vitest Describe - Concurrent | | `viit` | Vitest It | @@ -170,8 +171,12 @@ These snippets were made to speed up Vue 3 development. With it you can write bo | `vitest-todo` | Vitest Test - Todo | | `visnapshot` | Vitest Match Snapshot | | `visnapshot-inline` | Vitest Match Snapshot - Inline | -| `vimount` | Vue Test Utils Mount | +| `vimount` | Vue Test Utils `mount` | | `vicomponent` | Vue Test Utils Component | +| `vimount-suspended` | nuxt-vitest `mountSuspended` | +| `vimocknuxtimport` | nuxt-vitest `mockNuxtImport` | +| `vimockcomponent` | nuxt-vitest `mockComponent` | +| `viregisterendpoint` | nuxt-vitest `registerEndpoint` | ## Contributing diff --git a/package.json b/package.json index f70ca5a..9e31698 100644 --- a/package.json +++ b/package.json @@ -134,6 +134,14 @@ { "language": "typescript", "path": "./snippets/vitest/vue.code-snippets" + }, + { + "language": "javascript", + "path": "./snippets/vitest/nuxt.code-snippets" + }, + { + "language": "typescript", + "path": "./snippets/vitest/nuxt.code-snippets" } ] } diff --git a/snippets/vitest/nuxt.code-snippets b/snippets/vitest/nuxt.code-snippets new file mode 100644 index 0000000..b3f26a4 --- /dev/null +++ b/snippets/vitest/nuxt.code-snippets @@ -0,0 +1,49 @@ +{ + "Vitest Config - Nuxt 3": { + "prefix": "viconfig-nuxt", + "body": [ + "import { defineVitestConfig } from 'nuxt-vitest/config'", + "", + "export default defineVitestConfig({", + "\ttest: {", + "\t\tenvironment: 'nuxt'", + "\t}", + "})" + ], + "description": "Vitest config for Nuxt 3" + }, + "Vitest Nuxt Mount Suspended": { + "prefix": "vimount-suspended", + "body": [ + "const wrapper = await mountSuspended(${0})", + ], + "description": "nuxt-vitest mountSuspended" + }, + "Vitest Nuxt Mock Import": { + "prefix": "vimocknuxtimport", + "body": [ + "mockNuxtImport('${1:functionName}', () => {", + "\treturn () => {", + "\t\treturn { ${0} }", + "\t}", + "})" + ], + "description": "nuxt-vitest mockNuxtImport" + }, + "Vitest Nuxt Mock Component": { + "prefix": "vimockcomponent", + "body": [ + "mockComponent('${0}')", + ], + "description": "nuxt-vitest mockComponent" + }, + "Vitest Nuxt Register Endpoint": { + "prefix": "viregisterendpoint", + "body": [ + "registerEndpoint('/${1:endpoint}/', () => {", + "\t{0}", + "})" + ], + "description": "nuxt-vitest registerEndpoint" + }, +}