Skip to content

Commit 9faab75

Browse files
committed
update to node 16
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
1 parent fe02965 commit 9faab75

File tree

11 files changed

+1402
-2212
lines changed

11 files changed

+1402
-2212
lines changed

__tests__/buildx.test.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import {describe, expect, it, jest, test} from '@jest/globals';
12
import * as fs from 'fs';
23
import * as path from 'path';
34
import * as semver from 'semver';
45
import * as exec from '@actions/exec';
5-
66
import * as buildx from '../src/buildx';
77
import * as context from '../src/context';
88

@@ -25,6 +25,19 @@ jest.spyOn(context, 'tmpNameSync').mockImplementation((): string => {
2525
return tmpNameSync;
2626
});
2727

28+
export const skipItIf = (conditional: boolean) => (conditional ? it.skip : it);
29+
30+
async function isDaemonRunning() {
31+
return await exec
32+
.getExecOutput(`docker`, ['version', '--format', '{{.Server.Os}}'], {
33+
ignoreReturnCode: true,
34+
silent: true
35+
})
36+
.then(res => {
37+
return !res.stdout.includes(' ') && res.exitCode == 0;
38+
});
39+
}
40+
2841
describe('getImageID', () => {
2942
it('matches', async () => {
3043
const imageIDFile = await buildx.getImageIDFile();
@@ -104,7 +117,7 @@ describe('isLocalOrTarExporter', () => {
104117
});
105118

106119
describe('isAvailable', () => {
107-
const execSpy: jest.SpyInstance = jest.spyOn(exec, 'getExecOutput');
120+
const execSpy = jest.spyOn(exec, 'getExecOutput');
108121
buildx.isAvailable();
109122

110123
expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx'], {
@@ -114,17 +127,7 @@ describe('isAvailable', () => {
114127
});
115128

116129
describe('getVersion', () => {
117-
async function isDaemonRunning() {
118-
return await exec
119-
.getExecOutput(`docker`, ['version', '--format', '{{.Server.Os}}'], {
120-
ignoreReturnCode: true,
121-
silent: true
122-
})
123-
.then(res => {
124-
return !res.stdout.includes(' ') && res.exitCode == 0;
125-
});
126-
}
127-
(isDaemonRunning() ? it : it.skip)(
130+
skipItIf(!isDaemonRunning())(
128131
'valid',
129132
async () => {
130133
const version = await buildx.getVersion();

__tests__/context.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {beforeEach, describe, expect, it, jest, test} from '@jest/globals';
12
import * as fs from 'fs';
23
import * as os from 'os';
34
import * as path from 'path';
@@ -688,6 +689,7 @@ describe('asyncForEach', () => {
688689

689690
describe('setOutput', () => {
690691
beforeEach(() => {
692+
// @ts-ignore
691693
process.stdout.write = jest.fn();
692694
});
693695

@@ -718,8 +720,10 @@ function setInput(name: string, value: string): void {
718720

719721
// Assert that process.stdout.write calls called only with the given arguments.
720722
function assertWriteCalls(calls: string[]): void {
723+
// @ts-ignore
721724
expect(process.stdout.write).toHaveBeenCalledTimes(calls.length);
722725
for (let i = 0; i < calls.length; i++) {
726+
// @ts-ignore
723727
expect(process.stdout.write).toHaveBeenNthCalledWith(i + 1, calls[i]);
724728
}
725729
}

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@ outputs:
9595
description: 'Build result metadata'
9696

9797
runs:
98-
using: 'node12'
98+
using: 'node16'
9999
main: 'dist/index.js'
100100
post: 'dist/index.js'

0 commit comments

Comments
 (0)