@@ -37,7 +37,7 @@ t.test('basic', async t => {
37
37
await t . test ( 'npm init' , async t => {
38
38
const cmdRes = await npm ( 'init' , '-y' )
39
39
40
- t . matchSnapshot ( cmdRes , 'should have successful npm init result' )
40
+ t . matchSnapshot ( cmdRes . stdout , 'should have successful npm init result' )
41
41
const pkg = await readFile ( 'package.json' )
42
42
t . equal ( pkg . name , 'project' , 'should have expected generated name' )
43
43
t . equal ( pkg . version , '1.0.0' , 'should have expected generated version' )
@@ -66,12 +66,12 @@ t.test('basic', async t => {
66
66
} )
67
67
68
68
await t . test ( 'npm --version' , async t => {
69
- const v = await npm ( '--version' )
69
+ const v = await npm ( '--version' ) . then ( r => r . stdout . trim ( ) )
70
70
71
71
if ( setup . SMOKE_PUBLISH ) {
72
- t . match ( v . trim ( ) , / - [ 0 - 9 a - f ] { 40 } \. \d $ / , 'must have a git version' )
72
+ t . match ( v , / - [ 0 - 9 a - f ] { 40 } \. \d $ / , 'must have a git version' )
73
73
} else {
74
- t . match ( v . trim ( ) , / ^ \d + \. \d + \. \d + / , 'has a version' )
74
+ t . match ( v , / ^ \d + \. \d + \. \d + / , 'has a version' )
75
75
}
76
76
} )
77
77
@@ -92,7 +92,7 @@ t.test('basic', async t => {
92
92
93
93
const cmdRes = await npm ( 'install' , '[email protected] ' )
94
94
95
- t . matchSnapshot ( cmdRes , 'should have expected install reify output' )
95
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected install reify output' )
96
96
t . resolveMatchSnapshot ( readFile ( 'package.json' ) , 'should have expected package.json result' )
97
97
t . resolveMatchSnapshot ( readFile ( 'package-lock.json' ) , 'should have expected lockfile result' )
98
98
} )
@@ -109,7 +109,7 @@ t.test('basic', async t => {
109
109
110
110
const cmdRes = await npm ( 'install' , 'promise-all-reject-late' , '-D' )
111
111
112
- t . matchSnapshot ( cmdRes , 'should have expected dev dep added reify output' )
112
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected dev dep added reify output' )
113
113
t . resolveMatchSnapshot (
114
114
readFile ( 'package.json' ) ,
115
115
'should have expected dev dep added package.json result'
@@ -123,19 +123,19 @@ t.test('basic', async t => {
123
123
await t . test ( 'npm ls' , async t => {
124
124
const cmdRes = await npm ( 'ls' )
125
125
126
- t . matchSnapshot ( cmdRes , 'should have expected ls output' )
126
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected ls output' )
127
127
} )
128
128
129
129
await t . test ( 'npm fund' , async t => {
130
130
const cmdRes = await npm ( 'fund' )
131
131
132
- t . matchSnapshot ( cmdRes , 'should have expected fund output' )
132
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected fund output' )
133
133
} )
134
134
135
135
await t . test ( 'npm explain' , async t => {
136
136
const cmdRes = await npm ( 'explain' , 'abbrev' )
137
137
138
- t . matchSnapshot ( cmdRes , 'should have expected explain output' )
138
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected explain output' )
139
139
} )
140
140
141
141
await t . test ( 'npm diff' , async t => {
@@ -151,7 +151,7 @@ t.test('basic', async t => {
151
151
152
152
const cmdRes = await npm ( 'diff' , '[email protected] ' , '[email protected] ' )
153
153
154
- t . matchSnapshot ( cmdRes , 'should have expected diff output' )
154
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected diff output' )
155
155
} )
156
156
157
157
await t . test ( 'npm outdated' , async t => {
@@ -175,7 +175,7 @@ t.test('basic', async t => {
175
175
await t . test ( 'npm pkg set scripts' , async t => {
176
176
const cmdRes = await npm ( 'pkg' , 'set' , 'scripts.hello=echo Hello' )
177
177
178
- t . matchSnapshot ( cmdRes , 'should have expected set-script output' )
178
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected set-script output' )
179
179
t . resolveMatchSnapshot (
180
180
readFile ( 'package.json' ) ,
181
181
'should have expected script added package.json result'
@@ -185,13 +185,13 @@ t.test('basic', async t => {
185
185
await t . test ( 'npm run-script' , async t => {
186
186
const cmdRes = await npm ( 'run' , 'hello' )
187
187
188
- t . matchSnapshot ( cmdRes , 'should have expected run-script output' )
188
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected run-script output' )
189
189
} )
190
190
191
191
await t . test ( 'npm prefix' , async t => {
192
192
const cmdRes = await npm ( 'prefix' )
193
193
194
- t . matchSnapshot ( cmdRes , 'should have expected prefix output' )
194
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected prefix output' )
195
195
} )
196
196
197
197
await t . test ( 'npm view' , async t => {
@@ -200,7 +200,7 @@ t.test('basic', async t => {
200
200
} )
201
201
const cmdRes = await npm ( 'view' , '[email protected] ' )
202
202
203
- t . matchSnapshot ( cmdRes , 'should have expected view output' )
203
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected view output' )
204
204
} )
205
205
206
206
await t . test ( 'npm update dep' , async t => {
@@ -214,7 +214,7 @@ t.test('basic', async t => {
214
214
215
215
const cmdRes = await npm ( 'update' , 'abbrev' )
216
216
217
- t . matchSnapshot ( cmdRes , 'should have expected update reify output' )
217
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected update reify output' )
218
218
t . resolveMatchSnapshot ( readFile ( 'package.json' ) ,
219
219
'should have expected update package.json result' )
220
220
t . resolveMatchSnapshot ( readFile ( 'package-lock.json' ) ,
@@ -224,7 +224,7 @@ t.test('basic', async t => {
224
224
await t . test ( 'npm uninstall' , async t => {
225
225
const cmdRes = await npm ( 'uninstall' , 'promise-all-reject-late' )
226
226
227
- t . matchSnapshot ( cmdRes , 'should have expected uninstall reify output' )
227
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected uninstall reify output' )
228
228
t . resolveMatchSnapshot ( readFile ( 'package.json' ) ,
229
229
'should have expected uninstall package.json result' )
230
230
t . resolveMatchSnapshot ( readFile ( 'package-lock.json' ) ,
@@ -233,21 +233,21 @@ t.test('basic', async t => {
233
233
234
234
await t . test ( 'npm pkg' , async t => {
235
235
let cmdRes = await npm ( 'pkg' , 'get' , 'license' )
236
- t . matchSnapshot ( cmdRes , 'should have expected pkg get output' )
236
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected pkg get output' )
237
237
238
238
cmdRes = await npm ( 'pkg' , 'set' , 'tap[test-env][0]=LC_ALL=sk' )
239
- t . matchSnapshot ( cmdRes , 'should have expected pkg set output' )
239
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected pkg set output' )
240
240
241
241
t . resolveMatchSnapshot (
242
242
readFile ( 'package.json' ) ,
243
243
'should have expected npm pkg set modified package.json result'
244
244
)
245
245
246
246
cmdRes = await npm ( 'pkg' , 'get' )
247
- t . matchSnapshot ( cmdRes , 'should print package.json contents' )
247
+ t . matchSnapshot ( cmdRes . stdout , 'should print package.json contents' )
248
248
249
249
cmdRes = await npm ( 'pkg' , 'delete' , 'tap' )
250
- t . matchSnapshot ( cmdRes , 'should have expected pkg delete output' )
250
+ t . matchSnapshot ( cmdRes . stdout , 'should have expected pkg delete output' )
251
251
252
252
t . resolveMatchSnapshot (
253
253
readFile ( 'package.json' ) ,
@@ -385,7 +385,7 @@ t.test('basic', async t => {
385
385
} )
386
386
387
387
const o = await npm ( 'exec' , 'exec-test' )
388
- t . match ( o . trim ( ) , '1.0.0' )
388
+ t . match ( o . stdout . trim ( ) , '1.0.0' )
389
389
}
390
390
// Second run finds newer version
391
391
{
@@ -401,7 +401,7 @@ t.test('basic', async t => {
401
401
} ,
402
402
} )
403
403
const o = await npm ( 'exec' , 'exec-test' )
404
- t . match ( o . trim ( ) , '1.0.1' )
404
+ t . match ( o . stdout . trim ( ) , '1.0.1' )
405
405
}
406
406
} )
407
407
} )
0 commit comments