diff --git a/apps/generator-cli/src/app/services/version-manager.service.spec.ts b/apps/generator-cli/src/app/services/version-manager.service.spec.ts index 22a5d64fa..a93c71d11 100644 --- a/apps/generator-cli/src/app/services/version-manager.service.spec.ts +++ b/apps/generator-cli/src/app/services/version-manager.service.spec.ts @@ -365,14 +365,15 @@ describe('VersionManagerService', () => { const data = { pipe: jest.fn(), + }; + + const file = { on: jest.fn().mockImplementation((listener, res) => { - if (listener === 'end') { + if (listener === 'finish') { return res(); } }) - }; - - const file = Symbol(); + } beforeEach(async () => { data.pipe.mockReset(); diff --git a/apps/generator-cli/src/app/services/version-manager.service.ts b/apps/generator-cli/src/app/services/version-manager.service.ts index 3c388fec6..59c3df76c 100644 --- a/apps/generator-cli/src/app/services/version-manager.service.ts +++ b/apps/generator-cli/src/app/services/version-manager.service.ts @@ -113,7 +113,7 @@ export class VersionManagerService { fs.ensureDirSync(this.storage); const file = fs.createWriteStream(filePath); res.data.pipe(file); - res.data.on('end', resolve); + file.on('finish', resolve); }) )).toPromise();