[READ-ONLY] Mirror of https://github.com/danielroe/nuxt-vitest. An vitest environment with support for testing code that needs a Nuxt runtime environment
nuxt nuxt-module testing unit-testing vitest
0

Configure Feed

Select the types of activity you want to include in your feed.

docs(playground): demo usage of co-exists unit and nuxt testing (#6)

authored by

Anthony Fu and committed by
GitHub
(Dec 21, 2022, 3:51 PM UTC) fdd0db8b 6eddd061

+134 -456
+3 -2
package.json
··· 16 16 "scripts": { 17 17 "build": "unbuild", 18 18 "dev:prepare": "unbuild --stub && pnpm nuxi prepare playground", 19 + "dev": "pnpm dev:prepare && pnpm -C playground test:nuxt", 19 20 "lint": "pnpm lint:all:eslint && pnpm lint:all:prettier", 20 21 "lint:all:eslint": "pnpm lint:eslint --ext .ts,.js,.mjs,.cjs .", 21 22 "lint:all:prettier": "pnpm lint:prettier \"{src,test}/**/*.{js,json,ts}\"", ··· 25 26 "prepublishOnly": "pnpm test run && pinst --disable", 26 27 "postinstall": "husky install", 27 28 "postpublish": "pinst --enable", 28 - "test": "cd playground && pnpm vitest" 29 + "test": "pnpm -C playground test" 29 30 }, 30 31 "main": "./dist/index.cjs", 31 32 "module": "./dist/index.mjs", ··· 74 75 "prettier": "latest", 75 76 "release-it": "latest", 76 77 "unbuild": "^1.0.2", 77 - "vitest": "0.26.1", 78 + "vitest": "0.26.2", 78 79 "vue": "^3.2.45" 79 80 }, 80 81 "resolutions": {
+25 -381
pnpm-lock.yaml
··· 27 27 release-it: latest 28 28 unbuild: ^1.0.2 29 29 unenv: ^1.0.0 30 - vitest: 0.26.1 30 + vitest: 0.26.2 31 31 vue: ^3.2.45 32 32 dependencies: 33 33 '@nuxt/kit': 3.0.0 ··· 39 39 devDependencies: 40 40 '@nuxt/eslint-config': 0.1.1_eslint@8.30.0 41 41 '@release-it/conventional-changelog': 5.1.1_release-it@15.5.1 42 - '@vitest/coverage-c8': 0.26.0_happy-dom@8.1.0 42 + '@vitest/coverage-c8': 0.26.2_happy-dom@8.1.0 43 43 conventional-changelog-conventionalcommits: 5.0.0 44 44 eslint: 8.30.0 45 45 eslint-config-prettier: 8.5.0_eslint@8.30.0 ··· 51 51 prettier: 2.8.1 52 52 release-it: 15.5.1 53 53 unbuild: 1.0.2 54 - vitest: 0.26.1_happy-dom@8.1.0 54 + vitest: 0.26.2_happy-dom@8.1.0 55 55 vue: 3.2.45 56 56 57 57 playground: 58 58 specifiers: 59 59 nuxt: ^3.0.0 60 - vitest: ^0.24.5 60 + vitest: ^0.26.2 61 61 vitest-environment-nuxt: workspace:* 62 62 devDependencies: 63 63 nuxt: 3.0.0 64 - vitest: 0.24.5 64 + vitest: 0.26.2 65 65 vitest-environment-nuxt: link:.. 66 66 67 67 packages: ··· 350 350 mime: 3.0.0 351 351 dev: true 352 352 353 - /@esbuild/android-arm/0.15.13: 354 - resolution: {integrity: sha512-RY2fVI8O0iFUNvZirXaQ1vMvK0xhCcl0gqRj74Z6yEiO1zAUa7hbsdwZM1kzqbxHK7LFyMizipfXT3JME+12Hw==} 355 - engines: {node: '>=12'} 356 - cpu: [arm] 357 - os: [android] 358 - requiresBuild: true 359 - dev: true 360 - optional: true 361 - 362 353 /@esbuild/android-arm/0.15.16: 363 354 resolution: {integrity: sha512-nyB6CH++2mSgx3GbnrJsZSxzne5K0HMyNIWafDHqYy7IwxFc4fd/CgHVZXr8Eh+Q3KbIAcAe3vGyqIPhGblvMQ==} 364 355 engines: {node: '>=12'} ··· 373 364 engines: {node: '>=12'} 374 365 cpu: [arm] 375 366 os: [android] 376 - requiresBuild: true 377 - dev: true 378 - optional: true 379 - 380 - /@esbuild/linux-loong64/0.15.13: 381 - resolution: {integrity: sha512-+BoyIm4I8uJmH/QDIH0fu7MG0AEx9OXEDXnqptXCwKOlOqZiS4iraH1Nr7/ObLMokW3sOCeBNyD68ATcV9b9Ag==} 382 - engines: {node: '>=12'} 383 - cpu: [loong64] 384 - os: [linux] 385 367 requiresBuild: true 386 368 dev: true 387 369 optional: true ··· 1190 1172 /@types/chai-subset/1.3.3: 1191 1173 resolution: {integrity: sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==} 1192 1174 dependencies: 1193 - '@types/chai': 4.3.3 1194 - dev: true 1195 - 1196 - /@types/chai/4.3.3: 1197 - resolution: {integrity: sha512-hC7OMnszpxhZPduX+m+nrx+uFoLkWOMiR4oa/AZF3MuSETYTZmFfJAHqZEM8MVlvfG7BEUcgvtwoCTxBp6hm3g==} 1175 + '@types/chai': 4.3.4 1198 1176 dev: true 1199 1177 1200 1178 /@types/chai/4.3.4: ··· 1441 1419 vue: 3.2.45 1442 1420 dev: true 1443 1421 1444 - /@vitest/coverage-c8/0.26.0_happy-dom@8.1.0: 1445 - resolution: {integrity: sha512-1LSMHvX1Winy1dIV1XqQanIskYBvd3+TlQtxO6BeyFa57Lah2uNBm3gh5iDB+ZWCySN5o6bl7qOJdaZjEQZZeg==} 1422 + /@vitest/coverage-c8/0.26.2_happy-dom@8.1.0: 1423 + resolution: {integrity: sha512-h7RZ7trUUsq+yixiXhBaGboap7pjee+x59HE9rsz/JbY/evJhgk+biLY5lOgjpyUonPN0Ymz3mxlrXW9Da54SQ==} 1446 1424 dependencies: 1447 1425 c8: 7.12.0 1448 - vitest: 0.26.0_happy-dom@8.1.0 1426 + vitest: 0.26.2_happy-dom@8.1.0 1449 1427 transitivePeerDependencies: 1450 1428 - '@edge-runtime/vm' 1451 1429 - '@vitest/browser' ··· 2041 2019 2042 2020 /caniuse-lite/1.0.30001431: 2043 2021 resolution: {integrity: sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ==} 2044 - 2045 - /chai/4.3.6: 2046 - resolution: {integrity: sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q==} 2047 - engines: {node: '>=4'} 2048 - dependencies: 2049 - assertion-error: 1.1.0 2050 - check-error: 1.0.2 2051 - deep-eql: 3.0.1 2052 - get-func-name: 2.0.0 2053 - loupe: 2.3.4 2054 - pathval: 1.1.1 2055 - type-detect: 4.0.8 2056 - dev: true 2057 2022 2058 2023 /chai/4.3.7: 2059 2024 resolution: {integrity: sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==} ··· 2725 2690 mimic-response: 3.1.0 2726 2691 dev: true 2727 2692 2728 - /deep-eql/3.0.1: 2729 - resolution: {integrity: sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==} 2730 - engines: {node: '>=0.12'} 2731 - dependencies: 2732 - type-detect: 4.0.8 2733 - dev: true 2734 - 2735 2693 /deep-eql/4.1.3: 2736 2694 resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} 2737 2695 engines: {node: '>=6'} ··· 3017 2975 is-symbol: 1.0.4 3018 2976 dev: true 3019 2977 3020 - /esbuild-android-64/0.15.13: 3021 - resolution: {integrity: sha512-yRorukXBlokwTip+Sy4MYskLhJsO0Kn0/Fj43s1krVblfwP+hMD37a4Wmg139GEsMLl+vh8WXp2mq/cTA9J97g==} 3022 - engines: {node: '>=12'} 3023 - cpu: [x64] 3024 - os: [android] 3025 - requiresBuild: true 3026 - dev: true 3027 - optional: true 3028 - 3029 2978 /esbuild-android-64/0.15.16: 3030 2979 resolution: {integrity: sha512-Vwkv/sT0zMSgPSVO3Jlt1pUbnZuOgtOQJkJkyyJFAlLe7BiT8e9ESzo0zQSx4c3wW4T6kGChmKDPMbWTgtliQA==} 3031 2980 engines: {node: '>=12'} ··· 3039 2988 resolution: {integrity: sha512-wnpt3OXRhcjfIDSZu9bnzT4/TNTDsOUvip0foZOUBG7QbSt//w3QV4FInVJxNhKc/ErhUxc5z4QjHtMi7/TbgA==} 3040 2989 engines: {node: '>=12'} 3041 2990 cpu: [x64] 3042 - os: [android] 3043 - requiresBuild: true 3044 - dev: true 3045 - optional: true 3046 - 3047 - /esbuild-android-arm64/0.15.13: 3048 - resolution: {integrity: sha512-TKzyymLD6PiVeyYa4c5wdPw87BeAiTXNtK6amWUcXZxkV51gOk5u5qzmDaYSwiWeecSNHamFsaFjLoi32QR5/w==} 3049 - engines: {node: '>=12'} 3050 - cpu: [arm64] 3051 2991 os: [android] 3052 2992 requiresBuild: true 3053 2993 dev: true ··· 3071 3011 dev: true 3072 3012 optional: true 3073 3013 3074 - /esbuild-darwin-64/0.15.13: 3075 - resolution: {integrity: sha512-WAx7c2DaOS6CrRcoYCgXgkXDliLnFv3pQLV6GeW1YcGEZq2Gnl8s9Pg7ahValZkpOa0iE/ojRVQ87sbUhF1Cbg==} 3076 - engines: {node: '>=12'} 3077 - cpu: [x64] 3078 - os: [darwin] 3079 - requiresBuild: true 3080 - dev: true 3081 - optional: true 3082 - 3083 3014 /esbuild-darwin-64/0.15.16: 3084 3015 resolution: {integrity: sha512-wo2VWk/n/9V2TmqUZ/KpzRjCEcr00n7yahEdmtzlrfQ3lfMCf3Wa+0sqHAbjk3C6CKkR3WKK/whkMq5Gj4Da9g==} 3085 3016 engines: {node: '>=12'} ··· 3093 3024 resolution: {integrity: sha512-2WAvs95uPnVJPuYKP0Eqx+Dl/jaYseZEUUT1sjg97TJa4oBtbAKnPnl3b5M9l51/nbx7+QAEtuummJZW0sBEmg==} 3094 3025 engines: {node: '>=12'} 3095 3026 cpu: [x64] 3096 - os: [darwin] 3097 - requiresBuild: true 3098 - dev: true 3099 - optional: true 3100 - 3101 - /esbuild-darwin-arm64/0.15.13: 3102 - resolution: {integrity: sha512-U6jFsPfSSxC3V1CLiQqwvDuj3GGrtQNB3P3nNC3+q99EKf94UGpsG9l4CQ83zBs1NHrk1rtCSYT0+KfK5LsD8A==} 3103 - engines: {node: '>=12'} 3104 - cpu: [arm64] 3105 3027 os: [darwin] 3106 3028 requiresBuild: true 3107 3029 dev: true ··· 3125 3047 dev: true 3126 3048 optional: true 3127 3049 3128 - /esbuild-freebsd-64/0.15.13: 3129 - resolution: {integrity: sha512-whItJgDiOXaDG/idy75qqevIpZjnReZkMGCgQaBWZuKHoElDJC1rh7MpoUgupMcdfOd+PgdEwNQW9DAE6i8wyA==} 3130 - engines: {node: '>=12'} 3131 - cpu: [x64] 3132 - os: [freebsd] 3133 - requiresBuild: true 3134 - dev: true 3135 - optional: true 3136 - 3137 3050 /esbuild-freebsd-64/0.15.16: 3138 3051 resolution: {integrity: sha512-UzIc0xlRx5x9kRuMr+E3+hlSOxa/aRqfuMfiYBXu2jJ8Mzej4lGL7+o6F5hzhLqWfWm1GWHNakIdlqg1ayaTNQ==} 3139 3052 engines: {node: '>=12'} ··· 3147 3060 resolution: {integrity: sha512-TT3uBUxkteAjR1QbsmvSsjpKjOX6UkCstr8nMr+q7zi3NuZ1oIpa8U41Y8I8dJH2fJgdC3Dj3CXO5biLQpfdZA==} 3148 3061 engines: {node: '>=12'} 3149 3062 cpu: [x64] 3150 - os: [freebsd] 3151 - requiresBuild: true 3152 - dev: true 3153 - optional: true 3154 - 3155 - /esbuild-freebsd-arm64/0.15.13: 3156 - resolution: {integrity: sha512-6pCSWt8mLUbPtygv7cufV0sZLeylaMwS5Fznj6Rsx9G2AJJsAjQ9ifA+0rQEIg7DwJmi9it+WjzNTEAzzdoM3Q==} 3157 - engines: {node: '>=12'} 3158 - cpu: [arm64] 3159 3063 os: [freebsd] 3160 3064 requiresBuild: true 3161 3065 dev: true ··· 3179 3083 dev: true 3180 3084 optional: true 3181 3085 3182 - /esbuild-linux-32/0.15.13: 3183 - resolution: {integrity: sha512-VbZdWOEdrJiYApm2kkxoTOgsoCO1krBZ3quHdYk3g3ivWaMwNIVPIfEE0f0XQQ0u5pJtBsnk2/7OPiCFIPOe/w==} 3184 - engines: {node: '>=12'} 3185 - cpu: [ia32] 3186 - os: [linux] 3187 - requiresBuild: true 3188 - dev: true 3189 - optional: true 3190 - 3191 3086 /esbuild-linux-32/0.15.16: 3192 3087 resolution: {integrity: sha512-iGijUTV+0kIMyUVoynK0v+32Oi8yyp0xwMzX69GX+5+AniNy/C/AL1MjFTsozRp/3xQPl7jVux/PLe2ds10/2w==} 3193 3088 engines: {node: '>=12'} ··· 3201 3096 resolution: {integrity: sha512-lphF3HiCSYtaa9p1DtXndiQEeQDKPl9eN/XNoBf2amEghugNuqXNZA/ZovthNE2aa4EN43WroO0B85xVSjYkbg==} 3202 3097 engines: {node: '>=12'} 3203 3098 cpu: [ia32] 3204 - os: [linux] 3205 - requiresBuild: true 3206 - dev: true 3207 - optional: true 3208 - 3209 - /esbuild-linux-64/0.15.13: 3210 - resolution: {integrity: sha512-rXmnArVNio6yANSqDQlIO4WiP+Cv7+9EuAHNnag7rByAqFVuRusLbGi2697A5dFPNXoO//IiogVwi3AdcfPC6A==} 3211 - engines: {node: '>=12'} 3212 - cpu: [x64] 3213 3099 os: [linux] 3214 3100 requiresBuild: true 3215 3101 dev: true ··· 3233 3119 dev: true 3234 3120 optional: true 3235 3121 3236 - /esbuild-linux-arm/0.15.13: 3237 - resolution: {integrity: sha512-Ac6LpfmJO8WhCMQmO253xX2IU2B3wPDbl4IvR0hnqcPrdfCaUa2j/lLMGTjmQ4W5JsJIdHEdW12dG8lFS0MbxQ==} 3238 - engines: {node: '>=12'} 3239 - cpu: [arm] 3240 - os: [linux] 3241 - requiresBuild: true 3242 - dev: true 3243 - optional: true 3244 - 3245 3122 /esbuild-linux-arm/0.15.16: 3246 3123 resolution: {integrity: sha512-XKcrxCEXDTOuoRj5l12tJnkvuxXBMKwEC5j0JISw3ziLf0j4zIwXbKbTmUrKFWbo6ZgvNpa7Y5dnbsjVvH39bQ==} 3247 3124 engines: {node: '>=12'} ··· 3255 3132 resolution: {integrity: sha512-UH779gstRblS4aoS2qpMl3wjg7U0j+ygu3GjIeTonCcN79ZvpPee12Qun3vcdxX+37O5LFxz39XeW2I9bybMVA==} 3256 3133 engines: {node: '>=12'} 3257 3134 cpu: [arm] 3258 - os: [linux] 3259 - requiresBuild: true 3260 - dev: true 3261 - optional: true 3262 - 3263 - /esbuild-linux-arm64/0.15.13: 3264 - resolution: {integrity: sha512-alEMGU4Z+d17U7KQQw2IV8tQycO6T+rOrgW8OS22Ua25x6kHxoG6Ngry6Aq6uranC+pNWNMB6aHFPh7aTQdORQ==} 3265 - engines: {node: '>=12'} 3266 - cpu: [arm64] 3267 3135 os: [linux] 3268 3136 requiresBuild: true 3269 3137 dev: true ··· 3287 3155 dev: true 3288 3156 optional: true 3289 3157 3290 - /esbuild-linux-mips64le/0.15.13: 3291 - resolution: {integrity: sha512-47PgmyYEu+yN5rD/MbwS6DxP2FSGPo4Uxg5LwIdxTiyGC2XKwHhHyW7YYEDlSuXLQXEdTO7mYe8zQ74czP7W8A==} 3292 - engines: {node: '>=12'} 3293 - cpu: [mips64el] 3294 - os: [linux] 3295 - requiresBuild: true 3296 - dev: true 3297 - optional: true 3298 - 3299 3158 /esbuild-linux-mips64le/0.15.16: 3300 3159 resolution: {integrity: sha512-kSJO2PXaxfm0pWY39+YX+QtpFqyyrcp0ZeI8QPTrcFVQoWEPiPVtOfTZeS3ZKedfH+Ga38c4DSzmKMQJocQv6A==} 3301 3160 engines: {node: '>=12'} ··· 3309 3168 resolution: {integrity: sha512-Mk6Ppwzzz3YbMl/ZZL2P0q1tnYqh/trYZ1VfNP47C31yT0K8t9s7Z077QrDA/guU60tGNp2GOwCQnp+DYv7bxQ==} 3310 3169 engines: {node: '>=12'} 3311 3170 cpu: [mips64el] 3312 - os: [linux] 3313 - requiresBuild: true 3314 - dev: true 3315 - optional: true 3316 - 3317 - /esbuild-linux-ppc64le/0.15.13: 3318 - resolution: {integrity: sha512-z6n28h2+PC1Ayle9DjKoBRcx/4cxHoOa2e689e2aDJSaKug3jXcQw7mM+GLg+9ydYoNzj8QxNL8ihOv/OnezhA==} 3319 - engines: {node: '>=12'} 3320 - cpu: [ppc64] 3321 3171 os: [linux] 3322 3172 requiresBuild: true 3323 3173 dev: true ··· 3341 3191 dev: true 3342 3192 optional: true 3343 3193 3344 - /esbuild-linux-riscv64/0.15.13: 3345 - resolution: {integrity: sha512-+Lu4zuuXuQhgLUGyZloWCqTslcCAjMZH1k3Xc9MSEJEpEFdpsSU0sRDXAnk18FKOfEjhu4YMGaykx9xjtpA6ow==} 3346 - engines: {node: '>=12'} 3347 - cpu: [riscv64] 3348 - os: [linux] 3349 - requiresBuild: true 3350 - dev: true 3351 - optional: true 3352 - 3353 3194 /esbuild-linux-riscv64/0.15.16: 3354 3195 resolution: {integrity: sha512-ty2YUHZlwFOwp7pR+J87M4CVrXJIf5ZZtU/umpxgVJBXvWjhziSLEQxvl30SYfUPq0nzeWKBGw5i/DieiHeKfw==} 3355 3196 engines: {node: '>=12'} ··· 3363 3204 resolution: {integrity: sha512-ba2COaoF5wL6VLZWn04k+ACZjZ6NYniMSQStodFKH/Pu6RxzQqzsmjR1t9QC89VYJxBeyVPTaHuBMCejl3O/xg==} 3364 3205 engines: {node: '>=12'} 3365 3206 cpu: [riscv64] 3366 - os: [linux] 3367 - requiresBuild: true 3368 - dev: true 3369 - optional: true 3370 - 3371 - /esbuild-linux-s390x/0.15.13: 3372 - resolution: {integrity: sha512-BMeXRljruf7J0TMxD5CIXS65y7puiZkAh+s4XFV9qy16SxOuMhxhVIXYLnbdfLrsYGFzx7U9mcdpFWkkvy/Uag==} 3373 - engines: {node: '>=12'} 3374 - cpu: [s390x] 3375 3207 os: [linux] 3376 3208 requiresBuild: true 3377 3209 dev: true ··· 3395 3227 dev: true 3396 3228 optional: true 3397 3229 3398 - /esbuild-netbsd-64/0.15.13: 3399 - resolution: {integrity: sha512-EHj9QZOTel581JPj7UO3xYbltFTYnHy+SIqJVq6yd3KkCrsHRbapiPb0Lx3EOOtybBEE9EyqbmfW1NlSDsSzvQ==} 3400 - engines: {node: '>=12'} 3401 - cpu: [x64] 3402 - os: [netbsd] 3403 - requiresBuild: true 3404 - dev: true 3405 - optional: true 3406 - 3407 3230 /esbuild-netbsd-64/0.15.16: 3408 3231 resolution: {integrity: sha512-ElQ9rhdY51et6MJTWrCPbqOd/YuPowD7Cxx3ee8wlmXQQVW7UvQI6nSprJ9uVFQISqSF5e5EWpwWqXZsECLvXg==} 3409 3232 engines: {node: '>=12'} ··· 3418 3241 engines: {node: '>=12'} 3419 3242 cpu: [x64] 3420 3243 os: [netbsd] 3421 - requiresBuild: true 3422 - dev: true 3423 - optional: true 3424 - 3425 - /esbuild-openbsd-64/0.15.13: 3426 - resolution: {integrity: sha512-nkuDlIjF/sfUhfx8SKq0+U+Fgx5K9JcPq1mUodnxI0x4kBdCv46rOGWbuJ6eof2n3wdoCLccOoJAbg9ba/bT2w==} 3427 - engines: {node: '>=12'} 3428 - cpu: [x64] 3429 - os: [openbsd] 3430 3244 requiresBuild: true 3431 3245 dev: true 3432 3246 optional: true ··· 3449 3263 dev: true 3450 3264 optional: true 3451 3265 3452 - /esbuild-sunos-64/0.15.13: 3453 - resolution: {integrity: sha512-jVeu2GfxZQ++6lRdY43CS0Tm/r4WuQQ0Pdsrxbw+aOrHQPHV0+LNOLnvbN28M7BSUGnJnHkHm2HozGgNGyeIRw==} 3454 - engines: {node: '>=12'} 3455 - cpu: [x64] 3456 - os: [sunos] 3457 - requiresBuild: true 3458 - dev: true 3459 - optional: true 3460 - 3461 3266 /esbuild-sunos-64/0.15.16: 3462 3267 resolution: {integrity: sha512-exSAx8Phj7QylXHlMfIyEfNrmqnLxFqLxdQF6MBHPdHAjT7fsKaX6XIJn+aQEFiOcE4X8e7VvdMCJ+WDZxjSRQ==} 3463 3268 engines: {node: '>=12'} ··· 3476 3281 dev: true 3477 3282 optional: true 3478 3283 3479 - /esbuild-windows-32/0.15.13: 3480 - resolution: {integrity: sha512-XoF2iBf0wnqo16SDq+aDGi/+QbaLFpkiRarPVssMh9KYbFNCqPLlGAWwDvxEVz+ywX6Si37J2AKm+AXq1kC0JA==} 3481 - engines: {node: '>=12'} 3482 - cpu: [ia32] 3483 - os: [win32] 3484 - requiresBuild: true 3485 - dev: true 3486 - optional: true 3487 - 3488 3284 /esbuild-windows-32/0.15.16: 3489 3285 resolution: {integrity: sha512-zQgWpY5pUCSTOwqKQ6/vOCJfRssTvxFuEkpB4f2VUGPBpdddZfdj8hbZuFRdZRPIVHvN7juGcpgCA/XCF37mAQ==} 3490 3286 engines: {node: '>=12'} ··· 3498 3294 resolution: {integrity: sha512-o+eyLu2MjVny/nt+E0uPnBxYuJHBvho8vWsC2lV61A7wwTWC3jkN2w36jtA+yv1UgYkHRihPuQsL23hsCYGcOQ==} 3499 3295 engines: {node: '>=12'} 3500 3296 cpu: [ia32] 3501 - os: [win32] 3502 - requiresBuild: true 3503 - dev: true 3504 - optional: true 3505 - 3506 - /esbuild-windows-64/0.15.13: 3507 - resolution: {integrity: sha512-Et6htEfGycjDrtqb2ng6nT+baesZPYQIW+HUEHK4D1ncggNrDNk3yoboYQ5KtiVrw/JaDMNttz8rrPubV/fvPQ==} 3508 - engines: {node: '>=12'} 3509 - cpu: [x64] 3510 3297 os: [win32] 3511 3298 requiresBuild: true 3512 3299 dev: true ··· 3530 3317 dev: true 3531 3318 optional: true 3532 3319 3533 - /esbuild-windows-arm64/0.15.13: 3534 - resolution: {integrity: sha512-3bv7tqntThQC9SWLRouMDmZnlOukBhOCTlkzNqzGCmrkCJI7io5LLjwJBOVY6kOUlIvdxbooNZwjtBvj+7uuVg==} 3535 - engines: {node: '>=12'} 3536 - cpu: [arm64] 3537 - os: [win32] 3538 - requiresBuild: true 3539 - dev: true 3540 - optional: true 3541 - 3542 3320 /esbuild-windows-arm64/0.15.16: 3543 3321 resolution: {integrity: sha512-oCcUKrJaMn04Vxy9Ekd8x23O8LoU01+4NOkQ2iBToKgnGj5eo1vU9i27NQZ9qC8NFZgnQQZg5oZWAejmbsppNA==} 3544 3322 engines: {node: '>=12'} ··· 3556 3334 requiresBuild: true 3557 3335 dev: true 3558 3336 optional: true 3559 - 3560 - /esbuild/0.15.13: 3561 - resolution: {integrity: sha512-Cu3SC84oyzzhrK/YyN4iEVy2jZu5t2fz66HEOShHURcjSkOSAVL8C/gfUT+lDJxkVHpg8GZ10DD0rMHRPqMFaQ==} 3562 - engines: {node: '>=12'} 3563 - hasBin: true 3564 - requiresBuild: true 3565 - optionalDependencies: 3566 - '@esbuild/android-arm': 0.15.13 3567 - '@esbuild/linux-loong64': 0.15.13 3568 - esbuild-android-64: 0.15.13 3569 - esbuild-android-arm64: 0.15.13 3570 - esbuild-darwin-64: 0.15.13 3571 - esbuild-darwin-arm64: 0.15.13 3572 - esbuild-freebsd-64: 0.15.13 3573 - esbuild-freebsd-arm64: 0.15.13 3574 - esbuild-linux-32: 0.15.13 3575 - esbuild-linux-64: 0.15.13 3576 - esbuild-linux-arm: 0.15.13 3577 - esbuild-linux-arm64: 0.15.13 3578 - esbuild-linux-mips64le: 0.15.13 3579 - esbuild-linux-ppc64le: 0.15.13 3580 - esbuild-linux-riscv64: 0.15.13 3581 - esbuild-linux-s390x: 0.15.13 3582 - esbuild-netbsd-64: 0.15.13 3583 - esbuild-openbsd-64: 0.15.13 3584 - esbuild-sunos-64: 0.15.13 3585 - esbuild-windows-32: 0.15.13 3586 - esbuild-windows-64: 0.15.13 3587 - esbuild-windows-arm64: 0.15.13 3588 - dev: true 3589 3337 3590 3338 /esbuild/0.15.16: 3591 3339 resolution: {integrity: sha512-o6iS9zxdHrrojjlj6pNGC2NAg86ECZqIETswTM5KmJitq+R1YmahhWtMumeQp9lHqJaROGnsBi2RLawGnfo5ZQ==} ··· 7569 7317 engines: {node: '>=8'} 7570 7318 dev: true 7571 7319 7572 - /strip-literal/0.4.2: 7573 - resolution: {integrity: sha512-pv48ybn4iE1O9RLgCAN0iU4Xv7RlBTiit6DKmMiErbs9x1wH6vXBs45tWc0H5wUIF6TLTrKweqkmYF/iraQKNw==} 7574 - dependencies: 7575 - acorn: 8.8.1 7576 - dev: true 7577 - 7578 7320 /strip-literal/1.0.0: 7579 7321 resolution: {integrity: sha512-5o4LsH1lzBzO9UFH63AJ2ad2/S2AVx6NtjOcaz+VTT2h1RiRvbipW72z8M/lxEhcPHDBQwpDrnTF7sXy/7OwCQ==} 7580 7322 dependencies: ··· 8133 7875 - terser 8134 7876 dev: true 8135 7877 8136 - /vite-node/0.26.0_@types+node@18.11.9: 8137 - resolution: {integrity: sha512-nLtHWCv6reONl1oFsKhQ/LT7n3UNLpvVARAJlmGrQV6qSElht/9AdN41Pa+WSkw2Winh682UzM0Yw0GNlfqejw==} 8138 - engines: {node: '>=v14.16.0'} 8139 - hasBin: true 8140 - dependencies: 8141 - debug: 4.3.4 8142 - mlly: 1.0.0 8143 - pathe: 0.2.0 8144 - source-map: 0.6.1 8145 - source-map-support: 0.5.21 8146 - vite: 3.2.4_@types+node@18.11.9 8147 - transitivePeerDependencies: 8148 - - '@types/node' 8149 - - less 8150 - - sass 8151 - - stylus 8152 - - sugarss 8153 - - supports-color 8154 - - terser 8155 - dev: true 8156 - 8157 - /vite-node/0.26.1_@types+node@18.11.9: 8158 - resolution: {integrity: sha512-5FJSKZZJz48zFRKHE55WyevZe61hLMQEsqGn+ungfd60kxEztFybZ3yG9ToGFtOWNCCy7Vn5EVuXD8bdeHOSdw==} 7878 + /vite-node/0.26.2_@types+node@18.11.9: 7879 + resolution: {integrity: sha512-4M/zlatItZAyvrQG+82zQBhgDjRZRhVJYFW4T9wcAKh7eMmSiPOVSeI5zsV9UzHXgCcIDKX0o0r3s4OxExTHqg==} 8159 7880 engines: {node: '>=v14.16.0'} 8160 7881 hasBin: true 8161 7882 dependencies: ··· 8250 7971 vscode-uri: 3.0.6 8251 7972 dev: true 8252 7973 8253 - /vite/3.2.3_@types+node@18.11.9: 8254 - resolution: {integrity: sha512-h8jl1TZ76eGs3o2dIBSsvXDLb1m/Ec1iej8ZMdz+PsaFUsftZeWe2CZOI3qogEsMNaywc17gu0q6cQDzh/weCQ==} 8255 - engines: {node: ^14.18.0 || >=16.0.0} 8256 - hasBin: true 8257 - peerDependencies: 8258 - '@types/node': '>= 14' 8259 - less: '*' 8260 - sass: '*' 8261 - stylus: '*' 8262 - sugarss: '*' 8263 - terser: ^5.4.0 8264 - peerDependenciesMeta: 8265 - '@types/node': 8266 - optional: true 8267 - less: 8268 - optional: true 8269 - sass: 8270 - optional: true 8271 - stylus: 8272 - optional: true 8273 - sugarss: 8274 - optional: true 8275 - terser: 8276 - optional: true 8277 - dependencies: 8278 - '@types/node': 18.11.9 8279 - esbuild: 0.15.13 8280 - postcss: 8.4.19 8281 - resolve: 1.22.1 8282 - rollup: 2.79.1 8283 - optionalDependencies: 8284 - fsevents: 2.3.2 8285 - dev: true 8286 - 8287 7974 /vite/3.2.4: 8288 7975 resolution: {integrity: sha512-Z2X6SRAffOUYTa+sLy3NQ7nlHFU100xwanq1WDwqaiFiCe+25zdxP1TfCS5ojPV2oDDcXudHIoPnI1Z/66B7Yw==} 8289 7976 engines: {node: ^14.18.0 || >=16.0.0} ··· 8351 8038 fsevents: 2.3.2 8352 8039 dev: true 8353 8040 8354 - /vitest/0.24.5: 8355 - resolution: {integrity: sha512-zw6JhPUHtLILQDe5Q39b/SzoITkG+R7hcFjuthp4xsi6zpmfQPOZcHodZ+3bqoWl4EdGK/p1fuMiEwdxgbGLOA==} 8041 + /vitest/0.26.2: 8042 + resolution: {integrity: sha512-Jvqxh6SDy9SsuslkDjts0iDewDIdq4rveEt69YgDuAb1tVDGV0lDepVaeAFraoySWqneJmOt4TngFFNhlw7GfA==} 8356 8043 engines: {node: '>=v14.16.0'} 8357 8044 hasBin: true 8358 8045 peerDependencies: ··· 8373 8060 jsdom: 8374 8061 optional: true 8375 8062 dependencies: 8376 - '@types/chai': 4.3.3 8063 + '@types/chai': 4.3.4 8377 8064 '@types/chai-subset': 1.3.3 8378 8065 '@types/node': 18.11.9 8379 - chai: 4.3.6 8066 + acorn: 8.8.1 8067 + acorn-walk: 8.2.0 8068 + chai: 4.3.7 8380 8069 debug: 4.3.4 8381 8070 local-pkg: 0.4.2 8382 - strip-literal: 0.4.2 8071 + source-map: 0.6.1 8072 + strip-literal: 1.0.0 8383 8073 tinybench: 2.3.1 8384 8074 tinypool: 0.3.0 8385 8075 tinyspy: 1.0.2 8386 - vite: 3.2.3_@types+node@18.11.9 8076 + vite: 3.2.4_@types+node@18.11.9 8077 + vite-node: 0.26.2_@types+node@18.11.9 8387 8078 transitivePeerDependencies: 8388 8079 - less 8389 8080 - sass ··· 8393 8084 - terser 8394 8085 dev: true 8395 8086 8396 - /vitest/0.26.0_happy-dom@8.1.0: 8397 - resolution: {integrity: sha512-5kUnms5WOa0qrDCJePEPB13v9mhr+ZT1Qy0qNg0eVj1X7/Fx4GY4L1e5s3OH+BQ/J7M5WtaKsUGv9l1pbC7v2Q==} 8087 + /vitest/0.26.2_happy-dom@8.1.0: 8088 + resolution: {integrity: sha512-Jvqxh6SDy9SsuslkDjts0iDewDIdq4rveEt69YgDuAb1tVDGV0lDepVaeAFraoySWqneJmOt4TngFFNhlw7GfA==} 8398 8089 engines: {node: '>=v14.16.0'} 8399 8090 hasBin: true 8400 8091 peerDependencies: ··· 8430 8121 tinypool: 0.3.0 8431 8122 tinyspy: 1.0.2 8432 8123 vite: 3.2.4_@types+node@18.11.9 8433 - vite-node: 0.26.0_@types+node@18.11.9 8434 - transitivePeerDependencies: 8435 - - less 8436 - - sass 8437 - - stylus 8438 - - sugarss 8439 - - supports-color 8440 - - terser 8441 - dev: true 8442 - 8443 - /vitest/0.26.1_happy-dom@8.1.0: 8444 - resolution: {integrity: sha512-qTLRnjYmjmJpHlLUtErxtlRqGCe8WItFhGXKklpWivu7CLP9KXN9iTezROe+vf51Kb+BB/fzxK6fUG9DvFGL5Q==} 8445 - engines: {node: '>=v14.16.0'} 8446 - hasBin: true 8447 - peerDependencies: 8448 - '@edge-runtime/vm': '*' 8449 - '@vitest/browser': '*' 8450 - '@vitest/ui': '*' 8451 - happy-dom: '*' 8452 - jsdom: '*' 8453 - peerDependenciesMeta: 8454 - '@edge-runtime/vm': 8455 - optional: true 8456 - '@vitest/browser': 8457 - optional: true 8458 - '@vitest/ui': 8459 - optional: true 8460 - happy-dom: 8461 - optional: true 8462 - jsdom: 8463 - optional: true 8464 - dependencies: 8465 - '@types/chai': 4.3.4 8466 - '@types/chai-subset': 1.3.3 8467 - '@types/node': 18.11.9 8468 - acorn: 8.8.1 8469 - acorn-walk: 8.2.0 8470 - chai: 4.3.7 8471 - debug: 4.3.4 8472 - happy-dom: 8.1.0 8473 - local-pkg: 0.4.2 8474 - source-map: 0.6.1 8475 - strip-literal: 1.0.0 8476 - tinybench: 2.3.1 8477 - tinypool: 0.3.0 8478 - tinyspy: 1.0.2 8479 - vite: 3.2.4_@types+node@18.11.9 8480 - vite-node: 0.26.1_@types+node@18.11.9 8124 + vite-node: 0.26.2_@types+node@18.11.9 8481 8125 transitivePeerDependencies: 8482 8126 - less 8483 8127 - sass ··· 8738 8382 dev: true 8739 8383 8740 8384 /xregexp/2.0.0: 8741 - resolution: {integrity: sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM=} 8385 + resolution: {integrity: sha512-xl/50/Cf32VsGq/1R8jJE5ajH1yMCQkpmoS10QbFZWl2Oor4H0Me64Pu2yxvsRWK3m6soJbmGfzSR7BYmDcWAA==} 8742 8386 dev: true 8743 8387 8744 8388 /xtend/4.0.2:
+1
playground/.gitignore
··· 6 6 .output 7 7 .env 8 8 dist 9 + coverage
+6 -2
playground/package.json
··· 1 1 { 2 2 "private": true, 3 + "type": "module", 3 4 "scripts": { 4 5 "build": "nuxt build", 5 6 "dev": "nuxt dev", 6 7 "generate": "nuxt generate", 7 8 "preview": "nuxt preview", 8 - "postinstall": "nuxt prepare" 9 + "postinstall": "nuxt prepare", 10 + "test:nuxt": "vitest -c vitest.config.nuxt.ts", 11 + "test:unit": "vitest -c vitest.config.unit.ts", 12 + "test": "pnpm test:unit --run && pnpm test:nuxt --run" 9 13 }, 10 14 "devDependencies": { 11 15 "nuxt": "^3.0.0", 12 - "vitest": "^0.24.5", 16 + "vitest": "^0.26.2", 13 17 "vitest-environment-nuxt": "latest" 14 18 } 15 19 }
-12
playground/vitest.config.mjs
··· 1 - import { defineConfigWithNuxtEnv } from 'vitest-environment-nuxt/config' 2 - 3 - export default defineConfigWithNuxtEnv({ 4 - // TODO: fix bug with stubbing root package 5 - resolve: { 6 - alias: { 7 - 'vitest-environment-nuxt/utils': '../src/utils', 8 - 'vitest-environment-nuxt/config': '../src/config', 9 - 'vitest-environment-nuxt': '../src/index', 10 - }, 11 - }, 12 - })
+19
playground/vitest.config.nuxt.ts
··· 1 + import { defineConfigWithNuxtEnv } from 'vitest-environment-nuxt/config' 2 + 3 + export default defineConfigWithNuxtEnv({ 4 + test: { 5 + name: 'nuxt', 6 + dir: 'tests/nuxt', 7 + coverage: { 8 + reportsDirectory: 'coverage/nuxt' 9 + } 10 + }, 11 + // TODO: fix bug with stubbing root package 12 + resolve: { 13 + alias: { 14 + 'vitest-environment-nuxt/utils': '../src/utils', 15 + 'vitest-environment-nuxt/config': '../src/config', 16 + 'vitest-environment-nuxt': '../src/index', 17 + }, 18 + }, 19 + })
+11
playground/vitest.config.unit.ts
··· 1 + import { defineConfig } from 'vitest/config' 2 + 3 + export default defineConfig({ 4 + test: { 5 + name: 'unit', 6 + dir: 'tests/unit', 7 + coverage: { 8 + reportsDirectory: 'coverage/unit' 9 + } 10 + } 11 + })
+7 -2
.github/workflows/ci.yml
··· 43 43 - name: 🛠 Build project 44 44 run: pnpm build 45 45 46 - - name: 🧪 Test project 47 - run: pnpm run test --coverage 46 + - name: 🧪 Playground Unit Test 47 + run: pnpm -C playground run test:unit --coverage 48 + 49 + - name: 🧪 Playground Nuxt Test 50 + run: pnpm -C playground run test:nuxt --coverage 48 51 49 52 - name: 🟩 Coverage 50 53 uses: codecov/codecov-action@v3 54 + with: 55 + files: playground/coverage/nuxt/cover.xml,playground/coverage/unit/cover.xml
-57
playground/tests/index.spec.ts
··· 1 - import { describe, it, expect } from 'vitest' 2 - 3 - import { mountSuspended, registerEndpoint } from 'vitest-environment-nuxt/utils' 4 - 5 - import App from '~/app.vue' 6 - import FetchComponent from '~/components/FetchComponent.vue' 7 - 8 - describe('client-side nuxt features', () => { 9 - it('can use core nuxt composables within test file', () => { 10 - expect(useAppConfig().hey).toMatchInlineSnapshot('false') 11 - }) 12 - 13 - it('can access auto-imported composables from within project', () => { 14 - const state = useSingleState() 15 - expect(state.value).toMatchInlineSnapshot('{}') 16 - state.value.field = 'new value' 17 - expect(state.value.field).toMatchInlineSnapshot('"new value"') 18 - expect(useSingleState().value.field).toMatchInlineSnapshot('"new value"') 19 - }) 20 - 21 - it('can access injections from nuxt plugins', () => { 22 - const app = useNuxtApp() 23 - expect(app.$auth.didInject).toMatchInlineSnapshot('true') 24 - expect(app.$router).toBeDefined() 25 - }) 26 - 27 - it.todo('defaults to index page', async () => { 28 - expect(useRoute().matched[0].meta).toMatchInlineSnapshot(` 29 - {} 30 - `) 31 - expect(useRoute().fullPath).toMatchInlineSnapshot('"/blank"') 32 - // TODO: should it be possible to push to other routes? 33 - }) 34 - }) 35 - 36 - describe('test utils', () => { 37 - it('can mount components within nuxt suspense', async () => { 38 - const component = await mountSuspended(App) 39 - expect(component.html()).toMatchInlineSnapshot(` 40 - "<div>This is an auto-imported component</div> 41 - <!-- TODO: <NuxtPage /> --> 42 - <a href=\\"/test\\">Test link</a>" 43 - `) 44 - }) 45 - 46 - it('can mock fetch requests', async () => { 47 - registerEndpoint('https://jsonplaceholder.typicode.com/todos/1', () => ({ 48 - title: 'title from mocked api', 49 - })) 50 - const component = await mountSuspended(FetchComponent) 51 - expect(component.html()).toMatchInlineSnapshot('"<div>title from mocked api</div>"') 52 - }) 53 - 54 - // TODO: make working with router - currently router components are not 55 - // registered and route symbol is not injected 56 - it.todo('handles nuxt routing') 57 - })
+57
playground/tests/nuxt/index.spec.ts
··· 1 + import { describe, it, expect } from 'vitest' 2 + 3 + import { mountSuspended, registerEndpoint } from 'vitest-environment-nuxt/utils' 4 + 5 + import App from '~/app.vue' 6 + import FetchComponent from '~/components/FetchComponent.vue' 7 + 8 + describe('client-side nuxt features', () => { 9 + it('can use core nuxt composables within test file', () => { 10 + expect(useAppConfig().hey).toMatchInlineSnapshot('false') 11 + }) 12 + 13 + it('can access auto-imported composables from within project', () => { 14 + const state = useSingleState() 15 + expect(state.value).toMatchInlineSnapshot('{}') 16 + state.value.field = 'new value' 17 + expect(state.value.field).toMatchInlineSnapshot('"new value"') 18 + expect(useSingleState().value.field).toMatchInlineSnapshot('"new value"') 19 + }) 20 + 21 + it('can access injections from nuxt plugins', () => { 22 + const app = useNuxtApp() 23 + expect(app.$auth.didInject).toMatchInlineSnapshot('true') 24 + expect(app.$router).toBeDefined() 25 + }) 26 + 27 + it.todo('defaults to index page', async () => { 28 + expect(useRoute().matched[0].meta).toMatchInlineSnapshot(` 29 + {} 30 + `) 31 + expect(useRoute().fullPath).toMatchInlineSnapshot('"/blank"') 32 + // TODO: should it be possible to push to other routes? 33 + }) 34 + }) 35 + 36 + describe('test utils', () => { 37 + it('can mount components within nuxt suspense', async () => { 38 + const component = await mountSuspended(App) 39 + expect(component.html()).toMatchInlineSnapshot(` 40 + "<div>This is an auto-imported component</div> 41 + <!-- TODO: <NuxtPage /> --> 42 + <a href=\\"/test\\">Test link</a>" 43 + `) 44 + }) 45 + 46 + it('can mock fetch requests', async () => { 47 + registerEndpoint('https://jsonplaceholder.typicode.com/todos/1', () => ({ 48 + title: 'title from mocked api', 49 + })) 50 + const component = await mountSuspended(FetchComponent) 51 + expect(component.html()).toMatchInlineSnapshot('"<div>title from mocked api</div>"') 52 + }) 53 + 54 + // TODO: make working with router - currently router components are not 55 + // registered and route symbol is not injected 56 + it.todo('handles nuxt routing') 57 + })
+5
playground/tests/unit/index.spec.ts
··· 1 + import { it, expect } from 'vitest' 2 + 3 + it('unit test', () => { 4 + expect(typeof window).toBe('undefined') 5 + })