forked from MetaMask/metamask-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.view.js
More file actions
33 lines (31 loc) · 1.56 KB
/
Copy pathjest.config.view.js
File metadata and controls
33 lines (31 loc) · 1.56 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
/* eslint-disable import-x/no-commonjs */
const baseConfig = require('./jest.config.js');
// View tests are integration-level and exercise the real production code path
// for the feature under test. Some app-level feature gates are guarded by
// build-time env vars that babel inlines at compile time
// (`babel-plugin-transform-inline-environment-variables` in babel.config.js),
// so `process.env.X` reads in app code are substituted with whatever value the
// var has when babel runs — runtime mutation from `mocks.ts` or
// `setupFilesAfterEnv` is too late. Setting `HAS_TEST_OVERRIDES=true` here, at
// config-load time before babel compiles any test file, opts view tests into
// the same `hasTestOverrides` shortcut smoke tests already use; this avoids mocking the
// guarded config module (forbidden in CV).
//
// TODO: remove this once `app/util/notifications/constants/config.ts:
// isNotificationsFeatureEnabled` (and any future similar gate) is refactored
// to drop its `process.env.MM_NOTIFICATIONS_UI_ENABLED` dependency in favour
// of a single state-driven (`RemoteFeatureFlagController`) check — at which
// point view tests can seed the flag through Redux state like every other
// feature already does.
process.env.HAS_TEST_OVERRIDES = 'true';
module.exports = {
...baseConfig,
setupFilesAfterEnv: ['<rootDir>/app/util/test/testSetupView.js'],
testPathIgnorePatterns: (baseConfig.testPathIgnorePatterns || []).filter(
(pattern) => !pattern.includes('view'),
),
testMatch: ['**/*.view.test.ts?(x)'],
testTimeout: 30000,
forceExit: true,
maxWorkers: 1,
};