Debian Codegraph @

tap-snapshots/test/lib/commands/publish.js.test.cjs

raw
1 /* IMPORTANT
2 * This snapshot file is auto-generated, but designed for humans.
3 * It should be checked into source control and tracked carefully.
4 * Re-generate by setting TAP_SNAPSHOT=1 and running tests.
5 * Make sure to inspect the output below. Do not ignore changes!
6 */
7 'use strict'
8 exports[`test/lib/commands/publish.js TAP _auth config default registry > new package version 1`] = `
9 + @npmcli/[email protected]
10 `
11
12 exports[`test/lib/commands/publish.js TAP bare _auth and registry config > new package version 1`] = `
13 + @npm/[email protected]
14 `
15
16 exports[`test/lib/commands/publish.js TAP dry-run > must match snapshot 1`] = `
17 Array [
18 "package: @npmcli/[email protected]",
19 "Tarball Contents",
20 "95B package.json",
21 "Tarball Details",
22 "name: @npmcli/test-package",
23 "version: 1.0.0",
24 "filename: npmcli-test-package-1.0.0.tgz",
25 "package size: {size}",
26 "unpacked size: 95 B",
27 "shasum: {sha}",
28 "integrity: {integrity}
29 "total files: 1",
30 "Publishing to https://registry.npmjs.org/ with tag latest and default access (dry-run)",
31 ]
32 `
33
34 exports[`test/lib/commands/publish.js TAP foreground-scripts can still be set to false > must match snapshot 1`] = `
35 Array [
36 "package: [email protected]",
37 "Tarball Contents",
38 "110B package.json",
39 "Tarball Details",
40 "name: test-fg-scripts",
41 "version: 0.0.0",
42 "filename: test-fg-scripts-0.0.0.tgz",
43 "package size: {size}",
44 "unpacked size: 110 B",
45 "shasum: {sha}",
46 "integrity: {integrity}
47 "total files: 1",
48 "Publishing to https://registry.npmjs.org/ with tag latest and default access (dry-run)",
49 ]
50 `
51
52 exports[`test/lib/commands/publish.js TAP foreground-scripts defaults to true > must match snapshot 1`] = `
53 Array [
54 "package: [email protected]",
55 "Tarball Contents",
56 "110B package.json",
57 "Tarball Details",
58 "name: test-fg-scripts",
59 "version: 0.0.0",
60 "filename: test-fg-scripts-0.0.0.tgz",
61 "package size: {size}",
62 "unpacked size: 110 B",
63 "shasum: {sha}",
64 "integrity: {integrity}
65 "total files: 1",
66 "Publishing to https://registry.npmjs.org/ with tag latest and default access (dry-run)",
67 ]
68 `
69
70 exports[`test/lib/commands/publish.js TAP has mTLS auth for scope configured registry > new package version 1`] = `
71 + @npm/[email protected]
72 `
73
74 exports[`test/lib/commands/publish.js TAP has token auth for scope configured registry > new package version 1`] = `
75 + @npm/[email protected]
76 `
77
78 exports[`test/lib/commands/publish.js TAP ignore-scripts > new package version 1`] = `
79 + @npmcli/[email protected]
80 `
81
82 exports[`test/lib/commands/publish.js TAP json > must match snapshot 1`] = `
83 Array [
84 "Publishing to https://registry.npmjs.org/ with tag latest and default access",
85 ]
86 `
87
88 exports[`test/lib/commands/publish.js TAP json > new package json 1`] = `
89 {
90 "@npmcli/test-package": {
91 "id": "@npmcli/[email protected]",
92 "name": "@npmcli/test-package",
93 "version": "1.0.0",
94 "size": "{size}",
95 "unpackedSize": 95,
96 "shasum": "{sha}",
97 "integrity": "{integrity}",
98 "filename": "npmcli-test-package-1.0.0.tgz",
99 "files": [
100 {
101 "path": "package.json",
102 "size": "{size}",
103 "mode": 420
104 }
105 ],
106 "entryCount": 1,
107 "bundled": []
108 }
109 }
110 `
111
112 exports[`test/lib/commands/publish.js TAP manifest > manifest 1`] = `
113 Object {
114 "_id": "npm@{VERSION}",
115 "author": Object {
116 "name": "GitHub Inc.",
117 },
118 "bin": Object {
119 "npm": "bin/npm-cli.js",
120 "npx": "bin/npx-cli.js",
121 },
122 "bugs": Object {
123 "url": "https://github.com/npm/cli/issues",
124 },
125 "description": "a package manager for JavaScript",
126 "directories": Object {
127 "doc": "./doc",
128 "man": "./man",
129 },
130 "exports": Object {
131 ".": Array [
132 Object {
133 "default": "./index.js",
134 },
135 "./index.js",
136 ],
137 "./package.json": "./package.json",
138 },
139 "files": Array [
140 "bin/",
141 "lib/",
142 "index.js",
143 "docs/content/",
144 "docs/output/",
145 "man/",
146 ],
147 "homepage": "https://docs.npmjs.com/",
148 "keywords": Array [
149 "install",
150 "modules",
151 "package manager",
152 "package.json",
153 ],
154 "license": "Artistic-2.0",
155 "main": "./index.js",
156 "man": Array [
157 "man/man1/npm-access.1",
158 "man/man1/npm-adduser.1",
159 "man/man1/npm-approve-scripts.1",
160 "man/man1/npm-audit.1",
161 "man/man1/npm-bugs.1",
162 "man/man1/npm-cache.1",
163 "man/man1/npm-ci.1",
164 "man/man1/npm-completion.1",
165 "man/man1/npm-config.1",
166 "man/man1/npm-dedupe.1",
167 "man/man1/npm-deny-scripts.1",
168 "man/man1/npm-deprecate.1",
169 "man/man1/npm-diff.1",
170 "man/man1/npm-dist-tag.1",
171 "man/man1/npm-docs.1",
172 "man/man1/npm-doctor.1",
173 "man/man1/npm-edit.1",
174 "man/man1/npm-exec.1",
175 "man/man1/npm-explain.1",
176 "man/man1/npm-explore.1",
177 "man/man1/npm-find-dupes.1",
178 "man/man1/npm-fund.1",
179 "man/man1/npm-get.1",
180 "man/man1/npm-help-search.1",
181 "man/man1/npm-help.1",
182 "man/man1/npm-init.1",
183 "man/man1/npm-install-ci-test.1",
184 "man/man1/npm-install-test.1",
185 "man/man1/npm-install.1",
186 "man/man1/npm-link.1",
187 "man/man1/npm-ll.1",
188 "man/man1/npm-login.1",
189 "man/man1/npm-logout.1",
190 "man/man1/npm-ls.1",
191 "man/man1/npm-org.1",
192 "man/man1/npm-outdated.1",
193 "man/man1/npm-owner.1",
194 "man/man1/npm-pack.1",
195 "man/man1/npm-ping.1",
196 "man/man1/npm-pkg.1",
197 "man/man1/npm-prefix.1",
198 "man/man1/npm-profile.1",
199 "man/man1/npm-prune.1",
200 "man/man1/npm-publish.1",
201 "man/man1/npm-query.1",
202 "man/man1/npm-rebuild.1",
203 "man/man1/npm-repo.1",
204 "man/man1/npm-restart.1",
205 "man/man1/npm-root.1",
206 "man/man1/npm-run.1",
207 "man/man1/npm-sbom.1",
208 "man/man1/npm-search.1",
209 "man/man1/npm-set.1",
210 "man/man1/npm-shrinkwrap.1",
211 "man/man1/npm-stage.1",
212 "man/man1/npm-star.1",
213 "man/man1/npm-stars.1",
214 "man/man1/npm-start.1",
215 "man/man1/npm-stop.1",
216 "man/man1/npm-team.1",
217 "man/man1/npm-test.1",
218 "man/man1/npm-token.1",
219 "man/man1/npm-trust.1",
220 "man/man1/npm-undeprecate.1",
221 "man/man1/npm-uninstall.1",
222 "man/man1/npm-unpublish.1",
223 "man/man1/npm-unstar.1",
224 "man/man1/npm-update.1",
225 "man/man1/npm-version.1",
226 "man/man1/npm-view.1",
227 "man/man1/npm-whoami.1",
228 "man/man1/npm.1",
229 "man/man1/npx.1",
230 "man/man5/folders.5",
231 "man/man5/install.5",
232 "man/man5/npm-global.5",
233 "man/man5/npm-json.5",
234 "man/man5/npm-shrinkwrap-json.5",
235 "man/man5/npmrc.5",
236 "man/man5/package-json.5",
237 "man/man5/package-lock-json.5",
238 "man/man7/config.7",
239 "man/man7/dependency-selectors.7",
240 "man/man7/developers.7",
241 "man/man7/logging.7",
242 "man/man7/orgs.7",
243 "man/man7/package-spec.7",
244 "man/man7/registry.7",
245 "man/man7/removal.7",
246 "man/man7/scope.7",
247 "man/man7/scripts.7",
248 "man/man7/workspaces.7",
249 ],
250 "name": "npm",
251 "readmeFilename": "README.md",
252 "repository": Object {
253 "type": "git",
254 "url": "git+https://github.com/npm/cli.git",
255 },
256 "version": "{VERSION}",
257 }
258 `
259
260 exports[`test/lib/commands/publish.js TAP no auth dry-run > must match snapshot 1`] = `
261 + @npmcli/[email protected]
262 `
263
264 exports[`test/lib/commands/publish.js TAP no auth dry-run > warns about auth being needed 1`] = `
265 Array [
266 "publish This command requires you to be logged in to https://registry.npmjs.org/ (dry-run)",
267 ]
268 `
269
270 exports[`test/lib/commands/publish.js TAP prioritize CLI flags over publishConfig > new package version 1`] = `
271 + @npmcli/[email protected]
272 `
273
274 exports[`test/lib/commands/publish.js TAP private access > must match snapshot 1`] = `
275 Array [
276 "package: @npm/[email protected]",
277 "Tarball Contents",
278 "55B package.json",
279 "Tarball Details",
280 "name: @npm/test-package",
281 "version: 1.0.0",
282 "filename: npm-test-package-1.0.0.tgz",
283 "package size: {size}",
284 "unpacked size: 55 B",
285 "shasum: {sha}",
286 "integrity: {integrity}
287 "total files: 1",
288 "Publishing to https://registry.npmjs.org/ with tag latest and restricted access",
289 ]
290 `
291
292 exports[`test/lib/commands/publish.js TAP private access > new package version 1`] = `
293 + @npm/[email protected]
294 `
295
296 exports[`test/lib/commands/publish.js TAP public access > must match snapshot 1`] = `
297 Array [
298 "package: @npm/[email protected]",
299 "Tarball Contents",
300 "55B package.json",
301 "Tarball Details",
302 "name: @npm/test-package",
303 "version: 1.0.0",
304 "filename: npm-test-package-1.0.0.tgz",
305 "package size: {size}",
306 "unpacked size: 55 B",
307 "shasum: {sha}",
308 "integrity: {integrity}
309 "total files: 1",
310 "Publishing to https://registry.npmjs.org/ with tag latest and public access",
311 ]
312 `
313
314 exports[`test/lib/commands/publish.js TAP public access > new package version 1`] = `
315 + @npm/[email protected]
316 `
317
318 exports[`test/lib/commands/publish.js TAP re-loads publishConfig.registry if added during script process > new package version 1`] = `
319 + @npmcli/[email protected]
320 `
321
322 exports[`test/lib/commands/publish.js TAP respects publishConfig.registry, runs appropriate scripts > new package version 1`] = `
323
324 > @npmcli/[email protected] prepublishOnly
325 > touch scripts-prepublishonly
326
327 > @npmcli/[email protected] publish
328 > touch scripts-publish
329
330 > @npmcli/[email protected] postpublish
331 > touch scripts-postpublish
332 + @npmcli/[email protected]
333 `
334
335 exports[`test/lib/commands/publish.js TAP restricted access > must match snapshot 1`] = `
336 Array [
337 "package: @npm/[email protected]",
338 "Tarball Contents",
339 "55B package.json",
340 "Tarball Details",
341 "name: @npm/test-package",
342 "version: 1.0.0",
343 "filename: npm-test-package-1.0.0.tgz",
344 "package size: {size}",
345 "unpacked size: 55 B",
346 "shasum: {sha}",
347 "integrity: {integrity}
348 "total files: 1",
349 "Publishing to https://registry.npmjs.org/ with tag latest and restricted access",
350 ]
351 `
352
353 exports[`test/lib/commands/publish.js TAP restricted access > new package version 1`] = `
354 + @npm/[email protected]
355 `
356
357 exports[`test/lib/commands/publish.js TAP scoped _auth config scoped registry > new package version 1`] = `
358 + @npm/[email protected]
359 `
360
361 exports[`test/lib/commands/publish.js TAP tarball > must match snapshot 1`] = `
362 Array [
363 "package: [email protected]",
364 "Tarball Contents",
365 String(
366 26B index.js
367 98B package.json
368 ),
369 "Tarball Details",
370 "name: test-tar-package",
371 "version: 1.0.0",
372 "filename: test-tar-package-1.0.0.tgz",
373 "package size: {size}",
374 "unpacked size: 124 B",
375 "shasum: {sha}",
376 "integrity: {integrity}
377 "total files: 2",
378 "Publishing to https://registry.npmjs.org/ with tag latest and default access",
379 ]
380 `
381
382 exports[`test/lib/commands/publish.js TAP tarball > new package json 1`] = `
383 + [email protected]
384 `
385
386 exports[`test/lib/commands/publish.js TAP workspaces all workspaces - color > all public workspaces 1`] = `
387 + [email protected]
388 + [email protected]
389 + [email protected]
390 `
391
392 exports[`test/lib/commands/publish.js TAP workspaces all workspaces - color > warns about skipped private workspace in color 1`] = `
393 Array [
394 "\\u001b[94mpublish\\u001b[39m npm auto-corrected some errors in your package.json when publishing. Please run \\"npm pkg fix\\" to address these errors.",
395 String(
396 \\u001b[94mpublish\\u001b[39m errors corrected:
397 \\u001b[94mpublish\\u001b[39m "repository" was changed from a string to an object
398 ),
399 "\\u001b[94mpublish\\u001b[39m npm auto-corrected some errors in your package.json when publishing. Please run \\"npm pkg fix\\" to address these errors.",
400 String(
401 \\u001b[94mpublish\\u001b[39m errors corrected:
402 \\u001b[94mpublish\\u001b[39m "repository" was changed from a string to an object
403 \\u001b[94mpublish\\u001b[39m "repository.url" was normalized to "git+https://github.com/npm/workspace-b.git"
404 ),
405 "\\u001b[94mpublish\\u001b[39m Skipping workspace \\u001b[36mworkspace-p\\u001b[39m, marked as \\u001b[1mprivate\\u001b[22m",
406 ]
407 `
408
409 exports[`test/lib/commands/publish.js TAP workspaces all workspaces - no color > all public workspaces 1`] = `
410 + [email protected]
411 + [email protected]
412 + [email protected]
413 `
414
415 exports[`test/lib/commands/publish.js TAP workspaces all workspaces - no color > warns about skipped private workspace 1`] = `
416 Array [
417 "publish npm auto-corrected some errors in your package.json when publishing. Please run \\"npm pkg fix\\" to address these errors.",
418 String(
419 publish errors corrected:
420 publish "repository" was changed from a string to an object
421 ),
422 "publish npm auto-corrected some errors in your package.json when publishing. Please run \\"npm pkg fix\\" to address these errors.",
423 String(
424 publish errors corrected:
425 publish "repository" was changed from a string to an object
426 publish "repository.url" was normalized to "git+https://github.com/npm/workspace-b.git"
427 ),
428 "publish Skipping workspace workspace-p, marked as private",
429 ]
430 `
431
432 exports[`test/lib/commands/publish.js TAP workspaces all workspaces - some marked private > one marked private 1`] = `
433 + [email protected]
434 `
435
436 exports[`test/lib/commands/publish.js TAP workspaces different package spec > publish different package spec 1`] = `
437 + [email protected]
438 `
439
440 exports[`test/lib/commands/publish.js TAP workspaces json > all workspaces in json 1`] = `
441 {
442 "workspace-a": {
443 "id": "[email protected]",
444 "name": "workspace-a",
445 "version": "1.2.3-a",
446 "size": "{size}",
447 "unpackedSize": 82,
448 "shasum": "{sha}",
449 "integrity": "{integrity}",
450 "filename": "workspace-a-1.2.3-a.tgz",
451 "files": [
452 {
453 "path": "package.json",
454 "size": "{size}",
455 "mode": 420
456 }
457 ],
458 "entryCount": 1,
459 "bundled": []
460 },
461 "workspace-b": {
462 "id": "[email protected]",
463 "name": "workspace-b",
464 "version": "1.2.3-n",
465 "size": "{size}",
466 "unpackedSize": 92,
467 "shasum": "{sha}",
468 "integrity": "{integrity}",
469 "filename": "workspace-b-1.2.3-n.tgz",
470 "files": [
471 {
472 "path": "package.json",
473 "size": "{size}",
474 "mode": 420
475 }
476 ],
477 "entryCount": 1,
478 "bundled": []
479 },
480 "workspace-n": {
481 "id": "[email protected]",
482 "name": "workspace-n",
483 "version": "1.2.3-n",
484 "size": "{size}",
485 "unpackedSize": 42,
486 "shasum": "{sha}",
487 "integrity": "{integrity}",
488 "filename": "workspace-n-1.2.3-n.tgz",
489 "files": [
490 {
491 "path": "package.json",
492 "size": "{size}",
493 "mode": 420
494 }
495 ],
496 "entryCount": 1,
497 "bundled": []
498 }
499 }
500 `
501
502 exports[`test/lib/commands/publish.js TAP workspaces one workspace - success > single workspace 1`] = `
503 + [email protected]
504 `