-
-
Notifications
You must be signed in to change notification settings - Fork 267
Replace fetch-mock with nock
#340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81550c7 to
4bb06cc
Compare
Member
Author
|
The unit test failure is being caused by a bug in a dependency. Currently investigating how to best solve this; I'll move this back into draft in the meantime. |
Gudahtt
added a commit
that referenced
this pull request
Feb 11, 2021
The version of `ethjs-query` we're using has an unlisted dependency upon `babel-runtime`, and will crash if it's not present. Currently it's working because `babel-runtime` is being brought in by another dependency (`fetch-mock`), but that dependency is removed in another PR (#340). Until we can migrate away from using this version of `ethjs-query`, `babel-runtime` has been added as an explicit dependency to ensure it is present. `ethjs-query` is a transitive dependency of `eth-method-registry` via `ethjs`. There is a PR open on `eth-method-registry` to replace `ethjs` altogether [1]. Once those are merged and released, we can update `eth-method-registry` here and remove this `babel-runtime` dependency.
Gudahtt
added a commit
that referenced
this pull request
Feb 11, 2021
The version of `ethjs-query` we're using has an unlisted dependency upon `babel-runtime`, and will crash if it's not present. Currently it's working because `babel-runtime` is being brought in by another dependency (`fetch-mock`), but that dependency is removed in another PR (#340). Until we can migrate away from using this version of `ethjs-query`, `babel-runtime` has been added as an explicit dependency to ensure it is present. `ethjs-query` is a transitive dependency of `eth-method-registry` via `ethjs`. There is a PR open on `eth-method-registry` to replace `ethjs` altogether [1]. Once those are merged and released, we can update `eth-method-registry` here and remove this `babel-runtime` dependency. [1]: MetaMask/eth-method-registry#29
4bb06cc to
078f87e
Compare
078f87e to
288788e
Compare
Member
Author
|
The bug previously causing tests to fail has been addressed in #341 , which this PR now depends upon. |
rickycodes
previously approved these changes
Feb 11, 2021
Gudahtt
added a commit
that referenced
this pull request
Feb 11, 2021
The version of `ethjs-query` we're using has an unlisted dependency upon `babel-runtime`, and will crash if it's not present. Currently it's working because `babel-runtime` is being brought in by another dependency (`fetch-mock`), but that dependency is removed in another PR (#340). Until we can migrate away from using this version of `ethjs-query`, `babel-runtime` has been added as an explicit dependency to ensure it is present. `ethjs-query` is a transitive dependency of `eth-method-registry` via `ethjs`. There is a PR open on `eth-method-registry` to replace `ethjs` altogether [1]. Once those are merged and released, we can update `eth-method-registry` here and remove this `babel-runtime` dependency. [1]: MetaMask/eth-method-registry#29
`fetch-mock` has been replaced with `nock`. Both libraries do basically the same thing. I chose to use `nock` because the types shipped with `fetch-mock` were incorrect and they were giving me trouble. But `nock` also has a nicer API, and it's what we use for mocking `fetch` in most of our other libraries.
288788e to
2c7bf06
Compare
brad-decker
approved these changes
Feb 12, 2021
rickycodes
added a commit
that referenced
this pull request
Feb 18, 2021
…ba into feature/migrate-to-etherscan * 'feature/migrate-to-etherscan' of github.com:MetaMask/gaba: Update `sinon` and `@types/sinon` to latest versions (#352) Fix `tsconfig.json` indentation (#355) Replace `fetch-mock` with `nock` (#340) Update `ethereumjs-wallet` from v0.6.5 to v1.0.1 (#347) Add `babel-runtime` dependency required by `ethjs-query` (#341) Update `@metamask/eslint-config` from v3 to v4.1.0 (#344) Add `docs` to list of ignored eslint patterns (#345) Update `uuid` from `v3.3.3` to `v8.3.2` (#346) Update approval controller test import (#339) Add Dependabot config (#343) Update `typedoc` (#342) Remove unused test module (#338) Replace `await-semaphore` with `async-mutex` (#334) Update `eth-json-rpc-filters` in lockfile (#336)
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
The version of `ethjs-query` we're using has an unlisted dependency upon `babel-runtime`, and will crash if it's not present. Currently it's working because `babel-runtime` is being brought in by another dependency (`fetch-mock`), but that dependency is removed in another PR (#340). Until we can migrate away from using this version of `ethjs-query`, `babel-runtime` has been added as an explicit dependency to ensure it is present. `ethjs-query` is a transitive dependency of `eth-method-registry` via `ethjs`. There is a PR open on `eth-method-registry` to replace `ethjs` altogether [1]. Once those are merged and released, we can update `eth-method-registry` here and remove this `babel-runtime` dependency. [1]: MetaMask/eth-method-registry#29
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
`fetch-mock` has been replaced with `nock`. Both libraries do basically the same thing. I chose to use `nock` because the types shipped with `fetch-mock` were incorrect and they were giving me trouble. But `nock` also has a nicer API, and it's what we use for mocking `fetch` in most of our other libraries.
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
The version of `ethjs-query` we're using has an unlisted dependency upon `babel-runtime`, and will crash if it's not present. Currently it's working because `babel-runtime` is being brought in by another dependency (`fetch-mock`), but that dependency is removed in another PR (#340). Until we can migrate away from using this version of `ethjs-query`, `babel-runtime` has been added as an explicit dependency to ensure it is present. `ethjs-query` is a transitive dependency of `eth-method-registry` via `ethjs`. There is a PR open on `eth-method-registry` to replace `ethjs` altogether [1]. Once those are merged and released, we can update `eth-method-registry` here and remove this `babel-runtime` dependency. [1]: MetaMask/eth-method-registry#29
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
`fetch-mock` has been replaced with `nock`. Both libraries do basically the same thing. I chose to use `nock` because the types shipped with `fetch-mock` were incorrect and they were giving me trouble. But `nock` also has a nicer API, and it's what we use for mocking `fetch` in most of our other libraries.
Mrtenz
pushed a commit
that referenced
this pull request
Oct 16, 2025
* Adds `useCache` param option to `getLatestBlock()` which ignores the cache block number value in state when false. Defaults: true These changes are needed to enable a way for the [blockRef middleware ](https://github.com/MetaMask/eth-json-rpc-middleware/blob/1f41907d712d98edd6caf147b522325edc4117ec/src/block-ref.ts#L52C11-L52C28) to correctly fetch and return the most recent block number when the BlockTracker isn't polling by avoiding the cache, but also while ensuring that we don't refetch the block number if it is not stale yet. See: https://consensyssoftware.atlassian.net/browse/NWNT-615 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds optional `useCache` to `getLatestBlock()` (defaults true) to bypass cache when needed, refines running/non-running fetch logic with rate limiting, updates tests, and documents in changelog. > > - **Core (`src/PollingBlockTracker.ts`)** > - `getLatestBlock({ useCache = true } = {})`: supports cache bypass; when running, waits for next `latest` event; when not running, fetches immediately via `_updateLatestBlock()` and rate-limits by delaying pending promise cleanup to `pollingInterval`. > - `_updateLatestBlock()` now returns the latest block string instead of `void`. > - `checkForLatestBlock()`: marked deprecated in JSDoc; now updates and returns latest via `getLatestBlock()`. > - **Tests (`src/PollingBlockTracker.test.ts`)** > - Add comprehensive cases for `useCache: false` across not-running and running states, including concurrency and timing. > - **Docs** > - Update `CHANGELOG.md` under Unreleased to note the new `useCache` option and behavior. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit aa0f91076b8d13b3204cf50d93aeefbae02dccf5. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Mrtenz
pushed a commit
that referenced
this pull request
Oct 16, 2025
* Request validation should not throw if verifyingContract is not defined in typed signature (#328) (#330) * 14.0.1 (#331) * [14.x] fix: support ethermint's EIP712 implementation (#333) * setting cosmos as allowed string for verifyingContract field * fixed and linter * readability * Update condition to match main branch * Remove duplicate copy of test --------- Co-authored-by: Jyoti Puri <jyotipuri@gmail.com> Co-authored-by: Mark Stacey <markjstacey@gmail.com> * Version 14.0.2 (#339) * Version 14.0.2 * Fix typo Co-authored-by: Michele Esposito <34438276+mikesposito@users.noreply.github.com> --------- Co-authored-by: Michele Esposito <34438276+mikesposito@users.noreply.github.com> --------- Co-authored-by: Jyoti Puri <jyotipuri@gmail.com> Co-authored-by: Michael Tsitrin <114929630+mtsitrin@users.noreply.github.com> Co-authored-by: Michele Esposito <34438276+mikesposito@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fetch-mockhas been replaced withnock. Both libraries do basically the same thing. I chose to usenockbecause the types shipped withfetch-mockwere incorrect and they were giving me trouble. Butnockalso has a nicer API, and it's what we use for mockingfetchin most of our other libraries.