forked from hyperledger/identus-edge-agent-sdk-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvitest.config.mjs
58 lines (51 loc) · 1.29 KB
/
vitest.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/// <reference types="vitest" />
import { defineConfig } from 'vite'
import { getWasmJSContent } from './esbuild.base.mjs';
const isCI = process.env.CI === "true";
function WasmPlugin() {
return {
name: 'wasm-plugin',
resolveId: (source, importer) =>
source.endsWith('.wasm') ?
path.resolve(path.dirname(importer), source) :
null,
load: (id) => id.endsWith('.wasm') ?
getWasmJSContent(id) :
null,
};
}
const testConfig = {
setupFiles: ['./tests/setup.ts'],
reporters: ['verbose'],
coverage: {
provider: 'istanbul',
reporter: isCI ? ['json-summary', 'lcov'] : ['json-summary', "html"],
thresholds: {
"branches": 63,
"functions": 75,
"lines": 75,
"statements": 75
},
include: [
'src'
],
exclude: [
'src/castor/protos',
'src/domain/models/errors'
]
},
}
export default defineConfig({
plugins: [
WasmPlugin(),
],
resolve: {
extensions: ['.ts', '.js', '.wasm'],
mainFields: ['module', 'main'],
},
test: {
...testConfig,
environment: 'jsdom',
include: ['tests/**/*.test.ts'],
},
})