-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathjest.config.js
67 lines (64 loc) · 2.64 KB
/
jest.config.js
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
56
57
58
59
60
61
62
63
64
65
66
67
/*
* Copyright (C) 2024 PixieBrix, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const config = {
silent: true,
testEnvironment: "./src/testUtils/FixJsdomEnvironment.js",
modulePaths: ["/src"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "yaml", "yml", "json"],
modulePathIgnorePatterns: ["<rootDir>/headers.json", "<rootDir>/dist/"],
transform: {
"^.+\\.[jt]sx?$": "@swc/jest",
"^.+\\.mjs$": "@swc/jest",
"^.+\\.ya?ml$": "yaml-jest-transform",
"^.+\\.ya?ml\\?loadAsText$":
"<rootDir>/src/testUtils/rawJestTransformer.mjs",
"^.+\\.txt$": "<rootDir>/src/testUtils/rawJestTransformer.mjs",
},
transformIgnorePatterns: [
"node_modules/(?!@cfworker|escape-string-regex|filename-reserved-regex|filenamify|idb|webext-|p-timeout|p-retry|p-defer|p-memoize|serialize-error|strip-outer|trim-repeated|mimic-fn|urlpattern-polyfill|url-join|uuid|nanoid|use-debounce|copy-text-to-clipboard|linkify-urls|create-html-element|stringify-attributes|escape-goat|stemmer|uint8array-extras|one-event|abort-utils|batched-function|is-network-error|text-field-edit)",
],
setupFiles: [
"dotenv/config",
"<rootDir>/src/testUtils/testEnv.js",
"jest-webextension-mock",
"fake-indexeddb/auto",
],
setupFilesAfterEnv: [
"<rootDir>/src/testUtils/testAfterEnv.ts",
"<rootDir>/src/testUtils/injectRegistries.ts",
"jest-extended/all",
],
reporters: ["default", "github-actions"],
coverageReporters: ["json"],
collectCoverageFrom: [
"src/**/*.{ts,tsx}",
"!src/**/*.stories.tsx",
"!**/__mocks__/**",
"!**/node_modules/**",
"!**/vendor/**",
],
moduleNameMapper: {
"\\.s?css$": "identity-obj-proxy",
"\\.(gif|svg|png)$|\\?loadAsUrl$|\\?loadAsComponent$":
"<rootDir>/src/__mocks__/stringMock.js",
"^@contrib/(.*?)(\\?loadAsText)?$": "<rootDir>/contrib/$1",
"^@schemas/(.*)": "<rootDir>/schemas/$1",
// Auto-mocks. See documentation in ./src/__mocks__/readme.md
"^@/(.*)$": ["<rootDir>/src/__mocks__/@/$1", "<rootDir>/src/$1"],
},
};
module.exports = config;