Skip to content

Commit 99772f4

Browse files
Merge pull request #294 from appwrite/test-improve-config
test: improve vite config
2 parents c2c752e + 7772703 commit 99772f4

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

tests/unit/setup.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import { vi } from 'vitest';
2-
import * as svelteinternal from 'svelte/internal';
32

43
beforeAll(() => {
54
vi.mock('$app/environment', () => ({
65
browser: true
76
}));
8-
vi.mock('$app/stores', () => ({
9-
page: null
10-
}));
117
vi.mock('$app/navigation', () => ({
128
goto: vi.fn()
139
}));
14-
vi.mock('svelte', () => svelteinternal);
1510
});

vite.config.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ const config = {
1717
},
1818
server: {
1919
port: 3000
20+
}
21+
};
22+
23+
/** @type {import('vite').UserConfig} */
24+
const testConfig = {
25+
resolve: {
26+
// hotfix for https://github.com/vitest-dev/vitest/issues/2834
27+
conditions: ['browser']
2028
},
2129
test: {
2230
include: ['tests/**/*.test.ts'],
@@ -30,4 +38,9 @@ const config = {
3038
}
3139
};
3240

33-
export default config;
41+
export default process.env.VITEST
42+
? {
43+
...config,
44+
...testConfig
45+
}
46+
: config;

0 commit comments

Comments
 (0)