fix: always resolve manifest promise even if the dependency does not have package.json (#6741)

close #6721
This commit is contained in:
await-ovo
2023-06-30 21:26:18 +08:00
committed by GitHub
parent 8a68f5ad24
commit b81cefdcd4
3 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/core": patch
"@pnpm/cafs": patch
---
always resolve manifest promise even if the dependency does not have package.json [#6721](https://github.com/pnpm/pnpm/issues/6721).

View File

@@ -1,4 +1,5 @@
import path from 'path'
import fs from 'fs'
import { type RootLog } from '@pnpm/core-loggers'
import { prepareEmpty } from '@pnpm/prepare'
import {
@@ -179,6 +180,14 @@ test('from a github repo the has no package.json file', async () => {
expect(manifest.dependencies).toStrictEqual({
'for-testing.no-package-json': 'github:pnpm/for-testing.no-package-json',
})
fs.rmSync(path.join(project.dir(), 'node_modules'), {
recursive: true, force: true,
})
fs.rmSync(path.join(project.dir(), 'pnpm-lock.yaml'))
// if there is an unresolved promise, this test will hang until timeout.
// e.g. thrown: "Exceeded timeout of 240000 ms for a test.
await addDependenciesToPackage({}, ['pnpm/for-testing.no-package-json'], await testDefaults())
await project.has('for-testing.no-package-json')
})
test('from a github repo that needs to be built. isolated node linker is used', async () => {

View File

@@ -81,6 +81,9 @@ async function checkFilesIntegrity (
})
)
)
if (manifest && !files['package.json']) {
manifest.resolve(undefined)
}
return allVerified
}