-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #594 from desktop/remove-find-git-exec
Don't require an external Git installation to run tests
- Loading branch information
Showing
3 changed files
with
6 additions
and
44 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
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 |
---|---|---|
@@ -1,34 +1,16 @@ | ||
import { resolve } from 'path' | ||
import findGit from 'find-git-exec' | ||
|
||
import { verify } from '../helpers' | ||
import { track } from 'temp' | ||
import { describe, it } from 'node:test' | ||
import assert from 'assert' | ||
import { exec } from '../../lib' | ||
|
||
const temp = track() | ||
|
||
const getExternalGitEnvironment = () => | ||
findGit().then(({ path, execPath }) => ({ | ||
GIT_EXEC_PATH: execPath, | ||
LOCAL_GIT_DIRECTORY: resolve(path, '../../'), | ||
})) | ||
import { setupEnvironment } from '../../lib' | ||
import { tmpdir } from 'os' | ||
|
||
describe('git-process [with external Git executable]', () => { | ||
describe('--exec-path', () => { | ||
it('returns exit code when successful', async () => { | ||
const env = await getExternalGitEnvironment() | ||
|
||
const testRepoPath = temp.mkdirSync('desktop-git-clone-valid-external') | ||
const result = await exec(['--exec-path'], testRepoPath, { | ||
env, | ||
}) | ||
const embedded = setupEnvironment({}, {}) | ||
const external = setupEnvironment({ LOCAL_GIT_DIRECTORY: tmpdir() }, {}) | ||
|
||
verify(result, r => assert.equal(r.exitCode, 0)) | ||
verify(result, r => | ||
assert.equal(resolve(r.stdout.trim()), resolve(env.GIT_EXEC_PATH)) | ||
) | ||
assert.notEqual(embedded.env.GIT_EXEC_PATH, external.env.GIT_EXEC_PATH) | ||
assert.notEqual(external.gitLocation, embedded.gitLocation) | ||
}) | ||
}) | ||
}) |
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