corepack icon indicating copy to clipboard operation
corepack copied to clipboard

Remove nock database

Open mcollina opened this issue 1 year ago • 3 comments

Having a "nock" database makes this codebase harder to reason about due to the "dynamic" nature of this mocking.

Can this be refactored out?

mcollina avatar Jun 10 '24 10:06 mcollina

Can you clarify what's "dynamic" about it? Note that you need to provide NOCK_ENV=replay env variable, otherwise the nock DB is ignored.

aduh95 avatar Jun 10 '24 10:06 aduh95

Maybe I don't understand the source code exactly, but https://github.com/nodejs/corepack/blob/main/.github/workflows/update-nock-files.yml updates it in a PR id passed through. Maybe dynamic is not the right term, but I found this quite hard to reason about.

Why would you need this step?

mcollina avatar Jun 10 '24 10:06 mcollina

If we remove it, it’s only going to make the CI more flaky – because tests would rely on network calls instead of the FS. The only thing dynamic about it is that changes in Corepack internals can result in different endpoint being hit, at which point the nock db needs to be updated to cover those new endpoints.

Why do we need the workflow: I use it because I find it simpler to use it than to pull the PR branch locally and update the nock DB manually.

aduh95 avatar Jun 10 '24 11:06 aduh95