@@ -6,7 +6,16 @@ const { test } = require('tap')
6
6
7
7
const requireInject = require ( 'require-inject' )
8
8
9
- test ( 'should use Arborist' , ( t ) => {
9
+ test ( 'should use Arborist and run-script' , ( t ) => {
10
+ const scripts = [
11
+ 'preinstall' ,
12
+ 'install' ,
13
+ 'postinstall' ,
14
+ 'prepublish' , // XXX should we remove this finally??
15
+ 'preprepare' ,
16
+ 'prepare' ,
17
+ 'postprepare' ,
18
+ ]
10
19
const ci = requireInject ( '../../lib/ci.js' , {
11
20
'../../lib/npm.js' : {
12
21
prefix : 'foo' ,
@@ -15,6 +24,9 @@ test('should use Arborist', (t) => {
15
24
} ,
16
25
} ,
17
26
'../../lib/utils/reify-finish.js' : async ( ) => { } ,
27
+ '@npmcli/run-script' : opts => {
28
+ t . match ( opts , { event : scripts . shift ( ) } )
29
+ } ,
18
30
'@npmcli/arborist' : function ( args ) {
19
31
t . ok ( args , 'gets options object' )
20
32
this . loadVirtual = ( ) => {
@@ -40,6 +52,7 @@ test('should use Arborist', (t) => {
40
52
ci ( null , er => {
41
53
if ( er )
42
54
throw er
55
+ t . strictSame ( scripts , [ ] , 'called all scripts' )
43
56
t . end ( )
44
57
} )
45
58
} )
@@ -53,6 +66,7 @@ test('should pass flatOptions to Arborist.reify', (t) => {
53
66
} ,
54
67
} ,
55
68
'../../lib/utils/reify-finish.js' : async ( ) => { } ,
69
+ '@npmcli/run-script' : opts => { } ,
56
70
'@npmcli/arborist' : function ( ) {
57
71
this . loadVirtual = ( ) => Promise . resolve ( true )
58
72
this . reify = async ( options ) => {
@@ -80,6 +94,7 @@ test('should throw if package-lock.json or npm-shrinkwrap missing', (t) => {
80
94
global : false ,
81
95
} ,
82
96
} ,
97
+ '@npmcli/run-script' : opts => { } ,
83
98
'../../lib/utils/reify-finish.js' : async ( ) => { } ,
84
99
npmlog : {
85
100
verbose : ( ) => {
@@ -102,6 +117,7 @@ test('should throw ECIGLOBAL', (t) => {
102
117
global : true ,
103
118
} ,
104
119
} ,
120
+ '@npmcli/run-script' : opts => { } ,
105
121
'../../lib/utils/reify-finish.js' : async ( ) => { } ,
106
122
} )
107
123
ci ( null , ( err , res ) => {
@@ -125,6 +141,7 @@ test('should remove existing node_modules before installing', (t) => {
125
141
global : false ,
126
142
} ,
127
143
} ,
144
+ '@npmcli/run-script' : opts => { } ,
128
145
'../../lib/utils/reify-finish.js' : async ( ) => { } ,
129
146
'@npmcli/arborist' : function ( ) {
130
147
this . loadVirtual = ( ) => Promise . resolve ( true )
0 commit comments