diff --git a/__tests__/buildx.test.ts b/__tests__/buildx.test.ts index 01f597c..6937d5a 100644 --- a/__tests__/buildx.test.ts +++ b/__tests__/buildx.test.ts @@ -118,7 +118,9 @@ describe('isAvailable', () => { const buildx = new Buildx({ standalone: false }); - await buildx.isAvailable(); + buildx.isAvailable().catch(() => { + // noop + }); // eslint-disable-next-line jest/no-standalone-expect expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx'], { silent: true, @@ -130,7 +132,9 @@ describe('isAvailable', () => { const buildx = new Buildx({ standalone: true }); - await buildx.isAvailable(); + buildx.isAvailable().catch(() => { + // noop + }); // eslint-disable-next-line jest/no-standalone-expect expect(execSpy).toHaveBeenCalledWith(`buildx`, [], { silent: true, diff --git a/__tests__/docker.test.ts b/__tests__/docker.test.ts index 02ff42a..427d369 100644 --- a/__tests__/docker.test.ts +++ b/__tests__/docker.test.ts @@ -11,7 +11,6 @@ describe('isAvailable', () => { it('cli', () => { const execSpy = jest.spyOn(exec, 'getExecOutput'); Docker.isAvailable(); - // eslint-disable-next-line jest/no-standalone-expect expect(execSpy).toHaveBeenCalledWith(`docker`, undefined, { silent: true, @@ -23,14 +22,18 @@ describe('isAvailable', () => { describe('printVersion', () => { it('docker cli', () => { const execSpy = jest.spyOn(exec, 'exec'); - Docker.printVersion(false); + Docker.printVersion(false).catch(() => { + // noop + }); expect(execSpy).toHaveBeenCalledWith(`docker`, ['version'], { failOnStdErr: false }); }); it('standalone', () => { const execSpy = jest.spyOn(exec, 'exec'); - Docker.printVersion(true); + Docker.printVersion(true).catch(() => { + // noop + }); expect(execSpy).not.toHaveBeenCalledWith(`docker`, ['version'], { failOnStdErr: false }); @@ -40,14 +43,18 @@ describe('printVersion', () => { describe('printInfo', () => { it('docker cli', () => { const execSpy = jest.spyOn(exec, 'exec'); - Docker.printInfo(false); + Docker.printInfo(false).catch(() => { + // noop + }); expect(execSpy).toHaveBeenCalledWith(`docker`, ['info'], { failOnStdErr: false }); }); it('standalone', () => { const execSpy = jest.spyOn(exec, 'exec'); - Docker.printInfo(true); + Docker.printInfo(true).catch(() => { + // noop + }); expect(execSpy).not.toHaveBeenCalledWith(`docker`, ['info'], { failOnStdErr: false }); diff --git a/__tests__/git.test.ts b/__tests__/git.test.ts index 0de313c..45ceaed 100644 --- a/__tests__/git.test.ts +++ b/__tests__/git.test.ts @@ -7,7 +7,11 @@ beforeEach(() => { describe('git', () => { it('returns git remote ref', async () => { - const ref: string = await git.getRemoteSha('https://github.com/docker/buildx.git', 'refs/pull/648/head'); - expect(ref).toEqual('f11797113e5a9b86bd976329c5dbb8a8bfdfadfa'); - }, 100000); + try { + expect(await git.getRemoteSha('https://github.com/docker/buildx.git', 'refs/pull/648/head')).toEqual('f11797113e5a9b86bd976329c5dbb8a8bfdfadfa'); + } catch (e) { + // eslint-disable-next-line jest/no-conditional-expect + expect(e).toEqual(null); + } + }); });