@@ -2,6 +2,7 @@ const { resolve } = require('node:path')
22const t = require ( 'tap' )
33const { setup, createPkg, merge } = require ( './fixtures/setup.js' )
44const crypto = require ( 'node:crypto' )
5+ const { existsSync } = require ( 'node:fs' )
56
67t . test ( 'run from registry - no local packages' , async t => {
78 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
301302t . test ( 'override save to true when installing to npx cache' , async t => {
302303 const { fixtures, package } = createPkg ( { versions : [ '2.0.0' ] } )
303304
305+ const hash = crypto . createHash ( 'sha512' )
306+ . update ( '@npmcli/create-index' )
307+ . digest ( 'hex' )
308+ . slice ( 0 , 16 )
309+
304310 const { exec, path, registry, readOutput } = setup ( t , {
305311 testdir : merge ( fixtures , {
306312 global : { } ,
@@ -315,6 +321,9 @@ t.test('override save to true when installing to npx cache', async t => {
315321 save : false ,
316322 } )
317323
324+ const packageJsonPath = resolve ( path , 'npxCache' , hash , 'package.json' )
325+ t . ok ( existsSync ( packageJsonPath ) , 'package.json should exist at npmCache' )
326+
318327 t . match ( await readOutput ( '@npmcli-create-index' ) , {
319328 value : 'packages-2.0.0' ,
320329 } )
0 commit comments