Skip to content
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

Replace fetch-mock with nock #340

Merged
merged 1 commit into from
Feb 12, 2021
Merged

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Feb 10, 2021

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.

@Gudahtt Gudahtt requested a review from a team as a code owner February 10, 2021 07:02
@Gudahtt
Copy link
Member Author

Gudahtt commented Feb 10, 2021

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 Gudahtt marked this pull request as draft February 10, 2021 18:12
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
@Gudahtt Gudahtt changed the base branch from develop to add-babel-runtime February 11, 2021 14:10
@Gudahtt
Copy link
Member Author

Gudahtt commented Feb 11, 2021

The bug previously causing tests to fail has been addressed in #341 , which this PR now depends upon.

rickycodes
rickycodes previously approved these changes Feb 11, 2021
Base automatically changed from add-babel-runtime to develop February 11, 2021 15:58
@Gudahtt Gudahtt dismissed rickycodes’s stale review February 11, 2021 15:58

The base branch was changed.

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.
@Gudahtt Gudahtt marked this pull request as ready for review February 11, 2021 16:55
@Gudahtt Gudahtt merged commit aaf3bcc into develop Feb 12, 2021
@Gudahtt Gudahtt deleted the replace-fetch-mock-with-nock branch February 12, 2021 22:34
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.
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.

3 participants