Skip to content

Commit

Permalink
fix(vite): generate vitest cache dir scoped to each project root and …
Browse files Browse the repository at this point in the history
…normalize vite cache dir
  • Loading branch information
leosvelperez committed May 13, 2024
1 parent 7561e71 commit 8a636ac
Show file tree
Hide file tree
Showing 24 changed files with 218 additions and 1,230 deletions.
12 changes: 6 additions & 6 deletions docs/shared/packages/vite/configure-vite.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ If you're using `vitest`, make sure your `test` object in your `vite.config.ts`
test: {
globals: true,
cache: {
dir: '../node_modules/.vitest',
dir: '../node_modules/.vitest/<project-root>',
},
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
Expand Down Expand Up @@ -124,7 +124,7 @@ export default defineConfig({
transformMixedEsModules: true,
},
},
cacheDir: '../../node_modules/.vite/my-app',
cacheDir: '../../node_modules/.vite/apps/my-app',
server: {
port: 4200,
host: 'localhost',
Expand All @@ -145,7 +145,7 @@ export default defineConfig({
},
globals: true,
cache: {
dir: '../../node_modules/.vitest',
dir: '../../node_modules/.vitest/apps/my-app',
},
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
Expand Down Expand Up @@ -180,7 +180,7 @@ export default defineConfig({
// Configuration for building your library.
// See: https://vitejs.dev/guide/build.html#library-mode
build: {
outDir: '../dist/my-lib',
outDir: '../dist/libs/my-lib',
reportCompressedSize: true,
commonjsOptions: {
transformMixedEsModules: true,
Expand All @@ -202,13 +202,13 @@ export default defineConfig({
test: {
globals: true,
cache: {
dir: '../node_modules/.vitest',
dir: '../node_modules/.vitest/libs/my-lib',
},
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: '../coverage/my-lib',
reportsDirectory: '../coverage/libs/my-lib',
provider: 'v8',
},
},
Expand Down
4 changes: 2 additions & 2 deletions docs/shared/recipes/add-stack/add-solid.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ import solidPlugin from 'vite-plugin-solid';
import viteTsConfigPaths from 'vite-tsconfig-paths';

export default defineConfig({
cacheDir: '../../node_modules/.vite/my-solid-app',
cacheDir: '../../node_modules/.vite/apps/my-solid-app',

server: {
port: 3000,
Expand Down Expand Up @@ -187,7 +187,7 @@ export default defineConfig({
test: {
globals: true,
cache: {
dir: '../../node_modules/.vitest',
dir: '../../node_modules/.vitest/apps/my-solid-app',
},
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default defineConfig({
test: {
globals: true,
cache: {
dir: '../node_modules/.vitest',
dir: '../node_modules/.vitest/my-lib',
},
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default defineConfig({
test: {
globals: true,
cache: {
dir: '../node_modules/.vitest',
dir: '../node_modules/.vitest/my-app',
},
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
Expand Down
Loading

0 comments on commit 8a636ac

Please sign in to comment.