@@ -40,11 +40,10 @@ describe('npmAdapter', () => {
4040 } ) ;
4141 } ) ;
4242
43- it ( 'backs up the yarn.lock file, npm-shrinkwrap.json and package-lock.json if they exist' , async ( ) => {
43+ it ( 'backs up the yarn.lock file and package-lock.json if they exist' , async ( ) => {
4444 fs . mkdirSync ( 'node_modules' ) ;
4545 writeJSONFile ( 'package.json' , { originalPackageJSON : true } ) ;
4646 writeJSONFile ( 'yarn.lock' , { originalYarnLock : true } ) ;
47- writeJSONFile ( 'npm-shrinkwrap.json' , { originalNpmShrinkWrap : true } ) ;
4847 writeJSONFile ( 'package-lock.json' , { originalPackageLock : true } ) ;
4948
5049 let adapter = new NpmAdapter ( { cwd : tmpdir } ) ;
@@ -56,9 +55,6 @@ describe('npmAdapter', () => {
5655 assertFileContainsJSON ( path . join ( tmpdir , 'yarn.lock.ember-try' ) , {
5756 originalYarnLock : true ,
5857 } ) ;
59- assertFileContainsJSON ( path . join ( tmpdir , 'npm-shrinkwrap.json.ember-try' ) , {
60- originalNpmShrinkWrap : true ,
61- } ) ;
6258 assertFileContainsJSON ( path . join ( tmpdir , 'package-lock.json.ember-try' ) , {
6359 originalPackageLock : true ,
6460 } ) ;
@@ -67,26 +63,19 @@ describe('npmAdapter', () => {
6763
6864 describe ( '#_install' , ( ) => {
6965 describe ( 'without yarn' , ( ) => {
70- it ( 'only runs npm install with npm 5 ' , async ( ) => {
66+ it ( 'runs npm install' , async ( ) => {
7167 writeJSONFile ( 'package.json' , fixturePackage ) ;
7268 let runCount = 0 ;
7369 let stubbedRun = generateMockRun (
7470 [
7571 {
76- command : 'npm install --no-shrinkwrap ' ,
72+ command : 'npm install --no-package-lock ' ,
7773 callback ( command , args , opts ) {
7874 runCount ++ ;
7975 expect ( opts ) . to . have . property ( 'cwd' , tmpdir ) ;
8076 return RSVP . resolve ( ) ;
8177 } ,
8278 } ,
83- {
84- command : 'npm --version' ,
85- callback ( ) {
86- runCount ++ ;
87- return RSVP . resolve ( { stdout : '5.7.1' } ) ;
88- } ,
89- } ,
9079 ] ,
9180 { allowPassthrough : false }
9281 ) ;
@@ -97,48 +86,7 @@ describe('npmAdapter', () => {
9786 } ) ;
9887
9988 await adapter . _install ( ) ;
100- expect ( runCount ) . to . equal ( 2 ) ;
101- } ) ;
102-
103- it ( 'runs npm prune and npm install with npm 4' , async ( ) => {
104- writeJSONFile ( 'package.json' , fixturePackage ) ;
105- let runCount = 0 ;
106- let stubbedRun = generateMockRun (
107- [
108- {
109- command : 'npm install --no-shrinkwrap' ,
110- callback ( command , args , opts ) {
111- runCount ++ ;
112- expect ( opts ) . to . have . property ( 'cwd' , tmpdir ) ;
113- return RSVP . resolve ( ) ;
114- } ,
115- } ,
116- {
117- command : 'npm prune' ,
118- callback ( command , args , opts ) {
119- runCount ++ ;
120- expect ( opts ) . to . have . property ( 'cwd' , tmpdir ) ;
121- return RSVP . resolve ( ) ;
122- } ,
123- } ,
124- {
125- command : 'npm --version' ,
126- callback ( ) {
127- runCount ++ ;
128- return RSVP . resolve ( { stdout : '4.7.1' } ) ;
129- } ,
130- } ,
131- ] ,
132- { allowPassthrough : false }
133- ) ;
134-
135- let adapter = new NpmAdapter ( {
136- cwd : tmpdir ,
137- run : stubbedRun ,
138- } ) ;
139-
140- await adapter . _install ( ) ;
141- expect ( runCount ) . to . equal ( 3 , 'All three commands should run' ) ;
89+ expect ( runCount ) . to . equal ( 1 ) ;
14290 } ) ;
14391
14492 it ( 'uses managerOptions for npm commands' , async ( ) => {
@@ -147,19 +95,12 @@ describe('npmAdapter', () => {
14795 let stubbedRun = generateMockRun (
14896 [
14997 {
150- command : 'npm install --no-optional --no-shrinkwrap ' ,
98+ command : 'npm install --no-optional --no-package-lock ' ,
15199 callback ( ) {
152100 runCount ++ ;
153101 return RSVP . resolve ( ) ;
154102 } ,
155103 } ,
156- {
157- command : 'npm --version' ,
158- callback ( ) {
159- runCount ++ ;
160- return RSVP . resolve ( { stdout : '5.7.1' } ) ;
161- } ,
162- } ,
163104 ] ,
164105 { allowPassthrough : false }
165106 ) ;
@@ -171,7 +112,7 @@ describe('npmAdapter', () => {
171112 } ) ;
172113
173114 await adapter . _install ( ) ;
174- expect ( runCount ) . to . equal ( 2 ) ;
115+ expect ( runCount ) . to . equal ( 1 ) ;
175116 } ) ;
176117
177118 it ( 'uses buildManagerOptions for npm commands' , async ( ) => {
@@ -186,13 +127,6 @@ describe('npmAdapter', () => {
186127 return RSVP . resolve ( ) ;
187128 } ,
188129 } ,
189- {
190- command : 'npm --version' ,
191- callback ( ) {
192- runCount ++ ;
193- return RSVP . resolve ( { stdout : '5.7.1' } ) ;
194- } ,
195- } ,
196130 ] ,
197131 { allowPassthrough : false }
198132 ) ;
@@ -206,7 +140,7 @@ describe('npmAdapter', () => {
206140 } ) ;
207141
208142 await adapter . _install ( ) ;
209- expect ( runCount ) . to . equal ( 2 , 'npm install should run with buildManagerOptions' ) ;
143+ expect ( runCount ) . to . equal ( 1 , 'npm install should run with buildManagerOptions' ) ;
210144 } ) ;
211145
212146 it ( 'throws an error if buildManagerOptions does not return an array' , async ( ) => {
@@ -346,13 +280,11 @@ describe('npmAdapter', () => {
346280 assertFileContainsJSON ( path . join ( tmpdir , 'package.json' ) , { originalPackageJSON : true } ) ;
347281 } ) ;
348282
349- it ( 'replaces the yarn.lock, npm-shrinkwrap.json and package-lock.json with the backed up version if they exist' , async ( ) => {
283+ it ( 'replaces the yarn.lock and package-lock.json with the backed up version if they exist' , async ( ) => {
350284 writeJSONFile ( 'package.json.ember-try' , { originalPackageJSON : true } ) ;
351285 writeJSONFile ( 'package.json' , { originalPackageJSON : false } ) ;
352286 writeJSONFile ( 'yarn.lock.ember-try' , { originalYarnLock : true } ) ;
353287 writeJSONFile ( 'yarn.lock' , { originalYarnLock : false } ) ;
354- writeJSONFile ( 'npm-shrinkwrap.json.ember-try' , { originalNpmShrinkWrap : true } ) ;
355- writeJSONFile ( 'npm-shrinkwrap.json' , { originalNpmShrinkWrap : false } ) ;
356288 writeJSONFile ( 'package-lock.json.ember-try' , { originalPackageLock : true } ) ;
357289 writeJSONFile ( 'package-lock.json' , { originalPackageLock : false } ) ;
358290
@@ -361,9 +293,6 @@ describe('npmAdapter', () => {
361293
362294 assertFileContainsJSON ( path . join ( tmpdir , 'package.json' ) , { originalPackageJSON : true } ) ;
363295 assertFileContainsJSON ( path . join ( tmpdir , 'yarn.lock' ) , { originalYarnLock : true } ) ;
364- assertFileContainsJSON ( path . join ( tmpdir , 'npm-shrinkwrap.json' ) , {
365- originalNpmShrinkWrap : true ,
366- } ) ;
367296 assertFileContainsJSON ( path . join ( tmpdir , 'package-lock.json' ) , {
368297 originalPackageLock : true ,
369298 } ) ;
@@ -376,19 +305,12 @@ describe('npmAdapter', () => {
376305 let stubbedRun = generateMockRun (
377306 [
378307 {
379- command : 'npm install --no-shrinkwrap ' ,
308+ command : 'npm install --no-package-lock ' ,
380309 callback ( ) {
381310 runCount ++ ;
382311 return Promise . resolve ( ) ;
383312 } ,
384313 } ,
385- {
386- command : 'npm --version' ,
387- callback ( ) {
388- runCount ++ ;
389- return RSVP . resolve ( { stdout : '10.0.0' } ) ;
390- } ,
391- } ,
392314 ] ,
393315 { allowPassthrough : false }
394316 ) ;
@@ -400,7 +322,7 @@ describe('npmAdapter', () => {
400322
401323 await adapter . _restoreOriginalDependencies ( ) ;
402324
403- expect ( runCount ) . to . equal ( 2 ) ;
325+ expect ( runCount ) . to . equal ( 1 ) ;
404326 } ) ;
405327 } ) ;
406328
0 commit comments