-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
index.js.test.cjs
480 lines (432 loc) · 12.5 KB
/
index.js.test.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
/* IMPORTANT
* This snapshot file is auto-generated, but designed for humans.
* It should be checked into source control and tracked carefully.
* Re-generate by setting TAP_SNAPSHOT=1 and running tests.
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/index.js TAP basic npm (no args) > should have expected no args output 1`] = `
npm <command>
Usage:
npm install install all the dependencies in your project
npm install <foo> add the <foo> dependency to your project
npm test run this project's tests
npm run <foo> run the script named <foo>
npm <command> -h quick help on <command>
npm -l display usage info for all commands
npm help <term> search for help on <term>
npm help npm more involved overview
All commands:
access, adduser, audit, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
help-search, hook, init, install, install-ci-test,
install-test, link, ll, login, logout, ls, org, outdated,
owner, pack, ping, pkg, prefix, profile, prune, publish,
query, rebuild, repo, restart, root, run-script, sbom,
search, set, shrinkwrap, star, stars, start, stop, team,
test, token, uninstall, unpublish, unstar, update, version,
view, whoami
Specify configs in the ini-formatted file:
{NPM}/{TESTDIR}/home/.npmrc
or on the command line via: npm <command> --key=value
More configuration info: npm help config
Configuration fields: npm help 7 config
npm {NPM}
`
exports[`test/index.js TAP basic npm ci > should throw mismatch deps in lock file error 1`] = `
npm error code EUSAGE
npm error
npm error \`npm ci\` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with \`npm install\` before continuing.
npm error
npm error Invalid: lock file's abbrev@1.0.4 does not satisfy abbrev@1.1.1
npm error
npm error Clean install a project
npm error
npm error Usage:
npm error npm ci
npm error
npm error Options:
npm error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
npm error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
npm error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
npm error [--no-bin-links] [--no-fund] [--dry-run]
npm error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm error [-ws|--workspaces] [--include-workspace-root] [--install-links]
npm error
npm error aliases: clean-install, ic, install-clean, isntall-clean
npm error
npm error Run "npm help ci" for more info
npm error A complete log of this run can be found in: {NPM}/{TESTDIR}/cache/_logs/{LOG}
`
exports[`test/index.js TAP basic npm diff > should have expected diff output 1`] = `
diff --git a/index.js b/index.js
index v1.0.4..v1.1.1 100644
--- a/index.js
+++ b/index.js
@@ -1,1 +1,1 @@
-module.exports = "1.0.4"
/ No newline at end of file
+module.exports = "1.1.1"
/ No newline at end of file
diff --git a/package.json b/package.json
index v1.0.4..v1.1.1 100644
--- a/package.json
+++ b/package.json
@@ -1,4 +1,4 @@
{
"name": "abbrev",
- "version": "1.0.4"
+ "version": "1.1.1"
}
/ No newline at end of file
`
exports[`test/index.js TAP basic npm explain > should have expected explain output 1`] = `
abbrev@1.0.4
node_modules/abbrev
abbrev@"^1.0.4" from the root project
`
exports[`test/index.js TAP basic npm fund > should have expected fund output 1`] = `
project@1.0.0
\`-- https://github.com/sponsors
\`-- promise-all-reject-late@5.0.0
`
exports[`test/index.js TAP basic npm init > should have successful npm init result 1`] = `
Wrote to {NPM}/{TESTDIR}/project/package.json:
{
"name": "project",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo /"Error: no test specified/" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}
`
exports[`test/index.js TAP basic npm install dev dep > should have expected dev dep added lockfile result 1`] = `
Object {
"lockfileVersion": 3,
"name": "project",
"packages": Object {
"": Object {
"dependencies": Object {
"abbrev": "^1.0.4",
},
"devDependencies": Object {
"promise-all-reject-late": "^5.0.0",
},
"license": "ISC",
"name": "project",
"version": "1.0.0",
},
"node_modules/abbrev": Object {
"resolved": "{REGISTRY}/abbrev/-/abbrev-1.0.4.tgz",
"version": "1.0.4",
},
"node_modules/promise-all-reject-late": Object {
"dev": true,
"funding": Object {
"url": "https://github.com/sponsors",
},
"resolved": "{REGISTRY}/promise-all-reject-late/-/promise-all-reject-late-5.0.0.tgz",
"version": "5.0.0",
},
},
"requires": true,
"version": "1.0.0",
}
`
exports[`test/index.js TAP basic npm install dev dep > should have expected dev dep added package.json result 1`] = `
Object {
"author": "",
"dependencies": Object {
"abbrev": "^1.0.4",
},
"description": "",
"devDependencies": Object {
"promise-all-reject-late": "^5.0.0",
},
"keywords": Array [],
"license": "ISC",
"main": "index.js",
"name": "project",
"scripts": Object {
"test": "echo /"Error: no test specified/" && exit 1",
},
"version": "1.0.0",
}
`
exports[`test/index.js TAP basic npm install dev dep > should have expected dev dep added reify output 1`] = `
added 1 package in {TIME}
1 package is looking for funding
run \`npm fund\` for details
`
exports[`test/index.js TAP basic npm install prodDep@version > should have expected install reify output 1`] = `
added 1 package in {TIME}
`
exports[`test/index.js TAP basic npm install prodDep@version > should have expected lockfile result 1`] = `
Object {
"lockfileVersion": 3,
"name": "project",
"packages": Object {
"": Object {
"dependencies": Object {
"abbrev": "^1.0.4",
},
"license": "ISC",
"name": "project",
"version": "1.0.0",
},
"node_modules/abbrev": Object {
"resolved": "{REGISTRY}/abbrev/-/abbrev-1.0.4.tgz",
"version": "1.0.4",
},
},
"requires": true,
"version": "1.0.0",
}
`
exports[`test/index.js TAP basic npm install prodDep@version > should have expected package.json result 1`] = `
Object {
"author": "",
"dependencies": Object {
"abbrev": "^1.0.4",
},
"description": "",
"keywords": Array [],
"license": "ISC",
"main": "index.js",
"name": "project",
"scripts": Object {
"test": "echo /"Error: no test specified/" && exit 1",
},
"version": "1.0.0",
}
`
exports[`test/index.js TAP basic npm ls > should have expected ls output 1`] = `
project@1.0.0 {NPM}/{TESTDIR}/project
+-- abbrev@1.0.4
\`-- promise-all-reject-late@5.0.0
`
exports[`test/index.js TAP basic npm outdated > should have expected outdated output 1`] = `
Package Current Wanted Latest Location Depended by
abbrev 1.0.4 1.1.1 1.1.1 node_modules/abbrev project
`
exports[`test/index.js TAP basic npm pkg > should have expected npm pkg delete modified package.json result 1`] = `
Object {
"author": "",
"dependencies": Object {
"abbrev": "^1.0.4",
},
"description": "",
"keywords": Array [],
"license": "ISC",
"main": "index.js",
"name": "project",
"scripts": Object {
"hello": "echo Hello",
"test": "echo /"Error: no test specified/" && exit 1",
},
"version": "1.0.0",
}
`
exports[`test/index.js TAP basic npm pkg > should have expected npm pkg set modified package.json result 1`] = `
Object {
"author": "",
"dependencies": Object {
"abbrev": "^1.0.4",
},
"description": "",
"keywords": Array [],
"license": "ISC",
"main": "index.js",
"name": "project",
"scripts": Object {
"hello": "echo Hello",
"test": "echo /"Error: no test specified/" && exit 1",
},
"tap": Object {
"test-env": Array [
"LC_ALL=sk",
],
},
"version": "1.0.0",
}
`
exports[`test/index.js TAP basic npm pkg > should have expected pkg delete output 1`] = `
`
exports[`test/index.js TAP basic npm pkg > should have expected pkg get output 1`] = `
"ISC"
`
exports[`test/index.js TAP basic npm pkg > should have expected pkg set output 1`] = `
`
exports[`test/index.js TAP basic npm pkg > should print package.json contents 1`] = `
{
"name": "project",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo /"Error: no test specified/" && exit 1",
"hello": "echo Hello"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"abbrev": "^1.0.4"
},
"tap": {
"test-env": [
"LC_ALL=sk"
]
}
}
`
exports[`test/index.js TAP basic npm pkg set scripts > should have expected script added package.json result 1`] = `
Object {
"author": "",
"dependencies": Object {
"abbrev": "^1.0.4",
},
"description": "",
"devDependencies": Object {
"promise-all-reject-late": "^5.0.0",
},
"keywords": Array [],
"license": "ISC",
"main": "index.js",
"name": "project",
"scripts": Object {
"hello": "echo Hello",
"test": "echo /"Error: no test specified/" && exit 1",
},
"version": "1.0.0",
}
`
exports[`test/index.js TAP basic npm pkg set scripts > should have expected set-script output 1`] = `
`
exports[`test/index.js TAP basic npm prefix > should have expected prefix output 1`] = `
{NPM}/{TESTDIR}/project
`
exports[`test/index.js TAP basic npm run-script > should have expected run-script output 1`] = `
> project@1.0.0 hello
> echo Hello
Hello
`
exports[`test/index.js TAP basic npm uninstall > should have expected uninstall lockfile result 1`] = `
Object {
"lockfileVersion": 3,
"name": "project",
"packages": Object {
"": Object {
"dependencies": Object {
"abbrev": "^1.0.4",
},
"license": "ISC",
"name": "project",
"version": "1.0.0",
},
"node_modules/abbrev": Object {
"resolved": "{REGISTRY}/abbrev/-/abbrev-1.1.1.tgz",
"version": "1.1.1",
},
},
"requires": true,
"version": "1.0.0",
}
`
exports[`test/index.js TAP basic npm uninstall > should have expected uninstall package.json result 1`] = `
Object {
"author": "",
"dependencies": Object {
"abbrev": "^1.0.4",
},
"description": "",
"keywords": Array [],
"license": "ISC",
"main": "index.js",
"name": "project",
"scripts": Object {
"hello": "echo Hello",
"test": "echo /"Error: no test specified/" && exit 1",
},
"version": "1.0.0",
}
`
exports[`test/index.js TAP basic npm uninstall > should have expected uninstall reify output 1`] = `
removed 1 package in {TIME}
`
exports[`test/index.js TAP basic npm update dep > should have expected update lockfile result 1`] = `
Object {
"lockfileVersion": 3,
"name": "project",
"packages": Object {
"": Object {
"dependencies": Object {
"abbrev": "^1.0.4",
},
"devDependencies": Object {
"promise-all-reject-late": "^5.0.0",
},
"license": "ISC",
"name": "project",
"version": "1.0.0",
},
"node_modules/abbrev": Object {
"resolved": "{REGISTRY}/abbrev/-/abbrev-1.1.1.tgz",
"version": "1.1.1",
},
"node_modules/promise-all-reject-late": Object {
"dev": true,
"funding": Object {
"url": "https://github.com/sponsors",
},
"resolved": "{REGISTRY}/promise-all-reject-late/-/promise-all-reject-late-5.0.0.tgz",
"version": "5.0.0",
},
},
"requires": true,
"version": "1.0.0",
}
`
exports[`test/index.js TAP basic npm update dep > should have expected update package.json result 1`] = `
Object {
"author": "",
"dependencies": Object {
"abbrev": "^1.0.4",
},
"description": "",
"devDependencies": Object {
"promise-all-reject-late": "^5.0.0",
},
"keywords": Array [],
"license": "ISC",
"main": "index.js",
"name": "project",
"scripts": Object {
"hello": "echo Hello",
"test": "echo /"Error: no test specified/" && exit 1",
},
"version": "1.0.0",
}
`
exports[`test/index.js TAP basic npm update dep > should have expected update reify output 1`] = `
changed 1 package in {TIME}
1 package is looking for funding
run \`npm fund\` for details
`
exports[`test/index.js TAP basic npm view > should have expected view output 1`] = `
abbrev@1.0.4 | Proprietary | deps: none | versions: 2
mocked test package
dist
.tarball: {REGISTRY}/abbrev/-/abbrev-1.0.4.tgz
.shasum: undefined
dist-tags:
latest: 1.1.1
published just now
`