@@ -46,7 +46,6 @@ t.test('clean up bundleddddddDependencies', async t => {
4646 } ) ,
4747 } ) + '/package.json' ) , { bundleDependencies : [ ] } ) )
4848
49-
5049 t . test ( 'handle bundleDependencies: false' , t =>
5150 t . resolveMatch ( rpj ( t . testdir ( {
5251 'package.json' : JSON . stringify ( {
@@ -77,29 +76,29 @@ t.test('clean up scripts', async t => {
7776 'package.json' : JSON . stringify ( {
7877 scripts : {
7978 foo : 'bar' ,
80- bar : [ 'baz' ] ,
79+ bar : [ 'baz' ] ,
8180 baz : { bar : { foo : 'barbaz' } } ,
8281 } ,
83- } )
82+ } ) ,
8483 } ) + '/package.json' ) , {
8584 scripts : {
8685 foo : 'bar' ,
8786 bar : undefined ,
8887 baz : undefined ,
89- }
88+ } ,
9089 } ) )
9190} )
9291
9392t . test ( 'convert funding string to object' , t =>
9493 t . resolveMatch ( rpj ( t . testdir ( {
95- 'package.json' : JSON . stringify ( { funding : 'hello' } )
94+ 'package.json' : JSON . stringify ( { funding : 'hello' } ) ,
9695 } ) + '/package.json' ) , { funding : { url : 'hello' } } ) )
9796
9897t . test ( 'cleanup bins' , async t => {
9998 t . test ( 'handle string when a name is set' , t =>
10099 t . resolveMatch ( rpj ( t . testdir ( {
101100 'package.json' : JSON . stringify ( { name : 'x' , bin : 'y' } ) ,
102- } ) + '/package.json' ) , { bin : { x : 'y' } } ) )
101+ } ) + '/package.json' ) , { bin : { x : 'y' } } ) )
103102
104103 t . test ( 'delete string bin when no name' , t =>
105104 t . resolveMatch ( rpj ( t . testdir ( {
@@ -117,49 +116,49 @@ t.test('cleanup bins', async t => {
117116 x : 'y' ,
118117 y : 1234 ,
119118 z : { a : 'b' } ,
120- } } ) ,
121- } ) + '/package.json' ) , { bin : { x : 'y' , y : undefined , z : undefined } } ) )
119+ } } ) ,
120+ } ) + '/package.json' ) , { bin : { x : 'y' , y : undefined , z : undefined } } ) )
122121} )
123122
124123t . test ( 'dedupe optional deps out of regular deps' , async t => {
125124 t . test ( 'choose optional deps in conflict' , t =>
126125 t . resolveMatch ( rpj ( t . testdir ( {
127126 'package.json' : JSON . stringify ( {
128127 optionalDependencies : {
129- whowins : '1.2.3-optional'
128+ whowins : '1.2.3-optional' ,
130129 } ,
131130 dependencies : {
132- whowins : '1.2.3-prod'
133- }
131+ whowins : '1.2.3-prod' ,
132+ } ,
134133 } ) ,
135134 } ) + '/package.json' ) , {
136135 optionalDependencies : {
137- whowins : '1.2.3-optional'
136+ whowins : '1.2.3-optional' ,
138137 } ,
139138 } ) )
140139
141140 t . test ( 'do not create regular deps if only optional specified' , t =>
142141 t . resolveMatch ( rpj ( t . testdir ( {
143142 'package.json' : JSON . stringify ( {
144143 optionalDependencies : {
145- whowins : '1.2.3-optional'
144+ whowins : '1.2.3-optional' ,
146145 } ,
147146 } ) ,
148147 } ) + '/package.json' ) , {
149148 optionalDependencies : {
150- whowins : '1.2.3-optional'
149+ whowins : '1.2.3-optional' ,
151150 } ,
152151 } ) )
153152} )
154153
155154t . test ( 'set _id if name and version set' , t =>
156155 t . resolveMatch ( rpj ( t . testdir ( {
157- 'package.json' : JSON . stringify ( { name :'a' , version : '1.2.3' } ) ,
156+ 'package.json' : JSON . stringify ( { name : 'a' , version : '1.2.3' } ) ,
158157 } ) + '/package.json' ) , { _id :
'[email protected] ' } ) ) 159158
160159t . test ( 'exports the normalize function' , async t =>
161- t . same ( rpj . normalize ( { bundledDependencies : true , dependencies : { a : '1' } } ) ,
162- { bundleDependencies : [ 'a' ] , dependencies : { a : '1' } } ) )
160+ t . same ( rpj . normalize ( { bundledDependencies : true , dependencies : { a : '1' } } ) ,
161+ { bundleDependencies : [ 'a' ] , dependencies : { a : '1' } } ) )
163162
164163t . test ( 'preserve indentation' , async t => {
165164 const obj = {
@@ -278,20 +277,22 @@ t.test('strip _fields', async t => {
278277t . test ( 'load directories.bin' , async t => {
279278 const { basename } = require ( 'path' )
280279 const fs = require ( 'fs' )
281- const rpj = t . mock ( '../' , {
280+ const rpjMock = t . mock ( '../' , {
282281 fs : {
283282 ...fs ,
284283 lstat : ( p , cb ) => {
285- if ( basename ( p ) === 'staterror' )
284+ if ( basename ( p ) === 'staterror' ) {
286285 cb ( new Error ( 'stat error' ) )
287- else
286+ } else {
288287 return fs . lstat ( p , cb )
288+ }
289289 } ,
290290 readdir : ( p , cb ) => {
291291 if ( basename ( p ) === 'readdirerror' ) {
292292 cb ( new Error ( 'readdir error' ) )
293- } else
293+ } else {
294294 return fs . readdir ( p , cb )
295+ }
295296 } ,
296297 } ,
297298 } )
@@ -323,7 +324,7 @@ t.test('load directories.bin', async t => {
323324 } ,
324325 } ,
325326 } )
326- t . strictSame ( await rpj ( `${ path } /package.json` ) , {
327+ t . strictSame ( await rpjMock ( `${ path } /package.json` ) , {
327328 name : 'foo' ,
328329 version : '1.2.3' ,
329330
0 commit comments