Skip to content

Commit 06c72fd

Browse files
chore: alias cache server for vitest
Co-authored-by: me <me@kentcdodds.com>
1 parent ab3afcc commit 06c72fd

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

vite.config.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ export default defineConfig((config) => {
4242
resolve: {
4343
alias:
4444
isTest
45-
? {
46-
'#app/utils/cache.server.ts': path.resolve(
47-
'tests/mocks/cache-server.ts',
48-
),
49-
}
45+
? [
46+
{
47+
find: /cache\.server\.ts$/,
48+
replacement: path.resolve('tests/mocks/cache-server.ts'),
49+
},
50+
]
5051
: undefined,
5152
},
5253
sentryConfig,
@@ -70,9 +71,12 @@ export default defineConfig((config) => {
7071
: null,
7172
],
7273
test: {
73-
alias: {
74-
'#app/utils/cache.server.ts': path.resolve('tests/mocks/cache-server.ts'),
75-
},
74+
alias: [
75+
{
76+
find: /cache\.server\.ts$/,
77+
replacement: path.resolve('tests/mocks/cache-server.ts'),
78+
},
79+
],
7680
include: ['./app/**/*.test.{ts,tsx}'],
7781
setupFiles: ['./tests/setup/setup-test-env.ts'],
7882
globalSetup: ['./tests/setup/global-setup.ts'],

0 commit comments

Comments
 (0)