@@ -154,6 +154,105 @@ for (const [name, testPrepare] of Object.entries(testMethods)) {
154
154
t . end ( )
155
155
} )
156
156
157
+ t . test ( 'man' , t => {
158
+ t . test ( 'resolves directory' , async t => {
159
+ const { content } = await testPrepare ( t , ( {
160
+ 'package.json' : JSON . stringify ( {
161
+ directories : { man : './man' } ,
162
+ } ) ,
163
+ man : { man1 : { 'test.1' : 'man test file' } } ,
164
+ } ) )
165
+ t . strictSame ( content . man , [ 'man/man1/test.1' ] )
166
+ } )
167
+
168
+ if ( name === '@npmcli/package-json' ) {
169
+ t . test ( 'non-string' , async t => {
170
+ const { content } = await testPrepare ( t , ( {
171
+ 'package.json' : JSON . stringify ( {
172
+ man : 123 ,
173
+ } ) ,
174
+ } ) )
175
+ t . has ( content , { man : undefined } )
176
+ } )
177
+
178
+ t . test ( 'good' , async t => {
179
+ const { content } = await testPrepare ( t , ( {
180
+ 'package.json' : JSON . stringify ( {
181
+ man : './man/test.1' ,
182
+ } ) ,
183
+ } ) )
184
+ t . strictSame ( content . man , [ 'man/test.1' ] )
185
+ } )
186
+
187
+ t . test ( 'empty' , async t => {
188
+ const { content } = await testPrepare ( t , ( {
189
+ 'package.json' : JSON . stringify ( {
190
+ man : [ ] ,
191
+ } ) ,
192
+ } ) )
193
+ t . has ( content , { man : undefined } )
194
+ } )
195
+
196
+ t . test ( 'directories.man no prefix' , async t => {
197
+ const { content } = await testPrepare ( t , ( {
198
+ 'package.json' : JSON . stringify ( {
199
+ name : 'man-test' ,
200
+ directories : {
201
+ man : './man' ,
202
+ } ,
203
+ } ) ,
204
+ man : { 'test.1' : '.TH man "test man page"' } ,
205
+ } ) )
206
+ t . strictSame ( content . man , [ 'man/test.1' ] )
207
+ } )
208
+
209
+ t . test ( 'directories.man trim prefix' , async t => {
210
+ const { content } = await testPrepare ( t , ( {
211
+ 'package.json' : JSON . stringify ( {
212
+ name : 'man-test' ,
213
+ directories : {
214
+ man : '../../../../../man' ,
215
+ } ,
216
+ } ) ,
217
+ man : { 'test.1' : '.TH man "test man page"' } ,
218
+ } ) )
219
+ t . strictSame ( content . man , [ 'man/test.1' ] )
220
+ } )
221
+
222
+ t . test ( 'directories.man handles reversed slashes' , async t => {
223
+ const { content } = await testPrepare ( t , ( {
224
+ 'package.json' : JSON . stringify ( {
225
+ name : 'man-test' ,
226
+ directories : {
227
+ man : '..\\..\\man' ,
228
+ } ,
229
+ } ) ,
230
+ man : { 'test.1' : '.TH man "test man page"' } ,
231
+ } ) )
232
+ t . strictSame ( content . man , [ 'man/test.1' ] )
233
+ } )
234
+
235
+ t . test ( 'directories.man with man' , async t => {
236
+ const { content } = await testPrepare ( t , ( {
237
+ 'package.json' : JSON . stringify ( {
238
+ name : 'man-test' ,
239
+ directories : {
240
+ man : './man' ,
241
+ } ,
242
+ man : '../../test.2' ,
243
+ } ) ,
244
+ man : {
245
+ 'test.1' : '.TH man "test man page 1"' ,
246
+ 'test.2' : '.TH man "test man page 2"' ,
247
+ } ,
248
+ } ) )
249
+ t . strictSame ( content . man , [ 'test.2' ] )
250
+ } )
251
+ }
252
+
253
+ t . end ( )
254
+ } )
255
+
157
256
t . test ( 'bundleDependencies' , t => {
158
257
t . test ( 'true' , async t => {
159
258
const { content } = await testPrepare ( t , ( {
@@ -325,19 +424,6 @@ for (const [name, testPrepare] of Object.entries(testMethods)) {
325
424
t . end ( )
326
425
} )
327
426
328
- t . test ( 'man' , t => {
329
- t . test ( 'resolves directory' , async t => {
330
- const { content } = await testPrepare ( t , ( {
331
- 'package.json' : JSON . stringify ( {
332
- directories : { man : './man' } ,
333
- } ) ,
334
- man : { man1 : { 'test.1' : 'man test file' } } ,
335
- } ) )
336
- t . strictSame ( content . man , [ 'man/man1/test.1' ] )
337
- } )
338
- t . end ( )
339
- } )
340
-
341
427
t . test ( 'gitHead' , t => {
342
428
t . test ( 'HEAD with no ref' , async t => {
343
429
const { content } = await testPrepare ( t , ( {
0 commit comments