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: false,
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: [
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
100 'lexical/shared/invariant': 'resources/js/wysiwyg/lexical/core/shared/__mocks__/invariant',
101 ...pathsToModuleNameMapper(compilerOptions.paths),
104 // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
105 // modulePathIgnorePatterns: [],
107 // Activates notifications for test results
110 // An enum that specifies notification mode. Requires { notify: true }
111 // notifyMode: "failure-change",
113 // A preset that is used as a base for Jest's configuration
114 // preset: undefined,
116 // Run tests from one or more projects
117 // projects: undefined,
119 // Use this configuration option to add custom reporters to Jest
120 // reporters: undefined,
122 // Automatically reset mock state before every test
123 // resetMocks: false,
125 // Reset the module registry before running each individual test
126 // resetModules: false,
128 // A path to a custom resolver
129 // resolver: undefined,
131 // Automatically restore mock state and implementation before every test
132 // restoreMocks: false,
134 // The root directory that Jest should scan for tests and modules within
135 // rootDir: undefined,
137 // A list of paths to directories that Jest should use to search for files in
142 // Allows you to use a custom runner instead of Jest's default test runner
143 // runner: "jest-runner",
145 // The paths to modules that run some code to configure or set up the testing environment before each test
148 // A list of paths to modules that run some code to configure or set up the testing framework before each test
149 // setupFilesAfterEnv: [],
151 // The number of seconds after which a test is considered as slow and reported as such in the results.
152 // slowTestThreshold: 5,
154 // A list of paths to snapshot serializer modules Jest should use for snapshot testing
155 // snapshotSerializers: [],
157 // The test environment that will be used for testing
158 testEnvironment: "jsdom",
160 // Options that will be passed to the testEnvironment
161 // testEnvironmentOptions: {},
163 // Adds a location field to test results
164 // testLocationInResults: false,
166 // The glob patterns Jest uses to detect test files
168 "**/__tests__/**/*.test.[jt]s",
171 // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
172 // testPathIgnorePatterns: [
176 // The regexp pattern or array of patterns that Jest uses to detect test files
179 // This option allows the use of a custom results processor
180 // testResultsProcessor: undefined,
182 // This option allows use of a custom test runner
183 // testRunner: "jest-circus/runner",
185 // A map from regular expressions to paths to transformers
187 "^.+.tsx?$": ["ts-jest",{}],
188 "^.+.svg$": ["<rootDir>/dev/build/svg-blank-transform.js",{}],
191 // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
192 // transformIgnorePatterns: [
194 // "\\.pnp\\.[^\\/]+$"
197 // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
198 // unmockedModulePathPatterns: undefined,
200 // Indicates whether each individual test should be reported during the run
201 // verbose: undefined,
203 // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
204 // watchPathIgnorePatterns: [],
206 // Whether to use watchman for file crawling
210 export default config;