diff --git a/lib/build/builder.ts b/lib/build/builder.ts index 11cc0c7..31089d2 100644 --- a/lib/build/builder.ts +++ b/lib/build/builder.ts @@ -174,21 +174,23 @@ export default class Builder { return await Promise.all([relPath, fs.stat(file), fs.readFile(file)]); }), ); - await fileInfos.map(async (fileInfo: [string, fs.Stats, Buffer]) => { - await new Promise((resolve, reject) => - pack.entry( - { name: fileInfo[0], size: fileInfo[1].size }, - fileInfo[2], - (err) => { - if (err) { - reject(err); - } else { - resolve(); - } - }, - ), - ); - }); + await Promise.all( + fileInfos.map(async (fileInfo) => { + await new Promise((resolve, reject) => + pack.entry( + { name: fileInfo[0], size: fileInfo[1].size }, + fileInfo[2], + (err) => { + if (err) { + reject(err); + } else { + resolve(); + } + }, + ), + ); + }), + ); // Tell the tar stream we're done pack.finalize(); // Create a build stream to send the data to diff --git a/test/multibuild/stream.spec.ts b/test/multibuild/stream.spec.ts index cbc0434..67a9e1e 100644 --- a/test/multibuild/stream.spec.ts +++ b/test/multibuild/stream.spec.ts @@ -128,7 +128,7 @@ describe('Stream splitting', () => { }); describe('Specifying a Dockerfile', () => { - it('should throw an error when a build object does not contain a context and dockerfile', (done) => { + it('should throw an error when a build object does not contain a context and dockerfile', async (done) => { const composeObj = require('./test-files/stream/docker-compose-specified-dockerfile-no-context.json'); const comp = Compose.normalize(composeObj); @@ -136,7 +136,7 @@ describe('Stream splitting', () => { `${TEST_FILES_PATH}/stream/specified-dockerfile.tar`, ); - Promise.resolve( + await Promise.resolve( splitBuildStream(comp, stream), ).should.be.rejected.and.notify(done); });