mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-02-05 08:59:09 +08:00
allow versions with -alpha,-rc,-rc.0 .... + don't fail build on version cannot be determined (#196)
Closes #163
This commit is contained in:
@@ -124,22 +124,22 @@ describe('Versioning', () => {
|
||||
|
||||
describe('descriptionRegex', () => {
|
||||
it('is a valid regex', () => {
|
||||
expect(Versioning.descriptionRegex).toBeInstanceOf(RegExp);
|
||||
expect(Versioning.descriptionRegex1).toBeInstanceOf(RegExp);
|
||||
});
|
||||
|
||||
test.each(['v1.1-1-g12345678', 'v0.1-2-g12345678', 'v0.0-500-gA9B6C3D0-dirty'])(
|
||||
'is happy with valid %s',
|
||||
(description) => {
|
||||
expect(Versioning.descriptionRegex.test(description)).toBeTruthy();
|
||||
expect(Versioning.descriptionRegex1.test(description)).toBeTruthy();
|
||||
},
|
||||
);
|
||||
|
||||
test.each([undefined, 'v0', 'v0.1', 'v0.1.2', 'v0.1-2', 'v0.1-2-g'])(
|
||||
'does not like %s',
|
||||
(description) => {
|
||||
expect(Versioning.descriptionRegex.test(description)).toBeFalsy();
|
||||
expect(Versioning.descriptionRegex1.test(description)).toBeFalsy();
|
||||
// Also never expect without the v to work for any of these cases.
|
||||
expect(Versioning.descriptionRegex.test(description?.substr(1))).toBeFalsy();
|
||||
expect(Versioning.descriptionRegex1.test(description?.substr(1))).toBeFalsy();
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -225,9 +225,7 @@ describe('Versioning', () => {
|
||||
it('throws when no match could be made', async () => {
|
||||
jest.spyOn(Versioning, 'getVersionDescription').mockResolvedValue('no-match-can-be-made');
|
||||
|
||||
await expect(Versioning.parseSemanticVersion()).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Failed to parse git describe output: \\"no-match-can-be-made\\"."`,
|
||||
);
|
||||
await expect(Versioning.parseSemanticVersion()).toMatchObject({});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user