-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathjest.config.ts
More file actions
74 lines (73 loc) · 3.21 KB
/
jest.config.ts
File metadata and controls
74 lines (73 loc) · 3.21 KB
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
68
69
70
71
72
73
74
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/en/configuration.html
*/
// eslint-disable-next-line import/no-anonymous-default-export
export default {
coverageProvider: 'v8',
// Narrow exclusions only for code that is fundamentally E2E/snapshot
// territory and has no unit-testable surface:
//
// - `app/pages/Browser/` — framer-motion drag handlers / launcher
// overlays, exercised by the mobile-e2e suite.
// - `app/pages/Receive.tsx` — QR canvas + long UI, E2E territory.
// - `app/providers/DappBrowserProvider.tsx` — Capacitor inappbrowser
// provider wired to native plugins, exercised via mobile-e2e.
// - `components/TransactionProgressModal.tsx` — react-modal portal
// with framer-motion animation, covered by Playwright.
// - `app/icons/v2/index.tsx` — barrel file of SVG re-exports.
// - `lib/mobile/faucet-webview.ts` — Capacitor InAppBrowser wrapper.
// - `packages/dapp-browser/` — external package build output.
coveragePathIgnorePatterns: [
'/node_modules/',
'/src/app/pages/Browser/',
'/src/app/pages/Receive\\.tsx$',
'/src/app/icons/v2/index\\.tsx$',
'/src/app/providers/DappBrowserProvider\\.tsx$',
'/src/components/TransactionProgressModal\\.tsx$',
'/src/lib/mobile/faucet-webview\\.ts$',
'/packages/dapp-browser/'
],
coverageThreshold: {
global: {
branches: 95,
functions: 95,
lines: 95,
statements: 95
}
},
moduleNameMapper: {
// Asset stubs must come BEFORE the `^app/` / `^lib/` path mappers so
// `import icon from 'app/misc/dapp-icons/foo.png'` resolves to the
// stub instead of trying to execute the PNG bytes as JavaScript.
'\\.svg$': '<rootDir>/__mocks__/svgMock.js',
'\\.(png|jpg|jpeg|gif|webp)$': '<rootDir>/__mocks__/fileMock.js',
'^lib/(.*)$': '<rootDir>/src/lib/$1',
'^shared/(.*)$': '<rootDir>/src/shared/$1',
'^app/(.*)$': '<rootDir>/src/app/$1',
'^components/(.*)$': '<rootDir>/src/components/$1',
'^screens/(.*)$': '<rootDir>/src/screens/$1',
'^utils/(.*)$': '<rootDir>/src/utils/$1',
// Match all four published subpaths — tests mock them identically.
// - `@miden-sdk/miden-sdk` (eager + ST)
// - `@miden-sdk/miden-sdk/lazy` (lazy + ST)
// - `@miden-sdk/miden-sdk/mt` (eager + MT)
// - `@miden-sdk/miden-sdk/mt/lazy` (lazy + MT)
'^@miden-sdk/miden-sdk(/lazy|/mt|/mt/lazy)?$': '<rootDir>/__mocks__/wasmMock.js',
// React SDK now also has /mt and /mt/lazy subpaths matching the
// underlying SDK's MT variants. Tests mock all four identically.
'^@miden-sdk/react(/lazy|/mt|/mt/lazy)?$': '<rootDir>/__mocks__/@miden-sdk/react.ts'
},
testEnvironment: 'jsdom',
transform: {
'.+\\.(ts|tsx|js|mjs)$': '@swc/jest'
},
transformIgnorePatterns: [
'/node_modules/(?!(p-queue|p-timeout|eventemitter3|date-fns|dexie)/)'
],
moduleFileExtensions: ['ts', 'tsx', 'js'],
modulePathIgnorePatterns: ['<rootDir>/sdk-debug/'],
testPathIgnorePatterns: ['<rootDir>/playwright/', '<rootDir>/mobile-e2e/'],
setupFiles: ['dotenv/config', '@serh11p/jest-webextension-mock', 'fake-indexeddb/auto'],
setupFilesAfterEnv: ['./jest.setup.js']
};