feat: returning the finishing param in PackageResponse object

This commit is contained in:
Zoltan Kochan
2017-12-09 20:24:15 +02:00
parent 69a397da49
commit 019931da8f
2 changed files with 6 additions and 1 deletions

View File

@@ -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),
})
})

View File

@@ -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