2021-04-09 19:20:32 +02:00
|
|
|
module.exports = {
|
2021-09-08 19:30:41 +02:00
|
|
|
collectCoverageFrom: ['<rootDir>/ui/**/*.js', '<rootDir>/shared/**/*.js'],
|
Add build-time code exclusion using code fencing (#12060)
This PR adds build-time code exclusion by means of code fencing. For details, please see the README in `./development/build/transforms`. Note that linting of transformed files as a form of validation is added in a follow-up, #12075.
Hopefully exhaustive tests are added to ensure that the transform works according to its specification. Since these tests are Node-only, they required their own Jest config. The recommended way to work with multiple Jest configs is using the `projects` field in the Jest config, however [that feature breaks coverage collection](https://github.com/facebook/jest/issues/9628). That being the case, I had to set up two separate Jest configs. In order to get both test suites to run in parallel, Jest is now invoked via a script, `./test/run-jest.sh`.
By way of example, this build system feature allows us to add fences like this:
```javascript
this.store.updateStructure({
...,
GasFeeController: this.gasFeeController,
TokenListController: this.tokenListController,
///: BEGIN:ONLY_INCLUDE_IN(beta)
PluginController: this.pluginController,
///: END:ONLY_INCLUDE_IN
});
```
Which at build time are transformed to the following if the build type is not `beta`:
```javascript
this.store.updateStructure({
...,
GasFeeController: this.gasFeeController,
TokenListController: this.tokenListController,
});
```
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-09-14 19:00:04 +02:00
|
|
|
coverageDirectory: './jest-coverage/main',
|
2021-06-25 23:31:01 +02:00
|
|
|
coveragePathIgnorePatterns: ['.stories.js', '.snap'],
|
2021-12-01 19:46:34 +01:00
|
|
|
coverageReporters: ['html', 'text-summary'],
|
2021-04-09 22:10:51 +02:00
|
|
|
coverageThreshold: {
|
|
|
|
global: {
|
2021-09-08 19:30:41 +02:00
|
|
|
branches: 35,
|
|
|
|
functions: 37,
|
|
|
|
lines: 43,
|
|
|
|
statements: 43,
|
2021-04-09 22:10:51 +02:00
|
|
|
},
|
|
|
|
},
|
Add build-time code exclusion using code fencing (#12060)
This PR adds build-time code exclusion by means of code fencing. For details, please see the README in `./development/build/transforms`. Note that linting of transformed files as a form of validation is added in a follow-up, #12075.
Hopefully exhaustive tests are added to ensure that the transform works according to its specification. Since these tests are Node-only, they required their own Jest config. The recommended way to work with multiple Jest configs is using the `projects` field in the Jest config, however [that feature breaks coverage collection](https://github.com/facebook/jest/issues/9628). That being the case, I had to set up two separate Jest configs. In order to get both test suites to run in parallel, Jest is now invoked via a script, `./test/run-jest.sh`.
By way of example, this build system feature allows us to add fences like this:
```javascript
this.store.updateStructure({
...,
GasFeeController: this.gasFeeController,
TokenListController: this.tokenListController,
///: BEGIN:ONLY_INCLUDE_IN(beta)
PluginController: this.pluginController,
///: END:ONLY_INCLUDE_IN
});
```
Which at build time are transformed to the following if the build type is not `beta`:
```javascript
this.store.updateStructure({
...,
GasFeeController: this.gasFeeController,
TokenListController: this.tokenListController,
});
```
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-09-14 19:00:04 +02:00
|
|
|
// TODO: enable resetMocks
|
|
|
|
// resetMocks: true,
|
|
|
|
restoreMocks: true,
|
|
|
|
setupFiles: ['<rootDir>/test/setup.js', '<rootDir>/test/env.js'],
|
|
|
|
setupFilesAfterEnv: ['<rootDir>/test/jest/setup.js'],
|
2021-09-21 18:28:13 +02:00
|
|
|
testMatch: [
|
|
|
|
'<rootDir>/ui/**/*.test.js',
|
|
|
|
'<rootDir>/shared/**/*.test.js',
|
|
|
|
'<rootDir>/app/scripts/migrations/*.test.js',
|
2021-10-14 23:20:14 +02:00
|
|
|
'<rootDir>/app/scripts/platforms/*.test.js',
|
2021-09-21 18:28:13 +02:00
|
|
|
],
|
Add build-time code exclusion using code fencing (#12060)
This PR adds build-time code exclusion by means of code fencing. For details, please see the README in `./development/build/transforms`. Note that linting of transformed files as a form of validation is added in a follow-up, #12075.
Hopefully exhaustive tests are added to ensure that the transform works according to its specification. Since these tests are Node-only, they required their own Jest config. The recommended way to work with multiple Jest configs is using the `projects` field in the Jest config, however [that feature breaks coverage collection](https://github.com/facebook/jest/issues/9628). That being the case, I had to set up two separate Jest configs. In order to get both test suites to run in parallel, Jest is now invoked via a script, `./test/run-jest.sh`.
By way of example, this build system feature allows us to add fences like this:
```javascript
this.store.updateStructure({
...,
GasFeeController: this.gasFeeController,
TokenListController: this.tokenListController,
///: BEGIN:ONLY_INCLUDE_IN(beta)
PluginController: this.pluginController,
///: END:ONLY_INCLUDE_IN
});
```
Which at build time are transformed to the following if the build type is not `beta`:
```javascript
this.store.updateStructure({
...,
GasFeeController: this.gasFeeController,
TokenListController: this.tokenListController,
});
```
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-09-14 19:00:04 +02:00
|
|
|
testTimeout: 2500,
|
2021-11-24 01:41:30 +01:00
|
|
|
transform: {
|
|
|
|
'^.+\\.[tj]sx?$': 'babel-jest',
|
|
|
|
'^.+\\.mdx$': '@storybook/addon-docs/jest-transform-mdx',
|
|
|
|
},
|
2021-04-09 19:20:32 +02:00
|
|
|
};
|