Skip to content

Commit

Permalink
🔧 vitest - vuetify 설정
Browse files Browse the repository at this point in the history
- import jest-dom
  • Loading branch information
padosum committed Feb 25, 2023
1 parent ecc5c3e commit a55886f
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
33 changes: 33 additions & 0 deletions vitest.config.ts
@@ -0,0 +1,33 @@
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vitest/config';
import vue from '@vitejs/plugin-vue';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
{
name: 'vitest-plugin-beforeall',
config: () => ({
test: {
setupFiles: [
fileURLToPath(new URL('./vitest/beforeAll.ts', import.meta.url)),
],
},
}),
},
vue(),
],

resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
test: {
globals: true,
environment: 'jsdom',
deps: {
inline: ['vuetify'],
},
},
});
27 changes: 27 additions & 0 deletions vitest/beforeAll.ts
@@ -0,0 +1,27 @@
import '@testing-library/jest-dom';
import { beforeAll } from 'vitest';

(global as any).CSS = { supports: () => false };

beforeAll(() => {
global.CSS = {
supports: () => false,
escape: (str: string) => str,
};
});

class ResizeObserverStub {
observe() {
// do nothing
}
unobserve() {
// do nothing
}
disconnect() {
// do nothing
}
}

if (typeof window !== 'undefined') {
window.ResizeObserver = window.ResizeObserver || ResizeObserverStub;
}

0 comments on commit a55886f

Please sign in to comment.