diff --git a/__tests__/builder.test.ts b/__tests__/builder.test.ts index 8c03ad2..3d0ae28 100644 --- a/__tests__/builder.test.ts +++ b/__tests__/builder.test.ts @@ -1,6 +1,7 @@ -import {afterEach, beforeEach, describe, expect, it, jest, test} from '@jest/globals'; +import {beforeEach, describe, expect, it, jest, test} from '@jest/globals'; import * as fs from 'fs'; import * as path from 'path'; + import {Builder, BuilderInfo} from '../src/builder'; import {Context} from '../src/context'; diff --git a/__tests__/buildx.test.ts b/__tests__/buildx.test.ts index c13befd..e1f8ed1 100644 --- a/__tests__/buildx.test.ts +++ b/__tests__/buildx.test.ts @@ -151,6 +151,22 @@ describe('isAvailable', () => { }); }); +describe('printInspect', () => { + it('prints builder2 instance', () => { + const execSpy = jest.spyOn(exec, 'exec'); + const buildx = new Buildx({ + context: new Context(), + standalone: true + }); + buildx.printInspect('builder2').catch(() => { + // noop + }); + expect(execSpy).toHaveBeenCalledWith(`buildx`, ['inspect', 'builder2'], { + failOnStdErr: false + }); + }); +}); + describe('printVersion', () => { it('docker cli', () => { const execSpy = jest.spyOn(exec, 'exec'); diff --git a/src/buildx.ts b/src/buildx.ts index 98e9605..7223745 100644 --- a/src/buildx.ts +++ b/src/buildx.ts @@ -49,6 +49,13 @@ export class Buildx { }); } + public async printInspect(name: string): Promise { + const cmd = this.getCommand(['inspect', name]); + await exec.exec(cmd.command, cmd.args, { + failOnStdErr: false + }); + } + private async getVersion(): Promise { const cmd = this.getCommand(['version']); return await exec