1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
metamask-extension/test
Erik Marks 3de3765425
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 10:00:04 -07:00
..
data Integrating the TokenListController to Extension (#11398) 2021-09-09 16:56:27 -04:00
e2e E2e fixtures navigate transactions (#12101) 2021-09-14 17:26:22 +01:00
helpers bump @metamask/controllers to v15.0.2 and remove AbortController workaround in e2e tests (#11988) 2021-09-03 09:34:21 -05:00
jest Integrating the TokenListController to Extension (#11398) 2021-09-09 16:56:27 -04:00
lib remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00
mocks @metamask/controllers@15.0.0 (#11975) 2021-08-31 12:27:13 -07:00
stub Add gas constants (#11248) 2021-06-08 10:25:48 -05:00
unit-global Make all named intrinsics non-modifiable (#11953) 2021-08-30 14:30:48 -07:00
env.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
run-jest.sh Add build-time code exclusion using code fencing (#12060) 2021-09-14 10:00:04 -07:00
setup.js colocate tests in flat structure (#10655) 2021-03-16 16:00:08 -05:00