dugite
dugite copied to clipboard
execTask.cancel()
First I tried this, something like this:
temp.mkdirSync('desktop-git-clone-and-cancel')
...
const result = GitProcess.execTask(
['clone', '--', 'https://github.com/maifeeulasad/maifeeulasad.github.io', '.'],
testCancelRepoPath,
options
)
expect(await result.cancel()).toBe(GitTaskCancelResult.successfulCancel)
But it gave me: exitCode › returns exit code when folder is empty
So I tried fs.mkdtemp(_,folder)
But now I get: exitCode › handles stdin closed errors
I can see, all these exit codes/messages are somehow related to other tests. But I'm not familiar with these. Can you guys help me here? @sergiou87 @tidy-dev
@sergiou87 that didn't work. But there are some questions, I wanted to know, like:
- if the clone test is done here with
--
, why remove that in this case, cause our method is just an extension to that. - what does this error code even mean?
git-process › exitCode › returns exit code when folder is empty
I think part of the problem is you are using an async version of mkdtemp
, try this:
it('clone-and-cancel', async () => {
const tempDir = path.join(os.tmpdir(), 'desktop-git-clone-and-cancel-')
const folder = fs.mkdtempSync(tempDir)
const options = {
env: setupNoAuth()
}
const task = GitProcess.execTask(
['clone', '--', 'https://github.com/maifeeulasad/maifeeulasad.github.io', '.'],
folder,
options
)
const cancelResult = await task.cancel()
await task.result
expect(cancelResult).toBe(GitTaskCancelResult.successfulCancel)
})
Of course that test is incorrect, but should be a good base to start working on! 😄
Superseded by #495