mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-03 13:37:31 -04:00
feat: returning the finishing param in PackageResponse object
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
PackageResponse,
|
||||
RequestPackageFunction,
|
||||
RequestPackageOptions,
|
||||
Resolution,
|
||||
@@ -73,7 +74,7 @@ function requestPackage (
|
||||
waiters: object,
|
||||
wantedDependency: WantedDependency,
|
||||
options: RequestPackageOptions,
|
||||
) {
|
||||
): Promise<PackageResponse> {
|
||||
const msgId = uuid.v4()
|
||||
|
||||
const fetchingManifest = waiters['add'](`manifestResponse:${msgId}`) // tslint:disable-line
|
||||
@@ -83,6 +84,7 @@ function requestPackage (
|
||||
return Object.assign(packageResponse, {
|
||||
fetchingFiles,
|
||||
fetchingManifest,
|
||||
finishing: Promise.all([fetchingManifest, fetchingFiles]).then(() => undefined),
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -60,6 +60,9 @@ test('server', async t => {
|
||||
const files = await response['fetchingFiles'] as PackageFilesResponse
|
||||
t.notOk(files.fromStore)
|
||||
t.ok(files.filenames.indexOf('package.json') !== -1)
|
||||
t.ok(response['finishing'])
|
||||
|
||||
await response['finishing']
|
||||
|
||||
server.close()
|
||||
requestPackage['end']() // tslint:disable-line
|
||||
|
||||
Reference in New Issue
Block a user