chore: update dev dependencies and workflow

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2022-03-22 21:09:00 +01:00
parent 47c365107c
commit e99ab50e6c
20 changed files with 2552 additions and 40207 deletions

View File

@ -1,3 +1,4 @@
import {beforeEach, describe, expect, it, jest} from '@jest/globals';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
@ -145,7 +146,7 @@ FOO=bar`
expect(res).toEqual([
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
`MYSECRET=aaaaaaaa
bbbb\"bbb
bbbb"bbb
ccccccccc`,
'FOO=bar'
]);
@ -167,19 +168,22 @@ describe('asyncForEach', () => {
describe('setOutput', () => {
beforeEach(() => {
process.stdout.write = jest.fn();
process.stdout.write = jest.fn() as typeof process.stdout.write;
});
// eslint-disable-next-line jest/expect-expect
it('setOutput produces the correct command', () => {
context.setOutput('some output', 'some value');
assertWriteCalls([`::set-output name=some output::some value${os.EOL}`]);
});
// eslint-disable-next-line jest/expect-expect
it('setOutput handles bools', () => {
context.setOutput('some output', false);
assertWriteCalls([`::set-output name=some output::false${os.EOL}`]);
});
// eslint-disable-next-line jest/expect-expect
it('setOutput handles numbers', () => {
context.setOutput('some output', 1.01);
assertWriteCalls([`::set-output name=some output::1.01${os.EOL}`]);

View File

@ -1,3 +1,4 @@
import {describe, expect, test} from '@jest/globals';
import {Flavor, Transform} from '../src/flavor';
describe('transform', () => {
@ -165,7 +166,7 @@ describe('transform', () => {
} as Flavor,
false
]
])('given %p attributes ', async (inputs: string[], expected: Flavor, invalid: boolean) => {
])('given %p attributes', async (inputs: string[], expected: Flavor, invalid: boolean) => {
try {
const flavor = Transform(inputs);
expect(flavor).toEqual(expected);
@ -173,6 +174,7 @@ describe('transform', () => {
if (!invalid) {
console.error(err);
}
// eslint-disable-next-line jest/no-conditional-expect
expect(true).toBe(invalid);
}
});

View File

@ -1,8 +1,9 @@
import * as path from 'path';
import {describe, expect, jest, it} from '@jest/globals';
import * as github from '../src/github';
import * as repoFixture from './fixtures/repo.json';
jest.spyOn(github, 'repo').mockImplementation((): Promise<github.ReposGetResponseData> => {
return <Promise<github.ReposGetResponseData>>require(path.join(__dirname, 'fixtures', 'repo.json'));
return <Promise<github.ReposGetResponseData>>(repoFixture as unknown);
});
describe('repo', () => {

View File

@ -1,3 +1,4 @@
import {beforeEach, describe, expect, jest, test} from '@jest/globals';
import * as fs from 'fs';
import * as path from 'path';
import * as dotenv from 'dotenv';
@ -7,8 +8,9 @@ import * as github from '../src/github';
import {Meta, Version} from '../src/meta';
import {Context} from '@actions/github/lib/context';
import * as repoFixture from './fixtures/repo.json';
jest.spyOn(github, 'repo').mockImplementation((): Promise<github.ReposGetResponseData> => {
return <Promise<github.ReposGetResponseData>>require(path.join(__dirname, 'fixtures', 'repo.json'));
return <Promise<github.ReposGetResponseData>>(repoFixture as unknown);
});
jest.spyOn(github, 'context').mockImplementation((): Context => {
@ -20,7 +22,7 @@ jest.spyOn(global.Date.prototype, 'toISOString').mockImplementation(() => {
});
jest.mock('moment', () => {
return () => jest.requireActual('moment')('2020-01-10T00:30:00.000Z');
return () => (jest.requireActual('moment') as typeof import('moment'))('2020-01-10T00:30:00.000Z');
});
beforeEach(() => {
@ -39,7 +41,7 @@ describe('isRawStatement', () => {
['{{ raw }}', true],
['{{ raw}}', true],
['{{raw}}', true],
])('given %p pattern ', async (pattern: string, expected: boolean) => {
])('given %p pattern', async (pattern: string, expected: boolean) => {
expect(Meta.isRawStatement(pattern)).toEqual(expected);
});
});
@ -3219,7 +3221,7 @@ describe('json', () => {
}
}
]
])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, exJSON: {}) => {
])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, exJSON: unknown) => {
process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile)));
const context = github.context();
@ -3524,7 +3526,7 @@ describe('bake', () => {
}
}
]
])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, exBakeDefinition: {}) => {
])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, exBakeDefinition: unknown) => {
process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile)));
const context = github.context();

View File

@ -1,3 +1,4 @@
import {describe, expect, test} from '@jest/globals';
import {Transform, Parse, Tag, Type, RefEvent, ShaFormat, DefaultPriorities} from '../src/tag';
describe('transform', () => {
@ -104,6 +105,7 @@ describe('transform', () => {
if (!invalid) {
console.error(err);
}
// eslint-disable-next-line jest/no-conditional-expect
expect(true).toBe(invalid);
}
});
@ -425,7 +427,7 @@ describe('parse', () => {
{} as Tag,
true
]
])('given %p event ', async (s: string, expected: Tag, invalid: boolean) => {
])('given %p event', async (s: string, expected: Tag, invalid: boolean) => {
try {
const tag = Parse(s);
expect(tag).toEqual(expected);
@ -433,6 +435,7 @@ describe('parse', () => {
if (!invalid) {
console.error(err);
}
// eslint-disable-next-line jest/no-conditional-expect
expect(true).toBe(invalid);
}
});