From 995fe3c38afcd903f65b97b2b0b641073010dd56 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sun, 23 Aug 2020 04:01:20 +0200 Subject: [PATCH] Fix tests Signed-off-by: CrazyMax --- __tests__/buildx.test.ts | 2 +- dist/index.js | 2 +- src/buildx.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__tests__/buildx.test.ts b/__tests__/buildx.test.ts index 870a930..85f8276 100644 --- a/__tests__/buildx.test.ts +++ b/__tests__/buildx.test.ts @@ -27,7 +27,7 @@ describe('getVersion', () => { describe('parseVersion', () => { test.each([ - ['github.com/docker/buildx v0.2.2 ab5fe3dec5785b8d0a7d2cf2499c38e504d4c609', '0.2.2'], + ['github.com/docker/buildx 0.4.1+azure bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'], ['github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'], ['github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2', '0.4.2'] ])('given %p', async (stdout, expected) => { diff --git a/dist/index.js b/dist/index.js index 449b76a..b278c58 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1587,7 +1587,7 @@ function getVersion() { exports.getVersion = getVersion; function parseVersion(stdout) { return __awaiter(this, void 0, void 0, function* () { - const matches = /\sv([0-9.]+)\s/.exec(stdout); + const matches = /\sv?([0-9.]+)/.exec(stdout); if (!matches) { throw new Error(`Cannot parse Buildx version`); } diff --git a/src/buildx.ts b/src/buildx.ts index 589cb93..7ee5f92 100644 --- a/src/buildx.ts +++ b/src/buildx.ts @@ -35,7 +35,7 @@ export async function getVersion(): Promise { } export async function parseVersion(stdout: string): Promise { - const matches = /\sv([0-9.]+)\s/.exec(stdout); + const matches = /\sv?([0-9.]+)/.exec(stdout); if (!matches) { throw new Error(`Cannot parse Buildx version`); }