@@ -36,63 +36,6 @@ const setupNpmGlobal = async (t, opts) => {
36
36
}
37
37
}
38
38
39
- t . test ( 'pack and replace global self' , async t => {
40
- const {
41
- npm,
42
- npmLocalTarball,
43
- npmPath,
44
- getPaths,
45
- paths : { globalBin, globalNodeModules } ,
46
- } = await setupNpmGlobal ( t , {
47
- testdir : {
48
- project : {
49
- 'package.json' : { name : 'npm' , version : '999.999.999' } ,
50
- } ,
51
- } ,
52
- } )
53
-
54
- const tarball = await npmLocalTarball ( )
55
- await npm ( 'install' , tarball , '--global' )
56
-
57
- t . equal (
58
- await fs . realpath ( join ( globalBin , 'npm' ) ) ,
59
- setup . WINDOWS ? join ( globalBin , 'npm' ) : join ( globalNodeModules , 'npm/bin/npm-cli.js' ) ,
60
- 'npm realpath is in the testdir'
61
- )
62
- t . equal (
63
- await fs . realpath ( join ( globalBin , 'npx' ) ) ,
64
- setup . WINDOWS ? join ( globalBin , 'npx' ) : join ( globalNodeModules , 'npm/bin/npx-cli.js' ) ,
65
- 'npx realpath is in the testdir'
66
- )
67
-
68
- const prePaths = await getPaths ( )
69
- t . equal ( prePaths . npmRoot , join ( globalNodeModules , 'npm' ) , 'npm root is in the testdir' )
70
- t . equal ( prePaths . pathNpm , join ( globalBin , 'npm' ) , 'npm bin is in the testdir' )
71
- t . equal ( prePaths . pathNpx , join ( globalBin , 'npx' ) , 'npx bin is in the testdir' )
72
- t . not ( prePaths . pathNpm , prePaths . globalNpm , 'npm bin is not the same as the global one' )
73
- t . not ( prePaths . pathNpx , prePaths . globalNpx , 'npm bin is not the same as the global one' )
74
- t . ok ( prePaths . nodeModulesContents . length > 1 , 'node modules has npm contents' )
75
- t . ok ( prePaths . nodeModulesContents . includes ( 'node_modules' ) , 'npm has its node_modules' )
76
-
77
- t . strictSame (
78
- prePaths . binContents ,
79
- [ 'npm' , 'npx' ] . flatMap ( p => setup . WINDOWS ? [ p , `${ p } .cmd` , `${ p } .ps1` ] : p ) ,
80
- 'bin has npm and npx'
81
- )
82
-
83
- await npmPath ( 'pack' )
84
- await npmPath ( 'install' , 'npm-999.999.999.tgz' , '--global' )
85
-
86
- const postPaths = await getPaths ( )
87
- t . not ( prePaths . npmRoot , postPaths . npmRoot , 'npm roots are different' )
88
- t . equal ( postPaths . pathNpm , postPaths . globalNpm , 'npm bin is the same as the global one' )
89
- t . equal ( postPaths . pathNpx , postPaths . globalNpx , 'npx bin is the same as the global one' )
90
- t . equal ( postPaths . pathNpm , prePaths . globalNpm , 'after install npm bin is same as previous global' )
91
- t . equal ( postPaths . pathNpx , prePaths . globalNpx , 'after install npx bin is same as previous global' )
92
- t . strictSame ( postPaths . binContents , [ ] , 'bin is empty' )
93
- t . strictSame ( postPaths . nodeModulesContents , [ 'package.json' ] , 'contents is only package.json' )
94
- } )
95
-
96
39
t . test ( 'publish and replace global self' , async t => {
97
40
let publishedPackument = null
98
41
const pkg = require ( '../../package.json' )
@@ -121,11 +64,12 @@ t.test('publish and replace global self', async t => {
121
64
} )
122
65
}
123
66
124
- const npmInstall = async ( useNpm ) => {
67
+ const npmInstall = async ( useNpm , opts ) => {
125
68
await npmPackage ( {
126
69
manifest : { packuments : [ publishedPackument ] } ,
127
70
tarballs : { [ version ] : tarball } ,
128
71
times : 3 ,
72
+ ...opts ,
129
73
} )
130
74
await fs . rm ( cache , { recursive : true , force : true } )
131
75
await useNpm ( 'install' , 'npm@latest' , '--global' )
0 commit comments