Skip to content

Commit

Permalink
chore: Remove dead code/config related to Mocha unit tests (#25492)
Browse files Browse the repository at this point in the history
## **Description**

Our test scripts and configuration have been updated to remove things
that were used for our Mocha unit tests, which have been converted to
Jest. This unblocks the creation of a test coverage quality gate
(previously this was blocked by a bug in our "merge coverage" step,
which merged Mocha and Jest coverage).

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25492?quickstart=1)

## **Related issues**

None

## **Manual testing steps**

N/A

## **Screenshots/Recordings**

N/A

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

---------

Co-authored-by: MetaMask Bot <[email protected]>
  • Loading branch information
Gudahtt and metamaskbot authored Jun 25, 2024
1 parent 765370f commit bda7cdd
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 588 deletions.
9 changes: 3 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ workflows:
- test-unit-jest-development:
requires:
- prep-deps
- upload-and-validate-coverage:
- upload-coverage:
requires:
- test-unit-jest-main
- test-unit-jest-development
Expand Down Expand Up @@ -286,7 +286,7 @@ workflows:
- test-unit-jest-main
- test-unit-jest-development
- test-unit-global
- upload-and-validate-coverage
- upload-coverage
- validate-source-maps
- validate-source-maps-beta
- validate-source-maps-flask
Expand Down Expand Up @@ -1677,17 +1677,14 @@ jobs:
- store_test_results:
path: test/test-results/junit.xml

upload-and-validate-coverage:
upload-coverage:
executor: node-browsers-small
steps:
- run: *shallow-git-clone
- run: sudo corepack enable
- attach_workspace:
at: .
- codecov/upload
- run:
name: test:coverage:validate
command: yarn test:coverage:validate
- persist_to_workspace:
root: .
paths:
Expand Down
2 changes: 0 additions & 2 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ ignores:
- 'wait-on'
- 'tsx' # used in .devcontainer
- 'prettier-eslint' # used by the Prettier ESLint VSCode extension
# development tool
- 'nyc'
# storybook
- '@storybook/cli'
- '@storybook/core'
Expand Down
34 changes: 4 additions & 30 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ module.exports = {
'development/**/*.js',
'test/e2e/**/*.js',
'test/helpers/*.js',
'test/lib/wait-until-called.js',
'test/run-unit-tests.js',
'test/merge-coverage.js',
],
extends: [
path.resolve(__dirname, '.eslintrc.base.js'),
Expand Down Expand Up @@ -94,8 +92,6 @@ module.exports = {
'test/stub/**/*.js',
'test/unit-global/**/*.js',
],
// TODO: Convert these files to modern JS
excludedFiles: ['test/lib/wait-until-called.js'],
extends: [
path.resolve(__dirname, '.eslintrc.base.js'),
path.resolve(__dirname, '.eslintrc.node.js'),
Expand Down Expand Up @@ -261,30 +257,7 @@ module.exports = {
* Mocha library.
*/
{
files: [
'**/*.test.js',
'test/lib/wait-until-called.js',
'test/e2e/**/*.spec.js',
],
excludedFiles: [
'app/scripts/controllers/app-state.test.js',
'app/scripts/controllers/mmi-controller.test.js',
'app/scripts/metamask-controller.actions.test.js',
'app/scripts/detect-multiple-instances.test.js',
'app/scripts/controllers/swaps.test.js',
'app/scripts/controllers/metametrics.test.js',
'app/scripts/controllers/permissions/**/*.test.js',
'app/scripts/controllers/preferences.test.js',
'app/scripts/lib/**/*.test.js',
'app/scripts/metamask-controller.test.js',
'app/scripts/migrations/*.test.js',
'app/scripts/platforms/*.test.js',
'development/**/*.test.js',
'shared/**/*.test.js',
'ui/**/*.test.js',
'ui/__mocks__/*.js',
'test/e2e/helpers.test.js',
],
files: ['test/e2e/**/*.spec.js', 'test/unit-global/*.test.js'],
extends: ['@metamask/eslint-config-mocha'],
rules: {
// In Mocha tests, it is common to use `this` to store values or do
Expand All @@ -297,7 +270,9 @@ module.exports = {
* Jest tests
*
* These are files that make use of globals and syntax introduced by the
* Jest library. The files in this section should match the Mocha excludedFiles section.
* Jest library.
* TODO: This list of files is incomplete, and should be replaced with globs that match the
* Jest config.
*/
{
files: [
Expand Down Expand Up @@ -391,7 +366,6 @@ module.exports = {
'test/e2e/benchmark.js',
'test/helpers/setup-helper.js',
'test/run-unit-tests.js',
'test/merge-coverage.js',
],
rules: {
'node/no-process-exit': 'off',
Expand Down
17 changes: 0 additions & 17 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
module.exports = {
// TODO: Remove the `exit` setting, it can hide broken tests.
exit: true,
ignore: [
'./app/scripts/lib/**/*.test.js',
'./app/scripts/migrations/*.test.js',
'./app/scripts/platforms/*.test.js',
'./app/scripts/controllers/app-state.test.js',
'./app/scripts/controllers/permissions/**/*.test.js',
'./app/scripts/controllers/mmi-controller.test.ts',
'./app/scripts/metamask-controller.actions.test.js',
'./app/scripts/detect-multiple-instances.test.js',
'./app/scripts/controllers/swaps.test.js',
'./app/scripts/controllers/metametrics.test.js',
'./app/scripts/controllers/preferences.test.js',
'./app/scripts/constants/error-utils.test.js',
'./app/scripts/metamask-controller.test.js',
'./development/fitness-functions/**/*.test.ts',
'./test/e2e/helpers.test.js',
],
recursive: true,
require: ['test/env.js', 'test/setup.js'],
};
20 changes: 0 additions & 20 deletions coverage-targets.js

This file was deleted.

1 change: 0 additions & 1 deletion development/ts-migration-dashboard/files-to-convert.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@
"test/lib/mock-encryptor.js",
"test/lib/render-helpers.js",
"test/lib/tick.js",
"test/lib/wait-until-called.js",
"test/mocks/permissions.js",
"test/stub/provider.js",
"test/stub/tx-meta-stub.js",
Expand Down
Loading

0 comments on commit bda7cdd

Please sign in to comment.