Merge pull request #294 from appwrite/test-improve-config

test: improve vite config
This commit is contained in:
Torsten Dittmann authored and GitHub committed 2023-02-14 10:05:32 +01:00
commit 99772f4301
2 files changed
+14 -6

No files matched your search

-5
View File
@@ -1,15 +1,10 @@
import { vi } from 'vitest';
import * as svelteinternal from 'svelte/internal';
beforeAll(() => {
vi.mock('$app/environment', () => ({
browser: true
}));
vi.mock('$app/stores', () => ({
page: null
}));
vi.mock('$app/navigation', () => ({
goto: vi.fn()
}));
vi.mock('svelte', () => svelteinternal);
});
+14 -1
View File
@@ -17,6 +17,14 @@ const config = {
},
server: {
port: 3000
}
};
/** @type {import('vite').UserConfig} */
const testConfig = {
resolve: {
// hotfix for https://github.com/vitest-dev/vitest/issues/2834
conditions: ['browser']
},
test: {
include: ['tests/**/*.test.ts'],
@@ -30,4 +38,9 @@ const config = {
}
};
export default config;
export default process.env.VITEST
? {
...config,
...testConfig
}
: config;