Skip to content

Commit

Permalink
Merge pull request #294 from appwrite/test-improve-config
Browse files Browse the repository at this point in the history
test: improve vite config
  • Loading branch information
TorstenDittmann authored Feb 14, 2023
2 parents c2c752e + 7772703 commit 99772f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
5 changes: 0 additions & 5 deletions tests/unit/setup.ts
Original file line number Diff line number Diff line change
@@ -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);
});
15 changes: 14 additions & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -30,4 +38,9 @@ const config = {
}
};

export default config;
export default process.env.VITEST
? {
...config,
...testConfig
}
: config;

1 comment on commit 99772f4

@vercel
Copy link

@vercel vercel bot commented on 99772f4 Feb 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.