@@ -2,6 +2,7 @@ const { resolve } = require('node:path')
2
2
const t = require ( 'tap' )
3
3
const { setup, createPkg, merge } = require ( './fixtures/setup.js' )
4
4
const crypto = require ( 'node:crypto' )
5
+ const { existsSync } = require ( 'node:fs' )
5
6
6
7
t . test ( 'run from registry - no local packages' , async t => {
7
8
const { fixtures, package } = createPkg ( { versions : [ '2.0.0' ] } )
@@ -301,6 +302,11 @@ t.test('npx tree triggers manifest fetch when local version does satisfy range u
301
302
t . test ( 'override save to true when installing to npx cache' , async t => {
302
303
const { fixtures, package } = createPkg ( { versions : [ '2.0.0' ] } )
303
304
305
+ const hash = crypto . createHash ( 'sha512' )
306
+ . update ( '@npmcli/create-index' )
307
+ . digest ( 'hex' )
308
+ . slice ( 0 , 16 )
309
+
304
310
const { exec, path, registry, readOutput } = setup ( t , {
305
311
testdir : merge ( fixtures , {
306
312
global : { } ,
@@ -315,6 +321,9 @@ t.test('override save to true when installing to npx cache', async t => {
315
321
save : false ,
316
322
} )
317
323
324
+ const packageJsonPath = resolve ( path , 'npxCache' , hash , 'package.json' )
325
+ t . ok ( existsSync ( packageJsonPath ) , 'package.json should exist at npmCache' )
326
+
318
327
t . match ( await readOutput ( '@npmcli-create-index' ) , {
319
328
value : 'packages-2.0.0' ,
320
329
} )
0 commit comments