You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.3 KiB
90 lines
2.3 KiB
const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
|
|
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**", "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.*"];
|
|
const defaultCoverageExcludes = [
|
|
"coverage/**",
|
|
"dist/**",
|
|
"packages/*/test{,s}/**",
|
|
"**/*.d.ts",
|
|
"cypress/**",
|
|
"test{,s}/**",
|
|
"test{,-*}.{js,cjs,mjs,ts,tsx,jsx}",
|
|
"**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}",
|
|
"**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}",
|
|
"**/__tests__/**",
|
|
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.*",
|
|
"**/.{eslint,mocha,prettier}rc.{js,cjs,yml}"
|
|
];
|
|
const coverageConfigDefaults = {
|
|
all: false,
|
|
provider: "c8",
|
|
enabled: false,
|
|
clean: true,
|
|
cleanOnRerun: true,
|
|
reportsDirectory: "./coverage",
|
|
excludeNodeModules: true,
|
|
exclude: defaultCoverageExcludes,
|
|
reporter: ["text", "html", "clover", "json"],
|
|
allowExternal: false,
|
|
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
};
|
|
const fakeTimersDefaults = {
|
|
loopLimit: 1e4,
|
|
shouldClearNativeTimers: true,
|
|
toFake: [
|
|
"setTimeout",
|
|
"clearTimeout",
|
|
"setInterval",
|
|
"clearInterval",
|
|
"setImmediate",
|
|
"clearImmediate",
|
|
"Date"
|
|
]
|
|
};
|
|
const config = {
|
|
allowOnly: !process.env.CI,
|
|
watch: !process.env.CI,
|
|
globals: false,
|
|
environment: "node",
|
|
threads: true,
|
|
clearMocks: false,
|
|
restoreMocks: false,
|
|
mockReset: false,
|
|
include: defaultInclude,
|
|
exclude: defaultExclude,
|
|
testTimeout: 5e3,
|
|
hookTimeout: 1e4,
|
|
teardownTimeout: 1e3,
|
|
isolate: true,
|
|
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
forceRerunTriggers: [
|
|
"**/package.json/**",
|
|
"**/{vitest,vite}.config.*/**"
|
|
],
|
|
update: false,
|
|
reporters: [],
|
|
silent: false,
|
|
api: false,
|
|
ui: false,
|
|
uiBase: "/__vitest__/",
|
|
open: true,
|
|
css: {
|
|
include: []
|
|
},
|
|
coverage: coverageConfigDefaults,
|
|
fakeTimers: fakeTimersDefaults,
|
|
maxConcurrency: 5,
|
|
dangerouslyIgnoreUnhandledErrors: false,
|
|
typecheck: {
|
|
checker: "tsc",
|
|
include: ["**/*.{test,spec}-d.{ts,js}"],
|
|
exclude: defaultExclude
|
|
},
|
|
slowTestThreshold: 300
|
|
};
|
|
const configDefaults = Object.freeze(config);
|
|
|
|
function defineConfig(config) {
|
|
return config;
|
|
}
|
|
|
|
export { configDefaults, defaultExclude, defaultInclude, defineConfig };
|
|
|