Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- import jest-dom
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'], | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |