-
-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(remote): Replace exec with execFile for improved security #270
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Warning Rate limit exceeded@yamadashy has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 2 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe pull request modifies the Git command execution approach in the Changes
Sequence DiagramsequenceDiagram
participant Client
participant GitCommand
participant ChildProcess
Client->>GitCommand: Request Git operation
GitCommand->>ChildProcess: execFileAsync('git', [arguments])
ChildProcess-->>GitCommand: Return command execution result
GitCommand-->>Client: Provide operation result
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
🧹 Nitpick comments (1)
src/core/file/gitCommand.ts (1)
35-36
: Good practice of specifying arguments in an array.
Bothfetch
andcheckout
commands are now parameterized, reducing injection risks. However, be sure to update the corresponding tests.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/core/file/gitCommand.ts
(3 hunks)tests/core/file/gitCommand.test.ts
(4 hunks)
🧰 Additional context used
🪛 GitHub Check: Test (macos-latest, 20.x)
tests/core/file/gitCommand.test.ts
[failure] 19-19: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return true when git is installed
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:19:33
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
[failure] 51-51: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute without branch option if not specified by user
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:51:33
[failure] 63-63: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git clone fails
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:63:33
[failure] 75-75: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute commands correctly when branch is specified
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:75:33
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:99:33
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:122:33
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (macos-latest, 18.x)
tests/core/file/gitCommand.test.ts
[failure] 19-19: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return true when git is installed
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:19:33
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
[failure] 51-51: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute without branch option if not specified by user
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:51:33
[failure] 63-63: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git clone fails
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:63:33
[failure] 75-75: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute commands correctly when branch is specified
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:75:33
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:99:33
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:122:33
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (macos-latest, 18.20.0)
tests/core/file/gitCommand.test.ts
[failure] 19-19: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return true when git is installed
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:19:33
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
[failure] 51-51: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute without branch option if not specified by user
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:51:33
[failure] 63-63: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git clone fails
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:63:33
[failure] 75-75: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute commands correctly when branch is specified
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:75:33
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:99:33
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:122:33
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (ubuntu-latest, 23.x)
tests/core/file/gitCommand.test.ts
[failure] 19-19: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return true when git is installed
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:19:33
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
[failure] 51-51: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute without branch option if not specified by user
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:51:33
[failure] 63-63: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git clone fails
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:63:33
[failure] 75-75: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute commands correctly when branch is specified
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:75:33
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:99:33
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:122:33
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (ubuntu-latest, 22.x)
tests/core/file/gitCommand.test.ts
[failure] 19-19: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return true when git is installed
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:19:33
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
[failure] 51-51: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute without branch option if not specified by user
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:51:33
[failure] 63-63: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git clone fails
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:63:33
[failure] 75-75: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute commands correctly when branch is specified
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:75:33
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:99:33
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:122:33
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (ubuntu-latest, 20.x)
tests/core/file/gitCommand.test.ts
[failure] 19-19: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return true when git is installed
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:19:33
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
[failure] 51-51: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute without branch option if not specified by user
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:51:33
[failure] 63-63: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git clone fails
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:63:33
[failure] 75-75: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute commands correctly when branch is specified
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:75:33
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:99:33
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:122:33
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (ubuntu-latest, 18.x)
tests/core/file/gitCommand.test.ts
[failure] 19-19: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return true when git is installed
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:19:33
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
[failure] 51-51: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute without branch option if not specified by user
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:51:33
[failure] 63-63: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git clone fails
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:63:33
[failure] 75-75: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute commands correctly when branch is specified
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:75:33
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:99:33
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:122:33
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (ubuntu-latest, 18.20.0)
tests/core/file/gitCommand.test.ts
[failure] 19-19: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return true when git is installed
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:19:33
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]
Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
-
"--version",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
[failure] 51-51: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute without branch option if not specified by user
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:51:33
[failure] 63-63: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git clone fails
AssertionError: expected "spy" to be called with arguments: [ Array(1) ]
Received:
1st spy call:
Array [
- "git clone --depth 1 https://github.com/user/repo.git /tmp/repo",
- "git",
- Array [
-
"clone",
-
"--depth",
-
"1",
-
"https://github.com/user/repo.git",
-
"/tmp/repo",
- ],
]
Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:63:33
[failure] 75-75: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should execute commands correctly when branch is specified
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:75:33
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:99:33
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:122:33
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
-
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
-
"-C",
-
"/tmp/repo",
-
"init",
- ],
]
❯ tests/core/file/gitCommand.test.ts:145:33
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Lint Renovate config
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (10)
src/core/file/gitCommand.ts (5)
1-1
: Switch fromexec
toexecFile
looks good.
This is a secure practice asexecFile
does not spawn a shell, thus mitigating shell-injection risks.
7-7
: Promisify usage is appropriate.
WrappingexecFile
withpromisify
to get a promise-based API is a clean approach.
11-11
: Dependency injection pattern is consistent.
PassingexecFileAsync
indeps
simplifies testing by allowing mocks to be injected.
28-28
: Dependency injection is still consistent.
No concerns here; references toexecFileAsync
indeps
are correct.
59-60
: Comprehensive fallback for short SHA scenario.
Continuing to useexecFileAsync
is safe. Just ensure your test suite is aligned with the new approach.tests/core/file/gitCommand.test.ts (5)
23-28
: Same mismatch in the failing test.
This block also expects'git --version'
as a single string. Apply the same fix.🧰 Tools
🪛 GitHub Check: Test (macos-latest, 20.x)
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
🪛 GitHub Check: Test (macos-latest, 18.x)
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
🪛 GitHub Check: Test (macos-latest, 18.20.0)
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
🪛 GitHub Check: Test (ubuntu-latest, 23.x)
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
🪛 GitHub Check: Test (ubuntu-latest, 22.x)
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
🪛 GitHub Check: Test (ubuntu-latest, 20.x)
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
🪛 GitHub Check: Test (ubuntu-latest, 18.x)
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
🪛 GitHub Check: Test (ubuntu-latest, 18.20.0)
[failure] 28-28: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command fails
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:28:33
33-38
: Again, fix the expected arguments.
Your code now calls'git', ['--version']
. The test must match accordingly.🧰 Tools
🪛 GitHub Check: Test (macos-latest, 20.x)
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
🪛 GitHub Check: Test (macos-latest, 18.x)
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
🪛 GitHub Check: Test (macos-latest, 18.20.0)
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
🪛 GitHub Check: Test (ubuntu-latest, 23.x)
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
🪛 GitHub Check: Test (ubuntu-latest, 22.x)
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
🪛 GitHub Check: Test (ubuntu-latest, 20.x)
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
🪛 GitHub Check: Test (ubuntu-latest, 18.x)
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
🪛 GitHub Check: Test (ubuntu-latest, 18.20.0)
[failure] 38-38: tests/core/file/gitCommand.test.ts > gitCommand > isGitInstalled > should return false when git command returns stderr
AssertionError: expected "spy" to be called with arguments: [ 'git --version' ]Received:
1st spy call:
Array [
- "git --version",
- "git",
- Array [
"--version",
- ],
]Number of calls: 1
❯ tests/core/file/gitCommand.test.ts:38:33
Line range hint
85-101
: Same array mismatch in the fetch tests.
All references togit -C ... fetch ...
likewise need updating to['-C', directory, 'fetch', ...]
.🧰 Tools
🪛 GitHub Check: Test (macos-latest, 20.x)
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:99:33
🪛 GitHub Check: Test (macos-latest, 18.x)
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:99:33
🪛 GitHub Check: Test (macos-latest, 18.20.0)
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:99:33
🪛 GitHub Check: Test (ubuntu-latest, 23.x)
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:99:33
🪛 GitHub Check: Test (ubuntu-latest, 22.x)
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:99:33
🪛 GitHub Check: Test (ubuntu-latest, 20.x)
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:99:33
🪛 GitHub Check: Test (ubuntu-latest, 18.x)
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:99:33
🪛 GitHub Check: Test (ubuntu-latest, 18.20.0)
[failure] 99-99: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when git fetch fails
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:99:33
Line range hint
109-126
: Short SHA fallback scenario also needs the updated array arguments.
Your code calls'git', ['-C', directory, 'fetch', '-depth', '1', ...]
, but test expects the single-string format.🧰 Tools
🪛 GitHub Check: Test (macos-latest, 20.x)
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:122:33
🪛 GitHub Check: Test (macos-latest, 18.x)
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:122:33
🪛 GitHub Check: Test (macos-latest, 18.20.0)
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:122:33
🪛 GitHub Check: Test (ubuntu-latest, 23.x)
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:122:33
🪛 GitHub Check: Test (ubuntu-latest, 22.x)
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:122:33
🪛 GitHub Check: Test (ubuntu-latest, 20.x)
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:122:33
🪛 GitHub Check: Test (ubuntu-latest, 18.x)
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:122:33
🪛 GitHub Check: Test (ubuntu-latest, 18.20.0)
[failure] 122-122: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should handle short SHA correctly
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:122:33
135-147
: Likewise for the remote ref not found scenario.
EnsuretoHaveBeenNthCalledWith()
matchesexecFileAsync('git', ['-C', directory, ...])
.🧰 Tools
🪛 GitHub Check: Test (macos-latest, 20.x)
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (macos-latest, 18.x)
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (macos-latest, 18.20.0)
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (ubuntu-latest, 23.x)
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (ubuntu-latest, 22.x)
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (ubuntu-latest, 20.x)
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (ubuntu-latest, 18.x)
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:145:33
🪛 GitHub Check: Test (ubuntu-latest, 18.20.0)
[failure] 145-145: tests/core/file/gitCommand.test.ts > gitCommand > execGitShallowClone > should throw error when remote ref is not found, and it's not due to short SHA
AssertionError: expected 1st "spy" call to have been called with [ 'git -C /tmp/repo init' ]
- Expected
Received
Array [
- "git -C /tmp/repo init",
- "git",
- Array [
"-C",
"/tmp/repo",
"init",
- ],
]❯ tests/core/file/gitCommand.test.ts:145:33
14457a2
to
102027b
Compare
Deploying repomix with Cloudflare Pages
|
102027b
to
3a16b16
Compare
import fs from 'node:fs/promises'; | ||
import path from 'node:path'; | ||
import { promisify } from 'node:util'; | ||
import { logger } from '../../shared/logger.js'; | ||
|
||
const execAsync = promisify(exec); | ||
const execFileAsync = promisify(execFile); | ||
|
||
export const isGitInstalled = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const isGitInstalled = async ( | |
/** | |
* Checks if Git is installed by executing the 'git --version' command. | |
* | |
* @param {Object} deps - Dependencies that can be injected for testing. | |
* @param {Function} deps.execFileAsync - Function to execute a file asynchronously. | |
* @returns {Promise<boolean>} - Returns true if Git is installed, false otherwise. | |
*/ | |
export const isGitInstalled = async ( |
add docstring to isGitInstalled function
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #270 +/- ##
==========================================
- Coverage 92.23% 92.00% -0.23%
==========================================
Files 44 44
Lines 2125 2140 +15
Branches 463 467 +4
==========================================
+ Hits 1960 1969 +9
- Misses 165 171 +6 ☔ View full report in Codecov by Sentry. |
3a16b16
to
91c4b60
Compare
Checklist
npm run test
npm run lint