]> BookStack Code Mirror - bookstack/blob - jest.config.ts
Lexical: Imported core lexical libs
[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: true,
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: ['/home/dan/web/bookstack/'],
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: pathsToModuleNameMapper(compilerOptions.paths),
100
101   // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
102   // modulePathIgnorePatterns: [],
103
104   // Activates notifications for test results
105   // notify: false,
106
107   // An enum that specifies notification mode. Requires { notify: true }
108   // notifyMode: "failure-change",
109
110   // A preset that is used as a base for Jest's configuration
111   // preset: undefined,
112
113   // Run tests from one or more projects
114   // projects: undefined,
115
116   // Use this configuration option to add custom reporters to Jest
117   // reporters: undefined,
118
119   // Automatically reset mock state before every test
120   // resetMocks: false,
121
122   // Reset the module registry before running each individual test
123   // resetModules: false,
124
125   // A path to a custom resolver
126   // resolver: undefined,
127
128   // Automatically restore mock state and implementation before every test
129   // restoreMocks: false,
130
131   // The root directory that Jest should scan for tests and modules within
132   // rootDir: undefined,
133
134   // A list of paths to directories that Jest should use to search for files in
135   roots: [
136     "./resources/js"
137   ],
138
139   // Allows you to use a custom runner instead of Jest's default test runner
140   // runner: "jest-runner",
141
142   // The paths to modules that run some code to configure or set up the testing environment before each test
143   // setupFiles: [],
144
145   // A list of paths to modules that run some code to configure or set up the testing framework before each test
146   // setupFilesAfterEnv: [],
147
148   // The number of seconds after which a test is considered as slow and reported as such in the results.
149   // slowTestThreshold: 5,
150
151   // A list of paths to snapshot serializer modules Jest should use for snapshot testing
152   // snapshotSerializers: [],
153
154   // The test environment that will be used for testing
155   testEnvironment: "jsdom",
156
157   // Options that will be passed to the testEnvironment
158   // testEnvironmentOptions: {},
159
160   // Adds a location field to test results
161   // testLocationInResults: false,
162
163   // The glob patterns Jest uses to detect test files
164   // testMatch: [
165   //   "**/__tests__/**/*.[jt]s?(x)",
166   //   "**/?(*.)+(spec|test).[tj]s?(x)"
167   // ],
168
169   // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
170   // testPathIgnorePatterns: [
171   //   "/node_modules/"
172   // ],
173
174   // The regexp pattern or array of patterns that Jest uses to detect test files
175   // testRegex: [],
176
177   // This option allows the use of a custom results processor
178   // testResultsProcessor: undefined,
179
180   // This option allows use of a custom test runner
181   // testRunner: "jest-circus/runner",
182
183   // A map from regular expressions to paths to transformers
184   transform: {
185     "^.+.tsx?$": ["ts-jest",{}],
186   },
187
188   // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
189   // transformIgnorePatterns: [
190   //   "/node_modules/",
191   //   "\\.pnp\\.[^\\/]+$"
192   // ],
193
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,
196
197   // Indicates whether each individual test should be reported during the run
198   // verbose: undefined,
199
200   // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
201   // watchPathIgnorePatterns: [],
202
203   // Whether to use watchman for file crawling
204   // watchman: true,
205 };
206
207 export default config;