2 * For a detailed explanation regarding each configuration property, visit:
3 * https://jestjs.io/docs/configuration
6 import type {Config} from 'jest';
7 import {pathsToModuleNameMapper} from "ts-jest";
8 import { compilerOptions } from './tsconfig.json';
10 const config: Config = {
11 // All imported modules in your tests should be mocked automatically
14 // Stop running tests after `n` failures
17 // The directory where Jest should store its cached dependency information
18 // cacheDirectory: "/tmp/jest_rs",
20 // Automatically clear mock calls, instances, contexts and results before every test
23 // Indicates whether the coverage information should be collected while executing the test
24 collectCoverage: true,
26 // An array of glob patterns indicating a set of files for which coverage information should be collected
27 // collectCoverageFrom: undefined,
29 // The directory where Jest should output its coverage files
30 coverageDirectory: "coverage",
32 // An array of regexp pattern strings used to skip coverage collection
33 // coveragePathIgnorePatterns: [
37 // Indicates which provider should be used to instrument code for coverage
38 coverageProvider: "v8",
40 // A list of reporter names that Jest uses when writing coverage reports
41 // coverageReporters: [
48 // An object that configures minimum threshold enforcement for coverage results
49 // coverageThreshold: undefined,
51 // A path to a custom dependency extractor
52 // dependencyExtractor: undefined,
54 // Make calling deprecated APIs throw helpful error messages
55 // errorOnDeprecated: false,
57 // The default configuration for fake timers
59 // "enableGlobally": false
62 // Force coverage collection from ignored files using an array of glob patterns
63 // forceCoverageMatch: [],
65 // A path to a module which exports an async function that is triggered once before all test suites
66 // globalSetup: undefined,
68 // A path to a module which exports an async function that is triggered once after all test suites
69 // globalTeardown: undefined,
71 // A set of global variables that need to be available in all test environments
76 // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
79 // An array of directory names to be searched recursively up from the requiring module's location
80 // moduleDirectories: [
84 // An array of file extensions your modules use
85 // moduleFileExtensions: [
96 modulePaths: ['/home/dan/web/bookstack/'],
98 // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
99 moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
101 // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
102 // modulePathIgnorePatterns: [],
104 // Activates notifications for test results
107 // An enum that specifies notification mode. Requires { notify: true }
108 // notifyMode: "failure-change",
110 // A preset that is used as a base for Jest's configuration
111 // preset: undefined,
113 // Run tests from one or more projects
114 // projects: undefined,
116 // Use this configuration option to add custom reporters to Jest
117 // reporters: undefined,
119 // Automatically reset mock state before every test
120 // resetMocks: false,
122 // Reset the module registry before running each individual test
123 // resetModules: false,
125 // A path to a custom resolver
126 // resolver: undefined,
128 // Automatically restore mock state and implementation before every test
129 // restoreMocks: false,
131 // The root directory that Jest should scan for tests and modules within
132 // rootDir: undefined,
134 // A list of paths to directories that Jest should use to search for files in
139 // Allows you to use a custom runner instead of Jest's default test runner
140 // runner: "jest-runner",
142 // The paths to modules that run some code to configure or set up the testing environment before each test
145 // A list of paths to modules that run some code to configure or set up the testing framework before each test
146 // setupFilesAfterEnv: [],
148 // The number of seconds after which a test is considered as slow and reported as such in the results.
149 // slowTestThreshold: 5,
151 // A list of paths to snapshot serializer modules Jest should use for snapshot testing
152 // snapshotSerializers: [],
154 // The test environment that will be used for testing
155 testEnvironment: "jsdom",
157 // Options that will be passed to the testEnvironment
158 // testEnvironmentOptions: {},
160 // Adds a location field to test results
161 // testLocationInResults: false,
163 // The glob patterns Jest uses to detect test files
165 // "**/__tests__/**/*.[jt]s?(x)",
166 // "**/?(*.)+(spec|test).[tj]s?(x)"
169 // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
170 // testPathIgnorePatterns: [
174 // The regexp pattern or array of patterns that Jest uses to detect test files
177 // This option allows the use of a custom results processor
178 // testResultsProcessor: undefined,
180 // This option allows use of a custom test runner
181 // testRunner: "jest-circus/runner",
183 // A map from regular expressions to paths to transformers
185 "^.+.tsx?$": ["ts-jest",{}],
188 // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
189 // transformIgnorePatterns: [
191 // "\\.pnp\\.[^\\/]+$"
194 // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
195 // unmockedModulePathPatterns: undefined,
197 // Indicates whether each individual test should be reported during the run
198 // verbose: undefined,
200 // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
201 // watchPathIgnorePatterns: [],
203 // Whether to use watchman for file crawling
207 export default config;