mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-11 10:40:53 -04:00
fix: don't retry fetching missing packages (#7276)
This commit is contained in:
6
.changeset/real-dolls-share.md
Normal file
6
.changeset/real-dolls-share.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/tarball-fetcher": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Don't retry fetching missing packages, since the retries will never work [#7276](https://github.com/pnpm/pnpm/pull/7276).
|
||||
@@ -75,6 +75,7 @@ export function createDownloader (
|
||||
if (
|
||||
error.response?.status === 401 ||
|
||||
error.response?.status === 403 ||
|
||||
error.response?.status === 404 ||
|
||||
error.code === 'ERR_PNPM_PREPARE_PKG_FAILURE'
|
||||
) {
|
||||
reject(error)
|
||||
|
||||
@@ -340,6 +340,38 @@ test('throw error when accessing private package w/o authorization', async () =>
|
||||
expect(scope.isDone()).toBeTruthy()
|
||||
})
|
||||
|
||||
test('do not retry when package does not exist', async () => {
|
||||
const scope = nock(registry)
|
||||
.get('/foo.tgz')
|
||||
.reply(404)
|
||||
|
||||
process.chdir(tempy.directory())
|
||||
|
||||
const resolution = {
|
||||
integrity: tarballIntegrity,
|
||||
tarball: 'http://example.com/foo.tgz',
|
||||
}
|
||||
|
||||
await expect(
|
||||
fetch.remoteTarball(cafs, resolution, {
|
||||
filesIndexFile,
|
||||
lockfileDir: process.cwd(),
|
||||
pkg: {},
|
||||
})
|
||||
).rejects.toThrow(
|
||||
new FetchError(
|
||||
{
|
||||
url: resolution.tarball,
|
||||
},
|
||||
{
|
||||
status: 404,
|
||||
statusText: '',
|
||||
}
|
||||
)
|
||||
)
|
||||
expect(scope.isDone()).toBeTruthy()
|
||||
})
|
||||
|
||||
test('accessing private packages', async () => {
|
||||
const scope = nock(
|
||||
registry,
|
||||
|
||||
Reference in New Issue
Block a user