Update styles to latest unicorn 🦄 and prettier 🦋

This commit is contained in:
Webber 2020-05-01 16:52:08 +02:00 committed by Webber Takken
parent afef854ea0
commit 98a1b078fc
12 changed files with 29 additions and 31 deletions

View File

@ -17,6 +17,6 @@ async function action() {
await Docker.run(builtImage, { workspace, ...buildParameters });
}
action().catch(error => {
action().catch((error) => {
core.setFailed(error.message);
});

View File

@ -2,8 +2,6 @@
exports[`Versioning determineVersion throws for invalid strategy 0 1`] = `"Versioning strategy should be one of None, Semantic, Tag, Custom."`;
exports[`Versioning determineVersion throws for invalid strategy null 1`] = `"Versioning strategy should be one of None, Semantic, Tag, Custom."`;
exports[`Versioning determineVersion throws for invalid strategy somethingRandom 1`] = `"Versioning strategy should be one of None, Semantic, Tag, Custom."`;
exports[`Versioning determineVersion throws for invalid strategy undefined 1`] = `"Versioning strategy should be one of None, Semantic, Tag, Custom."`;

View File

@ -54,14 +54,14 @@ describe('BuildParameters', () => {
test.each([Platform.types.StandaloneWindows, Platform.types.StandaloneWindows64])(
'appends exe for %s',
targetPlatform => {
(targetPlatform) => {
expect(
BuildParameters.create({ ...someParameters, targetPlatform }).buildFile,
).toStrictEqual(`${someParameters.buildName}.exe`);
},
);
test.each([Platform.types.Android])('appends apk for %s', targetPlatform => {
test.each([Platform.types.Android])('appends apk for %s', (targetPlatform) => {
expect(
BuildParameters.create({ ...someParameters, targetPlatform }).buildFile,
).toStrictEqual(`${someParameters.buildName}.apk`);

View File

@ -12,7 +12,7 @@ class Docker {
--build-arg IMAGE=${baseImage} \
--tag ${tag}`;
await exec(command, null, { silent });
await exec(command, undefined, { silent });
return tag;
}
@ -70,7 +70,7 @@ class Docker {
--volume "${workspace}":"/github/workspace" \
${image}`;
await exec(command, null, { silent });
await exec(command, undefined, { silent });
}
}

View File

@ -5,7 +5,7 @@ describe('CommandExecutionError', () => {
expect(() => new CommandExecutionError()).not.toThrow();
});
test.each([1, 'one', { name: '!' }])('Displays title %s', message => {
test.each([1, 'one', { name: '!' }])('Displays title %s', (message) => {
const error = new CommandExecutionError(message);
expect(error.name).toStrictEqual('CommandExecutionError');

View File

@ -5,7 +5,7 @@ describe('NotImplementedException', () => {
expect(() => new NotImplementedException()).not.toThrow();
});
test.each([1, 'one', { name: '!' }])('Displays title %s', message => {
test.each([1, 'one', { name: '!' }])('Displays title %s', (message) => {
const error = new NotImplementedException(message);
expect(error.name).toStrictEqual('NotImplementedException');

View File

@ -5,7 +5,7 @@ describe('ValidationError', () => {
expect(() => new ValidationError()).not.toThrow();
});
test.each([1, 'one', { name: '!' }])('Displays title %s', message => {
test.each([1, 'one', { name: '!' }])('Displays title %s', (message) => {
const error = new ValidationError(message);
expect(error.name).toStrictEqual('ValidationError');

View File

@ -31,16 +31,16 @@ describe('UnityImageVersion', () => {
expect(image.builderPlatform).toStrictEqual(some.builderPlatform);
});
test.each(['2000.0.0f0', '2011.1.11f1'])('accepts %p version format', version => {
test.each(['2000.0.0f0', '2011.1.11f1'])('accepts %p version format', (version) => {
expect(() => new ImageTag({ version, platform: some.platform })).not.toThrow();
});
test.each(['some version', '', 1, null])('throws for incorrect versions %p', version => {
test.each(['some version', '', 1])('throws for incorrect versions %p', (version) => {
const { platform } = some;
expect(() => new ImageTag({ version, platform })).toThrow();
});
test.each([undefined, 'nonExisting'])('throws for unsupported target %p', platform => {
test.each([undefined, 'nonExisting'])('throws for unsupported target %p', (platform) => {
expect(() => new ImageTag({ platform })).toThrow();
});
});

View File

@ -11,7 +11,7 @@ describe('Index', () => {
'Platform',
'Project',
'Unity',
])('exports %s', exportedModule => {
])('exports %s', (exportedModule) => {
expect(Index[exportedModule]).toBeEitherAFunctionOrAnObject();
});
});

View File

@ -8,13 +8,13 @@ class System {
let debug = '';
const listeners = {
stdout: dataBuffer => {
stdout: (dataBuffer) => {
result += dataBuffer.toString();
},
stderr: dataBuffer => {
stderr: (dataBuffer) => {
error += dataBuffer.toString();
},
debug: dataString => {
debug: (dataString) => {
debug += dataString.toString();
},
};

View File

@ -203,6 +203,6 @@ export default class Versioning {
static async getTotalNumberOfCommits() {
const numberOfCommitsAsString = await System.run('git', ['rev-list', '--count', 'HEAD']);
return parseInt(numberOfCommitsAsString, 10);
return Number.parseInt(numberOfCommitsAsString, 10);
}
}

View File

@ -85,14 +85,14 @@ describe('Versioning', () => {
test.each(['v1.1-1-g12345678', 'v0.1-2-g12345678', 'v0.0-500-gA9B6C3D0-dirty'])(
'is happy with valid %s',
description => {
(description) => {
expect(Versioning.descriptionRegex.test(description)).toBeTruthy();
},
);
test.each([null, undefined, 'v0', 'v0.1', 'v0.1.2', 'v0.1-2', 'v0.1-2-g'])(
test.each([undefined, 'v0', 'v0.1', 'v0.1.2', 'v0.1-2', 'v0.1-2-g'])(
'does not like %s',
description => {
(description) => {
expect(Versioning.descriptionRegex.test(description)).toBeFalsy();
// Also never expect without the v to work for any of these cases.
expect(Versioning.descriptionRegex.test(description?.substr(1))).toBeFalsy();
@ -101,9 +101,9 @@ describe('Versioning', () => {
});
describe('determineVersion', () => {
test.each([null, undefined, 0, 'somethingRandom'])(
test.each([undefined, 0, 'somethingRandom'])(
'throws for invalid strategy %s',
async strategy => {
async (strategy) => {
await expect(Versioning.determineVersion(strategy)).rejects.toThrowErrorMatchingSnapshot();
},
);
@ -117,9 +117,9 @@ describe('Versioning', () => {
});
describe('custom strategy', () => {
test.each([null, undefined, 0, 'v0.1', '1', 'CamelCase', 'dashed-version'])(
test.each([undefined, 0, 'v0.1', '1', 'CamelCase', 'dashed-version'])(
'returns the inputVersion for %s',
async inputVersion => {
async (inputVersion) => {
await expect(Versioning.determineVersion('Custom', inputVersion)).resolves.toStrictEqual(
inputVersion,
);
@ -198,7 +198,7 @@ describe('Versioning', () => {
describe('fetch', () => {
it('awaits the command', async () => {
jest.spyOn(core, 'warning').mockImplementation(() => {});
jest.spyOn(System, 'run').mockResolvedValue(null);
jest.spyOn(System, 'run').mockResolvedValue(undefined);
await expect(Versioning.fetch()).resolves.not.toThrow();
});
@ -206,8 +206,8 @@ describe('Versioning', () => {
jest.spyOn(core, 'warning').mockImplementation(() => {});
const gitFetch = jest
.spyOn(System, 'run')
.mockResolvedValue(null)
.mockRejectedValueOnce(null);
.mockResolvedValue(undefined)
.mockRejectedValueOnce(undefined);
await expect(Versioning.fetch()).resolves.not.toThrow();
expect(gitFetch).toHaveBeenCalledTimes(2);
@ -216,7 +216,7 @@ describe('Versioning', () => {
describe('generateSemanticVersion', () => {
it('returns a proper version from description', async () => {
jest.spyOn(System, 'run').mockResolvedValue(null);
jest.spyOn(System, 'run').mockResolvedValue(undefined);
jest.spyOn(core, 'info').mockImplementation(() => {});
jest.spyOn(Versioning, 'isDirty').mockResolvedValue(false);
jest.spyOn(Versioning, 'hasAnyVersionTags').mockResolvedValue(true);
@ -232,7 +232,7 @@ describe('Versioning', () => {
});
it('throws when dirty', async () => {
jest.spyOn(System, 'run').mockResolvedValue(null);
jest.spyOn(System, 'run').mockResolvedValue(undefined);
jest.spyOn(core, 'info').mockImplementation(() => {});
jest.spyOn(Versioning, 'isDirty').mockResolvedValue(true);
await expect(Versioning.generateSemanticVersion()).rejects.toThrowError();
@ -240,7 +240,7 @@ describe('Versioning', () => {
it('falls back to commits only, when no tags are present', async () => {
const commits = Math.round(Math.random() * 10);
jest.spyOn(System, 'run').mockResolvedValue(null);
jest.spyOn(System, 'run').mockResolvedValue(undefined);
jest.spyOn(core, 'info').mockImplementation(() => {});
jest.spyOn(Versioning, 'isDirty').mockResolvedValue(false);
jest.spyOn(Versioning, 'hasAnyVersionTags').mockResolvedValue(false);