@@ -11,9 +11,11 @@ describe('git repository-status', () => {
11
11
12
12
describe ( 'verifyGitStatus' , ( ) => {
13
13
let getRepositoryStatus : sinon . SinonStub ;
14
+ let spawnSync : sinon . SinonStub ;
14
15
15
16
beforeEach ( ( ) => {
16
17
getRepositoryStatus = sinon . stub ( ) ;
18
+ spawnSync = sinon . stub ( ) ;
17
19
} ) ;
18
20
19
21
[ 'master' , 'main' , 'release/v0.8.0' , 'release/v0.8.x' ] . forEach ( branchName => {
@@ -28,8 +30,9 @@ describe('git repository-status', () => {
28
30
hasUnpushedTags : false
29
31
} ;
30
32
getRepositoryStatus . returns ( status ) ;
31
- const returnedStatus = verifyGitStatus ( 'root' , getRepositoryStatus ) ;
33
+ const returnedStatus = verifyGitStatus ( 'root' , getRepositoryStatus , spawnSync ) ;
32
34
expect ( returnedStatus ) . to . equal ( status ) ;
35
+ expect ( spawnSync ) . to . have . been . calledWith ( 'git' , [ 'fetch' , '--tags' ] , sinon . match . object ) ;
33
36
} ) ;
34
37
} ) ;
35
38
@@ -40,7 +43,7 @@ describe('git repository-status', () => {
40
43
} ;
41
44
getRepositoryStatus . returns ( status ) ;
42
45
try {
43
- verifyGitStatus ( 'root' , getRepositoryStatus ) ;
46
+ verifyGitStatus ( 'root' , getRepositoryStatus , spawnSync ) ;
44
47
} catch ( e ) {
45
48
expect ( e . message ) . to . contain ( 'Could not determine local repository information' ) ;
46
49
return ;
@@ -60,7 +63,7 @@ describe('git repository-status', () => {
60
63
} ;
61
64
getRepositoryStatus . returns ( status ) ;
62
65
try {
63
- verifyGitStatus ( 'root' , getRepositoryStatus ) ;
66
+ verifyGitStatus ( 'root' , getRepositoryStatus , spawnSync ) ;
64
67
} catch ( e ) {
65
68
expect ( e . message ) . to . contain ( 'The current branch does not match' ) ;
66
69
return ;
@@ -80,7 +83,7 @@ describe('git repository-status', () => {
80
83
} ;
81
84
getRepositoryStatus . returns ( status ) ;
82
85
try {
83
- verifyGitStatus ( 'root' , getRepositoryStatus ) ;
86
+ verifyGitStatus ( 'root' , getRepositoryStatus , spawnSync ) ;
84
87
} catch ( e ) {
85
88
expect ( e . message ) . to . contain ( 'The branch you are on is not tracking any remote branch.' ) ;
86
89
return ;
@@ -100,7 +103,7 @@ describe('git repository-status', () => {
100
103
} ;
101
104
getRepositoryStatus . returns ( status ) ;
102
105
try {
103
- verifyGitStatus ( 'root' , getRepositoryStatus ) ;
106
+ verifyGitStatus ( 'root' , getRepositoryStatus , spawnSync ) ;
104
107
} catch ( e ) {
105
108
expect ( e . message ) . to . contain ( 'Your local repository is not clean or diverged from the remote branch' ) ;
106
109
return ;
@@ -120,7 +123,7 @@ describe('git repository-status', () => {
120
123
} ;
121
124
getRepositoryStatus . returns ( status ) ;
122
125
try {
123
- verifyGitStatus ( 'root' , getRepositoryStatus ) ;
126
+ verifyGitStatus ( 'root' , getRepositoryStatus , spawnSync ) ;
124
127
} catch ( e ) {
125
128
expect ( e . message ) . to . contain ( 'Your local repository is not clean or diverged from the remote branch' ) ;
126
129
return ;
@@ -140,7 +143,7 @@ describe('git repository-status', () => {
140
143
} ;
141
144
getRepositoryStatus . returns ( status ) ;
142
145
try {
143
- verifyGitStatus ( 'root' , getRepositoryStatus ) ;
146
+ verifyGitStatus ( 'root' , getRepositoryStatus , spawnSync ) ;
144
147
} catch ( e ) {
145
148
expect ( e . message ) . to . contain ( 'You have local tags that are not pushed to the remote' ) ;
146
149
return ;
0 commit comments