This repository has been archived on 2022-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
gitea/vitest.config.js
silverwind 37ca4cb7d6
Remove vitest globals (#21505)
Explicitly import them instead which is cleaner and enables better
editor integration.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-10-19 14:50:19 +08:00

33 lines
734 B
JavaScript

import {defineConfig} from 'vitest/dist/config.js';
import {readFile} from 'fs/promises';
import {dataToEsm} from '@rollup/pluginutils';
import {extname} from 'path';
function stringPlugin() {
return {
name: 'string-plugin',
enforce: 'pre',
async load(id) {
const path = id.split('?')[0];
if (extname(path) !== '.svg') return null;
return dataToEsm(await readFile(path, 'utf8'));
}
};
}
export default defineConfig({
test: {
include: ['web_src/**/*.test.js'],
setupFiles: ['./web_src/js/test/setup.js'],
environment: 'jsdom',
testTimeout: 20000,
open: false,
allowOnly: true,
passWithNoTests: true,
watch: false,
},
plugins: [
stringPlugin(),
],
});