Skip to content

Commit

Permalink
Merge pull request #594 from desktop/remove-find-git-exec
Browse files Browse the repository at this point in the history
Don't require an external Git installation to run tests
  • Loading branch information
niik authored Oct 22, 2024
2 parents 2f60e88 + 968f69c commit 7277c97
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 44 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"@types/progress": "^2.0.1",
"@types/rimraf": "2.0.2",
"@types/temp": "^0.9.4",
"find-git-exec": "^0.0.4",
"node-test-github-reporter": "^1.2.0",
"prettier": "^3.3.1",
"rimraf": "^5.0.7",
Expand Down
30 changes: 6 additions & 24 deletions test/external/git-process-external-test.ts
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)
})
})
})
19 changes: 0 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,6 @@
dependencies:
undici-types "~6.19.2"

"@types/node@^10.14.22":
version "10.17.60"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b"
integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==

"@types/progress@^2.0.1":
version "2.0.5"
resolved "https://registry.yarnpkg.com/@types/progress/-/progress-2.0.5.tgz#6e0febf3a82cc0ffdc1cebb4e56d6949fd108775"
Expand All @@ -224,11 +219,6 @@
dependencies:
"@types/node" "*"

"@types/which@^1.3.2":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.3.2.tgz#9c246fc0c93ded311c8512df2891fb41f6227fdf"
integrity sha512-8oDqyLC7eD4HM307boe2QWKyuzdzWBj56xI/imSl2cpL+U3tCMaTAkMJ4ee5JBZ/FsOJlvRGeIShiZDAl1qERA==

ansi-regex@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
Expand Down Expand Up @@ -369,15 +359,6 @@ fast-fifo@^1.2.0, fast-fifo@^1.3.2:
resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c"
integrity sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==

find-git-exec@^0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/find-git-exec/-/find-git-exec-0.0.4.tgz#f1d0d35f93ad99bc81aacd357388d00ae902bc92"
integrity sha512-klzQwno+dpdeahtHhvZZ5Yn6K+zme1Aj+YJ4ZD+DywSLrQoyCywTrsubUZa1hHRehmfwBThoeKjS7fsaxhpfNA==
dependencies:
"@types/node" "^10.14.22"
"@types/which" "^1.3.2"
which "^2.0.1"

foreground-child@^3.1.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.0.tgz#0ac8644c06e431439f8561db8ecf29a7b5519c77"
Expand Down

0 comments on commit 7277c97

Please sign in to comment.