We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 864e435 commit 6b69fecCopy full SHA for 6b69fec
packages/sveltekit/.empty.js
@@ -0,0 +1,2 @@
1
+// Hack to get $app/stores import working (can't mock it in tests if path is not resolvable).
2
+// See: https://github.com/vitest-dev/vitest/issues/4630
packages/sveltekit/vite.config.ts
@@ -1,3 +1,6 @@
+import { dirname, resolve } from 'path';
+import { fileURLToPath } from 'url';
3
+
4
import type { UserConfig } from 'vitest';
5
6
import baseConfig from '../../vite/vite.config';
@@ -10,5 +13,11 @@ export default {
10
13
...(baseConfig as UserConfig & { test: any }).test,
11
14
environment: 'jsdom',
12
15
setupFiles: ['./test/vitest.setup.ts'],
16
+ alias: [
17
+ {
18
+ find: '$app/stores',
19
+ replacement: resolve(fileURLToPath(dirname(import.meta.url)), '/.empty.js'),
20
+ },
21
+ ],
22
},
23
};
0 commit comments