Skip to content

Commit adf6fbd

Browse files
committed
Add Nuxt base snippet #63
1 parent 3fd355e commit adf6fbd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: snippets/vitest/nuxt.code-snippets

+23
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,27 @@
4646
],
4747
"description": "nuxt-vitest registerEndpoint"
4848
},
49+
"Vitest Nuxt Base": {
50+
"prefix": "vibase-nuxt",
51+
"body": [
52+
"// @vitest-environment nuxt",
53+
"import type { VueWrapper } from '@vue/test-utils'",
54+
"import { mountSuspended } from '@nuxt/test-utils/runtime'",
55+
"import { afterEach, beforeEach, describe, expect } from 'vitest'",
56+
"import ${TM_FILENAME/\\..*//} from '~/components/${TM_FILENAME/\\..*//}.vue'",
57+
"",
58+
"describe('${TM_FILENAME/\\..*//}', () => {",
59+
"\tlet wrapper: VueWrapper",
60+
"\t",
61+
"\tbeforeEach(async () => {",
62+
"\t\twrapper = await mountSuspended(${TM_FILENAME/\\..*//})",
63+
"\t})",
64+
"\t",
65+
"\tafterEach(() => {",
66+
"\t\twrapper.unmount()",
67+
"\t})",
68+
"})"
69+
],
70+
"description": "Base for Vitest file for Vue component"
71+
}
4972
}

0 commit comments

Comments
 (0)