-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathjest.config.mjs
More file actions
55 lines (53 loc) · 2.33 KB
/
Copy pathjest.config.mjs
File metadata and controls
55 lines (53 loc) · 2.33 KB
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
import { existsSync } from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const localSolidLogicIndex = path.resolve(__dirname, '../solid-logic/src/index.ts')
const useLocalSolidLogic = existsSync(localSolidLogicIndex)
export default {
collectCoverage: true,
coverageDirectory: 'coverage',
preset: 'ts-jest/presets/js-with-babel',
testEnvironment: 'jsdom',
setupFiles: ['./test/helpers/globals.js'],
testEnvironmentOptions: {
customExportConditions: ['node']
},
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
transform: {
'^.+\\.[tj]sx?$': ['babel-jest', { configFile: './babel.config.mjs' }],
},
transformIgnorePatterns: ['/node_modules/(?!lit-html).+\\.js'],
moduleNameMapper: {
'^SolidLogic$': 'solid-logic',
'^UI$': 'solid-ui',
'^\\$rdf$': 'rdflib',
'\\.svg\\?raw$': '<rootDir>/test/__mocks__/fileMock.js',
'\\.(svg)$': '<rootDir>/test/__mocks__/fileMock.js',
'\\.(png|jpe?g|gif|webp|avif)$': '<rootDir>/test/__mocks__/fileMock.js',
'\\.css$': '<rootDir>/test/__mocks__/styleMock.js',
...(useLocalSolidLogic ? { '^solid-logic$': localSolidLogicIndex } : {}),
'^@uvdsl/solid-oidc-client-browser$': '<rootDir>/test/mocks/solid-oidc-client-browser.ts',
'^@uvdsl/solid-oidc-client-browser/core$': '<rootDir>/test/mocks/solid-oidc-client-browser.ts',
'^solid-oidc-client-browser$': '<rootDir>/test/mocks/solid-oidc-client-browser.ts'
},
setupFilesAfterEnv: ['./test/helpers/setup.ts'],
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],
roots: ['<rootDir>/src', '<rootDir>/test'],
// For some reason Jest is not measuring coverage without the below option.
// Unfortunately, despite `!(.test)`, it still measures coverage of test files as well:
// forceCoverageMatch: ['./src/**/*!(.test).ts'],
// Since we're only measuring coverage for TypeScript (i.e. added with test infrastructure in place),
// we can be fairly strict. However, if you feel that something is not fit for coverage,
// mention why in a comment and mark it as ignored:
// https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md
/* coverageThreshold: {
global: {
branches: 10,
functions: 25,
lines: 20,
statements: 20
}
} */
}