@@ -35,38 +35,15 @@ describe('Unit: Doctor Checks > Install', function () {
3535 } ) ;
3636
3737 describe ( 'node version check' , function ( ) {
38- it ( 'rejects if global bin is different than the one ghost is running from' , function ( ) {
39- const execaStub = sinon . stub ( ) . returns ( { stdout : '/usr/local/bin' } ) ;
40- const originalArgv = process . argv ;
41- process . argv = [ 'node' , '/home/ghost/.nvm/versions/6.11.1/bin' ] ;
42-
43- const task = proxyquire ( modulePath , {
44- execa : { shellSync : execaStub }
45- } ) . tasks . nodeVersion ;
46-
47- return task ( ) . then ( ( ) => {
48- expect ( false , 'error should be thrown' ) . to . be . true ;
49- process . argv = originalArgv ;
50- } ) . catch ( ( error ) => {
51- process . argv = originalArgv ;
52- expect ( error ) . to . be . an . instanceof ( errors . SystemError ) ;
53- expect ( error . message ) . to . match ( / v e r s i o n o f G h o s t - C L I y o u a r e r u n n i n g w a s n o t i n s t a l l e d w i t h t h i s v e r s i o n o f N o d e ./ ) ;
54- expect ( execaStub . calledOnce ) . to . be . true ;
55- expect ( execaStub . calledWithExactly ( 'npm bin -g' , { preferLocal : false } ) ) . to . be . true ;
56- } ) ;
57- } ) ;
58-
5938 it ( 'rejects if node version is not in range' , function ( ) {
6039 const cliPackage = {
6140 engines : {
6241 node : '0.10.0'
6342 }
6443 } ;
65- const execaStub = sinon . stub ( ) . returns ( { stdout : process . argv [ 1 ] } ) ;
6644
6745 const task = proxyquire ( modulePath , {
68- '../../../../package' : cliPackage ,
69- execa : { shellSync : execaStub }
46+ '../../../../package' : cliPackage
7047 } ) . tasks . nodeVersion ;
7148
7249 return task ( ) . then ( ( ) => {
@@ -77,7 +54,6 @@ describe('Unit: Doctor Checks > Install', function () {
7754
7855 expect ( message ) . to . match ( / S u p p o r t e d : 0 .1 0 .0 / ) ;
7956 expect ( message ) . to . match ( new RegExp ( `Installed: ${ process . versions . node } ` ) ) ;
80- expect ( execaStub . calledOnce ) . to . be . true ;
8157 } ) ;
8258 } ) ;
8359
@@ -87,19 +63,16 @@ describe('Unit: Doctor Checks > Install', function () {
8763 node : process . versions . node // this future-proofs the test
8864 }
8965 } ;
90- const execaStub = sinon . stub ( ) . returns ( { stdout : '/usr/local/bin' } ) ;
9166 const originalArgv = process . argv ;
9267 process . argv = [ 'node' , path . join ( __dirname , '../../../../bin/ghost' ) ] ;
9368
9469 const tasks = proxyquire ( modulePath , {
95- '../../../../package' : cliPackage ,
96- execa : { shellSync : execaStub }
70+ '../../../../package' : cliPackage
9771 } ) . tasks ;
9872 const checkDirectoryStub = sinon . stub ( tasks , 'checkDirectoryAndAbove' ) . resolves ( ) ;
9973
10074 return tasks . nodeVersion ( { local : true } ) . then ( ( ) => {
10175 process . argv = originalArgv ;
102- expect ( execaStub . calledOnce ) . to . be . true ;
10376 expect ( checkDirectoryStub . called ) . to . be . false ;
10477 } ) ;
10578 } ) ;
@@ -112,17 +85,14 @@ describe('Unit: Doctor Checks > Install', function () {
11285 }
11386 } ;
11487 process . env = { GHOST_NODE_VERSION_CHECK : 'false' } ;
115- const execaStub = sinon . stub ( ) . returns ( { stdout : process . argv [ 1 ] } ) ;
11688
11789 const tasks = proxyquire ( modulePath , {
118- '../../../../package' : cliPackage ,
119- execa : { shellSync : execaStub }
90+ '../../../../package' : cliPackage
12091 } ) . tasks ;
12192 const checkDirectoryStub = sinon . stub ( tasks , 'checkDirectoryAndAbove' ) . resolves ( ) ;
12293
12394 return tasks . nodeVersion ( { local : true } ) . then ( ( ) => {
12495 process . env = originalEnv ;
125- expect ( execaStub . calledOnce ) . to . be . true ;
12696 expect ( checkDirectoryStub . called ) . to . be . false ;
12797 } ) ;
12898 } ) ;
@@ -133,16 +103,13 @@ describe('Unit: Doctor Checks > Install', function () {
133103 node : process . versions . node // this future-proofs the test
134104 }
135105 } ;
136- const execaStub = sinon . stub ( ) . returns ( { stdout : process . argv [ 1 ] } ) ;
137106
138107 const tasks = proxyquire ( modulePath , {
139- '../../../../package' : cliPackage ,
140- execa : { shellSync : execaStub }
108+ '../../../../package' : cliPackage
141109 } ) . tasks ;
142110 const checkDirectoryStub = sinon . stub ( tasks , 'checkDirectoryAndAbove' ) . resolves ( ) ;
143111
144112 return tasks . nodeVersion ( { local : true } ) . then ( ( ) => {
145- expect ( execaStub . calledOnce ) . to . be . true ;
146113 expect ( checkDirectoryStub . called ) . to . be . false ;
147114 } ) ;
148115 } ) ;
@@ -153,18 +120,15 @@ describe('Unit: Doctor Checks > Install', function () {
153120 node : process . versions . node // this future-proofs the test
154121 }
155122 } ;
156- const execaStub = sinon . stub ( ) . returns ( { stdout : process . argv [ 1 ] } ) ;
157123 const platformStub = sinon . stub ( ) . returns ( 'darwin' ) ;
158124
159125 const tasks = proxyquire ( modulePath , {
160126 '../../../../package' : cliPackage ,
161- execa : { shellSync : execaStub } ,
162127 os : { platform : platformStub }
163128 } ) . tasks ;
164129 const checkDirectoryStub = sinon . stub ( tasks , 'checkDirectoryAndAbove' ) . resolves ( ) ;
165130
166131 return tasks . nodeVersion ( { local : false } ) . then ( ( ) => {
167- expect ( execaStub . calledOnce ) . to . be . true ;
168132 expect ( checkDirectoryStub . called ) . to . be . false ;
169133 } ) ;
170134 } ) ;
@@ -175,18 +139,15 @@ describe('Unit: Doctor Checks > Install', function () {
175139 node : process . versions . node // this future-proofs the test
176140 }
177141 } ;
178- const execaStub = sinon . stub ( ) . returns ( { stdout : process . argv [ 1 ] } ) ;
179142 const platformStub = sinon . stub ( ) . returns ( 'linux' ) ;
180143
181144 const tasks = proxyquire ( modulePath , {
182145 '../../../../package' : cliPackage ,
183- execa : { shellSync : execaStub } ,
184146 os : { platform : platformStub }
185147 } ) . tasks ;
186148 const checkDirectoryStub = sinon . stub ( tasks , 'checkDirectoryAndAbove' ) . resolves ( ) ;
187149
188150 return tasks . nodeVersion ( { local : false , argv : { 'setup-linux-user' : false } } ) . then ( ( ) => {
189- expect ( execaStub . calledOnce ) . to . be . true ;
190151 expect ( checkDirectoryStub . called ) . to . be . false ;
191152 } ) ;
192153 } ) ;
@@ -197,18 +158,15 @@ describe('Unit: Doctor Checks > Install', function () {
197158 node : process . versions . node // this future-proofs the test
198159 }
199160 } ;
200- const execaStub = sinon . stub ( ) . returns ( { stdout : process . argv [ 1 ] } ) ;
201161 const platformStub = sinon . stub ( ) . returns ( 'linux' ) ;
202162
203163 const tasks = proxyquire ( modulePath , {
204164 '../../../../package' : cliPackage ,
205- execa : { shellSync : execaStub } ,
206165 os : { platform : platformStub }
207166 } ) . tasks ;
208167 const checkDirectoryStub = sinon . stub ( tasks , 'checkDirectoryAndAbove' ) . resolves ( ) ;
209168
210169 return tasks . nodeVersion ( { local : false , argv : { 'setup-linux-user' : true } } ) . then ( ( ) => {
211- expect ( execaStub . calledOnce ) . to . be . true ;
212170 expect ( checkDirectoryStub . calledOnce ) . to . be . true ;
213171 expect ( checkDirectoryStub . calledWith ( process . argv [ 0 ] ) ) . to . be . true ;
214172 } ) ;
0 commit comments