Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixtures/mock-registry.js')
-rw-r--r--test/fixtures/mock-registry.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/test/fixtures/mock-registry.js b/test/fixtures/mock-registry.js
index a62890b72..61263da21 100644
--- a/test/fixtures/mock-registry.js
+++ b/test/fixtures/mock-registry.js
@@ -202,16 +202,21 @@ class MockRegistry {
nock = nock.reply(200, manifest)
if (tarballs) {
for (const version in tarballs) {
- // for (const version in manifest.versions) {
- const packument = manifest.versions[version]
- const dist = new URL(packument.dist.tarball)
- const tarball = await pacote.tarball(tarballs[version])
- nock.get(dist.pathname).reply(200, tarball)
+ const m = manifest.versions[version]
+ nock = await this.tarball({ manifest: m, tarball: tarballs[version] })
}
}
this.nock = nock
}
+ async tarball ({ manifest, tarball }) {
+ const nock = this.nock
+ const dist = new URL(manifest.dist.tarball)
+ const tar = await pacote.tarball(tarball)
+ nock.get(dist.pathname).reply(200, tar)
+ return nock
+ }
+
// either pass in packuments if you need to set specific attributes besides version,
// or an array of versions
// the last packument in the packuments or versions array will be tagged latest