|
1 | 1 | import path from 'path' |
2 | 2 | import execa from 'execa' |
3 | | -import execGit from '../lib/execGit' |
| 3 | + |
| 4 | +import execGit, { GIT_GLOBAL_OPTIONS } from '../lib/execGit' |
| 5 | + |
| 6 | +test('GIT_GLOBAL_OPTIONS', () => { |
| 7 | + expect(GIT_GLOBAL_OPTIONS).toMatchInlineSnapshot(` |
| 8 | + Array [ |
| 9 | + "-c", |
| 10 | + "submodule.recurse=false", |
| 11 | + ] |
| 12 | + `) |
| 13 | +}) |
4 | 14 |
|
5 | 15 | describe('execGit', () => { |
6 | 16 | it('should execute git in process.cwd if working copy is not specified', async () => { |
7 | 17 | const cwd = process.cwd() |
8 | 18 | await execGit(['init', 'param']) |
9 | | - expect(execa).toHaveBeenCalledWith('git', ['init', 'param'], { all: true, cwd }) |
| 19 | + expect(execa).toHaveBeenCalledWith('git', [...GIT_GLOBAL_OPTIONS, 'init', 'param'], { |
| 20 | + all: true, |
| 21 | + cwd, |
| 22 | + }) |
10 | 23 | }) |
11 | 24 |
|
12 | 25 | it('should execute git in a given working copy', async () => { |
13 | 26 | const cwd = path.join(process.cwd(), 'test', '__fixtures__') |
14 | 27 | await execGit(['init', 'param'], { cwd }) |
15 | | - expect(execa).toHaveBeenCalledWith('git', ['init', 'param'], { all: true, cwd }) |
| 28 | + expect(execa).toHaveBeenCalledWith('git', [...GIT_GLOBAL_OPTIONS, 'init', 'param'], { |
| 29 | + all: true, |
| 30 | + cwd, |
| 31 | + }) |
16 | 32 | }) |
17 | 33 | }) |
0 commit comments