Skip to content

Resolve Jest "expect-expect" lint rule#420

Merged
astarinmymind merged 4 commits intodevelopfrom
remove-eslint-no-expect
Mar 20, 2021
Merged

Resolve Jest "expect-expect" lint rule#420
astarinmymind merged 4 commits intodevelopfrom
remove-eslint-no-expect

Conversation

@astarinmymind
Copy link
Copy Markdown
Contributor

This PR refactors 3 tests that do not use an expect statement.

Two of such tests were checking if functions SafelyExecute and SafelyExecuteWithTimeout from utils would resolve even if an error was thrown. I refactored them by wrapping them in an await statement and expecting it to resolve.

The last test aimed to make sure a parameterized function is called. It was done in a creative way that did not use expect. I refactored it by passing in a mocked function and checking that it was called correctly.

@astarinmymind astarinmymind requested a review from a team as a code owner March 20, 2021 04:43
Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@astarinmymind astarinmymind merged commit c25d9b1 into develop Mar 20, 2021
@astarinmymind astarinmymind deleted the remove-eslint-no-expect branch March 20, 2021 15:48
Mrtenz pushed a commit that referenced this pull request Oct 16, 2025
…norepo (#420)

Synchronizes package meta-files with
https://github.com/MetaMask/metamask-module-template. Changes exclude
source code and other published files with the following exceptions:
- `package.json`, most notably its `exports` field
  - This is due to adding fields expected by our Yarn constraints and
migrating to `ts-bridge` for builds.
  - This is breaking due to changing the `exports`.
- Published files are split into `.cjs` and `.mjs` trees per `ts-bridge`

In detail (all changes per module template unless otherwise specified):
- Use `ts-bridge`
- Bump `eslint`, `prettier`, and related dependencies
- Add `eslint.config.mjs`
- Add and use `@arethetypeswrong/cli`
- Add and use `typedoc`
- Update `.yarnrc.yml` and add `yarn.config.cjs`
- Update `package.json` and `README.md`
- Bump `typescript` from `4.x` to `~5.7.3`
- Bump `jest` and related dependencies from `^27` to `^28`
- Update `tsconfig` files
- Add default test timer setup to `test/setupAfterEnv.ts`
  - Control timers on a per-test basis as necessary
- Lint all files per updated config
  - Set the following rules to `warn`:
- `@typescript-eslint/prefer-nullish-coalescing`, to avoid behavioral
changes
- `@typescript-eslint/explicit-function-return-type`, because too many
violations to fix right now

Work intentionally avoided in this PR:
- Update `package.json#engines`
- Migrate to `vitest`



<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Migrates build to ts-bridge and aligns tooling with the MetaMask
module template (ESLint v9 flat config, TypeScript 5.x, TypeDoc, Yarn
constraints), with no runtime code changes.
> 
> - **Tooling/Config**:
> - Adopt MetaMask module template: add `yarn.config.cjs`, update
`.yarnrc.yml`, and standardize `package.json` fields/`exports`.
>   - Bump TypeScript to `~5.x` and adopt `typescript-eslint@^8`.
> - Upgrade ESLint to v9 with flat config via `eslint.config.mjs` and
MetaMask configs v14.
> - **Build**:
> - Migrate to `ts-bridge`; publish split `dist` outputs
(`.cjs`/`.mjs`).
>   - Add `@arethetypeswrong/cli` and related tooling checks.
> - **Docs**:
>   - Add `typedoc.json` and `typedoc` for API docs generation.
> - **Deps**:
> - Refresh `yarn.lock` and ancillary dev deps (e.g., jest ecosystem
kept at 27.x).
> - **Tests**:
> - Establish default test timer setup in `test/setupAfterEnv.ts` (per
PR notes).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7b8b457d4695088cb32935f782e78627e335c656. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Mrtenz pushed a commit that referenced this pull request Oct 16, 2025
… core monorepo (#420)" (#423)

This reverts commit d10c455.

This breaking change is blocking a release fix that will include:
1. MetaMask/eth-json-rpc-middleware#421
2. MetaMask/eth-json-rpc-middleware#422

Will readd this commit after those two PRs are merged and a patch
release is cut

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?

Are there any issues or other links reviewers should consult to
understand this pull request better? For instance:

* Fixes #12345
* See: #67890
-->
Mrtenz pushed a commit that referenced this pull request Oct 16, 2025
…d core monorepo (#420)" (#423) (#426)

This reverts commit d8129a6 (Reapplies
d10c455)

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?

Are there any issues or other links reviewers should consult to
understand this pull request better? For instance:

* Fixes #12345
* See: #67890
-->


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Overhauls the dev toolchain: upgrades ESLint to v9 with new
configs/plugins, moves to TypeScript 5.x, adds
TypeDoc/depcheck/ts-bridge/ATTW tooling, updates Prettier to v3, and
refreshes dependencies.
> 
> - **Dev toolchain sync/upgrade**
> - **ESLint 9**: Bump core and configs (MetaMask v14), migrate
plugins/resolvers (e.g., `eslint-plugin-import-x`,
`eslint-import-resolver-typescript`), and update related utilities.
> - **TypeScript 5.x**: Update TypeScript, `typescript-eslint` (v8),
`ts-node`, and supporting packages.
> - **Formatting & docs**: Upgrade **Prettier** to v3 and
`prettier-plugin-packagejson`; add **TypeDoc**.
> - **New tooling**: Add `@arethetypeswrong/cli`, `@ts-bridge/cli`, and
**depcheck** for dependency hygiene.
> - **Dependencies**: Broad dependency updates and lockfile refresh to
align with core template.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5ef56a47b1975d8ded4b528f0e5bd76585e4bac1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants