-
-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add version parsing support for non-numeric patches (to include built… (
#853) * Add version parsing support for non-numeric patches (to include built from source `d.d.SSS`) Closes #852
- Loading branch information
Showing
3 changed files
with
85 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"simple-git": patch | ||
--- | ||
|
||
Add version parsing support for non-numeric patches (including "built from source" style `1.11.GIT`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { closeWithError, closeWithSuccess, newSimpleGit } from './__fixtures__'; | ||
|
||
describe('version', () => { | ||
it('sringifies to version', async () => { | ||
const version = newSimpleGit().version(); | ||
await closeWithSuccess('git version 2.50.10 (Apple Git-133)'); | ||
|
||
expect(String(await version)).toBe('2.50.10'); | ||
}); | ||
|
||
it('detects missing', async () => { | ||
const version = newSimpleGit().version(); | ||
await closeWithError('FAIL', -2); | ||
|
||
expect(await version).toEqual({ | ||
installed: false, | ||
major: 0, | ||
minor: 0, | ||
patch: 0, | ||
agent: '', | ||
}); | ||
}); | ||
|
||
it('parses apple', async () => { | ||
const version = newSimpleGit().version(); | ||
await closeWithSuccess('git version 2.32.1 (Apple Git-133)'); | ||
|
||
expect(await version).toEqual({ | ||
installed: true, | ||
major: 2, | ||
minor: 32, | ||
patch: 1, | ||
agent: 'Apple Git-133', | ||
}); | ||
}); | ||
|
||
it('parses git from source', async () => { | ||
const version = newSimpleGit().version(); | ||
await closeWithSuccess('git version 2.37.GIT'); | ||
|
||
expect(await version).toEqual({ | ||
installed: true, | ||
major: 2, | ||
minor: 37, | ||
patch: 'GIT', | ||
agent: '', | ||
}); | ||
}); | ||
}); |