]> BookStack Code Mirror - bookstack/blob - jest.config.ts
Merge pull request #5607 from BookStackApp/system_info_endpoint
[bookstack] / jest.config.ts
1 /**
2  * For a detailed explanation regarding each configuration property, visit:
3  * https://jestjs.io/docs/configuration
4  */
5
6 import type {Config} from 'jest';
7 import {pathsToModuleNameMapper} from "ts-jest";
8 import { compilerOptions }  from './tsconfig.json';
9
10 const config: Config = {
11   // All imported modules in your tests should be mocked automatically
12   // automock: false,
13
14   // Stop running tests after `n` failures
15   // bail: 0,
16
17   // The directory where Jest should store its cached dependency information
18   // cacheDirectory: "/tmp/jest_rs",
19
20   // Automatically clear mock calls, instances, contexts and results before every test
21   clearMocks: true,
22
23   // Indicates whether the coverage information should be collected while executing the test
24   collectCoverage: false,
25
26   // An array of glob patterns indicating a set of files for which coverage information should be collected
27   // collectCoverageFrom: undefined,
28
29   // The directory where Jest should output its coverage files
30   coverageDirectory: "coverage",
31
32   // An array of regexp pattern strings used to skip coverage collection
33   // coveragePathIgnorePatterns: [
34   //   "/node_modules/"
35   // ],
36
37   // Indicates which provider should be used to instrument code for coverage
38   coverageProvider: "v8",
39
40   // A list of reporter names that Jest uses when writing coverage reports
41   // coverageReporters: [
42   //   "json",
43   //   "text",
44   //   "lcov",
45   //   "clover"
46   // ],
47
48   // An object that configures minimum threshold enforcement for coverage results
49   // coverageThreshold: undefined,
50
51   // A path to a custom dependency extractor
52   // dependencyExtractor: undefined,
53
54   // Make calling deprecated APIs throw helpful error messages
55   // errorOnDeprecated: false,
56
57   // The default configuration for fake timers
58   // fakeTimers: {
59   //   "enableGlobally": false
60   // },
61
62   // Force coverage collection from ignored files using an array of glob patterns
63   // forceCoverageMatch: [],
64
65   // A path to a module which exports an async function that is triggered once before all test suites
66   // globalSetup: undefined,
67
68   // A path to a module which exports an async function that is triggered once after all test suites
69   // globalTeardown: undefined,
70
71   // A set of global variables that need to be available in all test environments
72   globals: {
73     __DEV__: true,
74   },
75
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.
77   // maxWorkers: "50%",
78
79   // An array of directory names to be searched recursively up from the requiring module's location
80   // moduleDirectories: [
81   //   "node_modules"
82   // ],
83
84   // An array of file extensions your modules use
85   // moduleFileExtensions: [
86   //   "js",
87   //   "mjs",
88   //   "cjs",
89   //   "jsx",
90   //   "ts",
91   //   "tsx",
92   //   "json",
93   //   "node"
94   // ],
95
96   modulePaths: ['./'],
97
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: {
100     'lexical/shared/invariant': 'resources/js/wysiwyg/lexical/core/shared/__mocks__/invariant',
101     ...pathsToModuleNameMapper(compilerOptions.paths),
102   },
103
104   // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
105   // modulePathIgnorePatterns: [],
106
107   // Activates notifications for test results
108   // notify: false,
109
110   // An enum that specifies notification mode. Requires { notify: true }
111   // notifyMode: "failure-change",
112
113   // A preset that is used as a base for Jest's configuration
114   // preset: undefined,
115
116   // Run tests from one or more projects
117   // projects: undefined,
118
119   // Use this configuration option to add custom reporters to Jest
120   // reporters: undefined,
121
122   // Automatically reset mock state before every test
123   // resetMocks: false,
124
125   // Reset the module registry before running each individual test
126   // resetModules: false,
127
128   // A path to a custom resolver
129   // resolver: undefined,
130
131   // Automatically restore mock state and implementation before every test
132   // restoreMocks: false,
133
134   // The root directory that Jest should scan for tests and modules within
135   // rootDir: undefined,
136
137   // A list of paths to directories that Jest should use to search for files in
138   roots: [
139     "./resources/js"
140   ],
141
142   // Allows you to use a custom runner instead of Jest's default test runner
143   // runner: "jest-runner",
144
145   // The paths to modules that run some code to configure or set up the testing environment before each test
146   // setupFiles: [],
147
148   // A list of paths to modules that run some code to configure or set up the testing framework before each test
149   // setupFilesAfterEnv: [],
150
151   // The number of seconds after which a test is considered as slow and reported as such in the results.
152   // slowTestThreshold: 5,
153
154   // A list of paths to snapshot serializer modules Jest should use for snapshot testing
155   // snapshotSerializers: [],
156
157   // The test environment that will be used for testing
158   testEnvironment: "jsdom",
159
160   // Options that will be passed to the testEnvironment
161   // testEnvironmentOptions: {},
162
163   // Adds a location field to test results
164   // testLocationInResults: false,
165
166   // The glob patterns Jest uses to detect test files
167   testMatch: [
168     "**/__tests__/**/*.test.[jt]s",
169   ],
170
171   // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
172   // testPathIgnorePatterns: [
173   //   "/node_modules/"
174   // ],
175
176   // The regexp pattern or array of patterns that Jest uses to detect test files
177   // testRegex: [],
178
179   // This option allows the use of a custom results processor
180   // testResultsProcessor: undefined,
181
182   // This option allows use of a custom test runner
183   // testRunner: "jest-circus/runner",
184
185   // A map from regular expressions to paths to transformers
186   transform: {
187     "^.+.tsx?$": ["ts-jest",{}],
188     "^.+.svg$": ["<rootDir>/dev/build/svg-blank-transform.js",{}],
189   },
190
191   // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
192   // transformIgnorePatterns: [
193   //   "/node_modules/",
194   //   "\\.pnp\\.[^\\/]+$"
195   // ],
196
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,
199
200   // Indicates whether each individual test should be reported during the run
201   // verbose: undefined,
202
203   // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
204   // watchPathIgnorePatterns: [],
205
206   // Whether to use watchman for file crawling
207   // watchman: true,
208 };
209
210 export default config;
Morty Proxy This is a proxified and sanitized view of the page, visit original site.