generated from League-of-Foundry-Developers/FoundryVTT-Module-Template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathjest.config.ts
48 lines (45 loc) · 1.61 KB
/
jest.config.ts
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
import { compilerOptions } from './tsconfig.json';
import type { Config } from 'jest';
import { pathsToModuleNameMapper } from 'ts-jest';
const config: Config = {
collectCoverageFrom: ['src/**/*.{svelte,ts,js}'],
coveragePathIgnorePatterns: [
'<rootDir>/src/main.ts', // Because execution part is hard to test
'<rootDir>/src/services/game.ts', // Because its an implementation detail of foundry, non-testable
'<rootDir>/src/services/raw.ts', // Because its an implementation detail of SyrinScape, non-testable
'<rootDir>/src/socket.ts', // Because it has almost no logic, instead it's just a glue-code for socketlib
'<rootDir>/src/proxies.ts', // Because it has no logic, instead it's just a glue-code for foundry documents
'<rootDir>/src/ui/dialog-impl.ts', // Because its just a glue for foundry
// Because those have only imports and Jest-TS doesnt handle those very well:
'<rootDir>/src/models/index.ts',
// Because those two are test infrastructure:
'<rootDir>/src/components/WithSyrinContext.svelte',
'<rootDir>/src/mock.ts'
],
coverageThreshold: {
global: {
branches: 40,
functions: 60,
lines: 75,
statements: 75
}
},
moduleFileExtensions: ['js', 'ts', 'svelte', 'node'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
testEnvironment: 'jsdom',
transform: {
'^.+\\.svelte$': [
'svelte-jester',
{
preprocess: true
}
],
'^.+\\.ts$': 'ts-jest',
'^.+\\.js$': 'babel-jest'
},
modulePathIgnorePatterns: ['<rootDir>/cypress'],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>' + compilerOptions.baseUrl
})
};
export default config;