@verdaccio/e2e-cli 3.0.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/bin/e2e-cli.js +6 -26
  2. package/build/adapters/adapter.d.ts +1 -0
  3. package/build/adapters/bun.d.ts +2 -0
  4. package/build/adapters/deno.d.ts +2 -0
  5. package/build/adapters/index.d.ts +5 -0
  6. package/build/adapters/npm.d.ts +2 -0
  7. package/build/adapters/pnpm.d.ts +2 -0
  8. package/build/adapters/yarn-modern.d.ts +2 -0
  9. package/build/cjs/_virtual/_rolldown/runtime.cjs +23 -0
  10. package/build/cjs/adapters/bun.cjs +64 -0
  11. package/build/cjs/adapters/bun.cjs.map +1 -0
  12. package/build/cjs/adapters/deno.cjs +61 -0
  13. package/build/cjs/adapters/deno.cjs.map +1 -0
  14. package/build/cjs/adapters/index.cjs +10 -0
  15. package/build/cjs/adapters/npm.cjs +85 -0
  16. package/build/cjs/adapters/npm.cjs.map +1 -0
  17. package/build/cjs/adapters/pnpm.cjs +114 -0
  18. package/build/cjs/adapters/pnpm.cjs.map +1 -0
  19. package/build/cjs/adapters/yarn-modern.cjs +207 -0
  20. package/build/cjs/adapters/yarn-modern.cjs.map +1 -0
  21. package/build/cjs/index.cjs +186 -11
  22. package/build/cjs/index.cjs.map +1 -0
  23. package/build/cjs/reporter.cjs +113 -0
  24. package/build/cjs/reporter.cjs.map +1 -0
  25. package/build/cjs/runner.cjs +141 -0
  26. package/build/cjs/runner.cjs.map +1 -0
  27. package/build/cjs/scenarios/index.cjs +25 -0
  28. package/build/cjs/scenarios/index.cjs.map +1 -0
  29. package/build/cjs/scenarios/install-multiple-deps.cjs +119 -0
  30. package/build/cjs/scenarios/install-multiple-deps.cjs.map +1 -0
  31. package/build/cjs/scenarios/metadata.cjs +121 -0
  32. package/build/cjs/scenarios/metadata.cjs.map +1 -0
  33. package/build/cjs/scenarios/minimum-release-age.cjs +111 -0
  34. package/build/cjs/scenarios/minimum-release-age.cjs.map +1 -0
  35. package/build/cjs/scenarios/search.cjs +200 -0
  36. package/build/cjs/scenarios/search.cjs.map +1 -0
  37. package/build/cjs/scenarios/tarballs.cjs +170 -0
  38. package/build/cjs/scenarios/tarballs.cjs.map +1 -0
  39. package/build/cjs/scenarios/uplink-failure.cjs +141 -0
  40. package/build/cjs/scenarios/uplink-failure.cjs.map +1 -0
  41. package/build/cjs/tests/audit.cjs +60 -0
  42. package/build/cjs/tests/audit.cjs.map +1 -0
  43. package/build/cjs/tests/ci.cjs +83 -0
  44. package/build/cjs/tests/ci.cjs.map +1 -0
  45. package/build/cjs/tests/deprecate.cjs +108 -0
  46. package/build/cjs/tests/deprecate.cjs.map +1 -0
  47. package/build/cjs/tests/dist-tags.cjs +43 -0
  48. package/build/cjs/tests/dist-tags.cjs.map +1 -0
  49. package/build/cjs/tests/index.cjs +49 -0
  50. package/build/cjs/tests/index.cjs.map +1 -0
  51. package/build/cjs/tests/info.cjs +31 -0
  52. package/build/cjs/tests/info.cjs.map +1 -0
  53. package/build/cjs/tests/install.cjs +30 -0
  54. package/build/cjs/tests/install.cjs.map +1 -0
  55. package/build/cjs/tests/login.cjs +126 -0
  56. package/build/cjs/tests/login.cjs.map +1 -0
  57. package/build/cjs/tests/ping.cjs +26 -0
  58. package/build/cjs/tests/ping.cjs.map +1 -0
  59. package/build/cjs/tests/publish.cjs +36 -0
  60. package/build/cjs/tests/publish.cjs.map +1 -0
  61. package/build/cjs/tests/search.cjs +23 -0
  62. package/build/cjs/tests/search.cjs.map +1 -0
  63. package/build/cjs/tests/unpublish.cjs +40 -0
  64. package/build/cjs/tests/unpublish.cjs.map +1 -0
  65. package/build/cjs/utils/e2e-config.cjs +59 -0
  66. package/build/cjs/utils/e2e-config.cjs.map +1 -0
  67. package/build/cjs/utils/http-client.cjs +111 -0
  68. package/build/cjs/utils/http-client.cjs.map +1 -0
  69. package/build/cjs/utils/info.cjs +25 -0
  70. package/build/cjs/utils/info.cjs.map +1 -0
  71. package/build/cjs/utils/mock-uplink.cjs +196 -0
  72. package/build/cjs/utils/mock-uplink.cjs.map +1 -0
  73. package/build/cjs/utils/pending-checks.cjs +21 -0
  74. package/build/cjs/utils/pending-checks.cjs.map +1 -0
  75. package/build/cjs/utils/process.cjs +96 -0
  76. package/build/cjs/utils/process.cjs.map +1 -0
  77. package/build/cjs/utils/project.cjs +55 -0
  78. package/build/cjs/utils/project.cjs.map +1 -0
  79. package/build/cjs/utils/publish.cjs +117 -0
  80. package/build/cjs/utils/publish.cjs.map +1 -0
  81. package/build/cjs/utils/registry-client.cjs +56 -0
  82. package/build/cjs/utils/registry-client.cjs.map +1 -0
  83. package/build/esm/adapters/bun.js +62 -0
  84. package/build/esm/adapters/bun.js.map +1 -0
  85. package/build/esm/adapters/deno.js +59 -0
  86. package/build/esm/adapters/deno.js.map +1 -0
  87. package/build/esm/adapters/index.js +6 -0
  88. package/build/esm/adapters/npm.js +83 -0
  89. package/build/esm/adapters/npm.js.map +1 -0
  90. package/build/esm/adapters/pnpm.js +112 -0
  91. package/build/esm/adapters/pnpm.js.map +1 -0
  92. package/build/esm/adapters/yarn-modern.js +204 -0
  93. package/build/esm/adapters/yarn-modern.js.map +1 -0
  94. package/build/esm/index.js +174 -10
  95. package/build/esm/index.js.map +1 -0
  96. package/build/esm/reporter.js +108 -0
  97. package/build/esm/reporter.js.map +1 -0
  98. package/build/esm/runner.js +138 -0
  99. package/build/esm/runner.js.map +1 -0
  100. package/build/esm/scenarios/index.js +19 -0
  101. package/build/esm/scenarios/index.js.map +1 -0
  102. package/build/esm/scenarios/install-multiple-deps.js +117 -0
  103. package/build/esm/scenarios/install-multiple-deps.js.map +1 -0
  104. package/build/esm/scenarios/metadata.js +119 -0
  105. package/build/esm/scenarios/metadata.js.map +1 -0
  106. package/build/esm/scenarios/minimum-release-age.js +108 -0
  107. package/build/esm/scenarios/minimum-release-age.js.map +1 -0
  108. package/build/esm/scenarios/search.js +198 -0
  109. package/build/esm/scenarios/search.js.map +1 -0
  110. package/build/esm/scenarios/tarballs.js +168 -0
  111. package/build/esm/scenarios/tarballs.js.map +1 -0
  112. package/build/esm/scenarios/uplink-failure.js +139 -0
  113. package/build/esm/scenarios/uplink-failure.js.map +1 -0
  114. package/build/esm/tests/audit.js +57 -0
  115. package/build/esm/tests/audit.js.map +1 -0
  116. package/build/esm/tests/ci.js +80 -0
  117. package/build/esm/tests/ci.js.map +1 -0
  118. package/build/esm/tests/deprecate.js +105 -0
  119. package/build/esm/tests/deprecate.js.map +1 -0
  120. package/build/esm/tests/dist-tags.js +41 -0
  121. package/build/esm/tests/dist-tags.js.map +1 -0
  122. package/build/esm/tests/index.js +37 -0
  123. package/build/esm/tests/index.js.map +1 -0
  124. package/build/esm/tests/info.js +29 -0
  125. package/build/esm/tests/info.js.map +1 -0
  126. package/build/esm/tests/install.js +28 -0
  127. package/build/esm/tests/install.js.map +1 -0
  128. package/build/esm/tests/login.js +122 -0
  129. package/build/esm/tests/login.js.map +1 -0
  130. package/build/esm/tests/ping.js +24 -0
  131. package/build/esm/tests/ping.js.map +1 -0
  132. package/build/esm/tests/publish.js +34 -0
  133. package/build/esm/tests/publish.js.map +1 -0
  134. package/build/esm/tests/search.js +21 -0
  135. package/build/esm/tests/search.js.map +1 -0
  136. package/build/esm/tests/unpublish.js +38 -0
  137. package/build/esm/tests/unpublish.js.map +1 -0
  138. package/build/esm/utils/e2e-config.js +58 -0
  139. package/build/esm/utils/e2e-config.js.map +1 -0
  140. package/build/esm/utils/http-client.js +105 -0
  141. package/build/esm/utils/http-client.js.map +1 -0
  142. package/build/esm/utils/info.js +24 -0
  143. package/build/esm/utils/info.js.map +1 -0
  144. package/build/esm/utils/mock-uplink.js +194 -0
  145. package/build/esm/utils/mock-uplink.js.map +1 -0
  146. package/build/esm/utils/pending-checks.js +21 -0
  147. package/build/esm/utils/pending-checks.js.map +1 -0
  148. package/build/esm/utils/process.js +92 -0
  149. package/build/esm/utils/process.js.map +1 -0
  150. package/build/esm/utils/project.js +50 -0
  151. package/build/esm/utils/project.js.map +1 -0
  152. package/build/esm/utils/publish.js +113 -0
  153. package/build/esm/utils/publish.js.map +1 -0
  154. package/build/esm/utils/registry-client.js +53 -0
  155. package/build/esm/utils/registry-client.js.map +1 -0
  156. package/build/index.d.ts +6 -15
  157. package/build/reporter.d.ts +7 -0
  158. package/build/runner.d.ts +13 -0
  159. package/build/scenarios/index.d.ts +9 -0
  160. package/build/scenarios/install-multiple-deps.d.ts +2 -0
  161. package/build/scenarios/metadata.d.ts +2 -0
  162. package/build/scenarios/minimum-release-age.d.ts +11 -0
  163. package/build/scenarios/search.d.ts +2 -0
  164. package/build/scenarios/tarballs.d.ts +2 -0
  165. package/build/scenarios/uplink-failure.d.ts +2 -0
  166. package/build/tests/audit.d.ts +2 -0
  167. package/build/tests/ci.d.ts +2 -0
  168. package/build/tests/deprecate.d.ts +2 -0
  169. package/build/tests/dist-tags.d.ts +2 -0
  170. package/build/tests/index.d.ts +15 -0
  171. package/build/tests/info.d.ts +2 -0
  172. package/build/tests/install.d.ts +2 -0
  173. package/build/tests/login.d.ts +2 -0
  174. package/build/tests/ping.d.ts +2 -0
  175. package/build/tests/publish.d.ts +2 -0
  176. package/build/tests/search.d.ts +2 -0
  177. package/build/tests/unpublish.d.ts +2 -0
  178. package/build/types.d.ts +91 -0
  179. package/build/utils/e2e-config.d.ts +21 -0
  180. package/build/utils/http-client.d.ts +49 -0
  181. package/build/utils/index.d.ts +4 -0
  182. package/build/utils/info.d.ts +14 -0
  183. package/build/utils/mock-uplink.d.ts +47 -0
  184. package/build/utils/pending-checks.d.ts +12 -0
  185. package/build/utils/process.d.ts +11 -0
  186. package/build/utils/project.d.ts +6 -0
  187. package/build/utils/publish.d.ts +17 -0
  188. package/build/utils/registry-client.d.ts +15 -0
  189. package/package.json +16 -14
  190. package/Cargo.lock +0 -1591
  191. package/Cargo.toml +0 -19
  192. package/build/bin/verdaccio-e2e +0 -0
  193. package/scripts/build-js-package.mjs +0 -25
  194. package/src/e2e_tests/audit.rs +0 -51
  195. package/src/e2e_tests/ci.rs +0 -32
  196. package/src/e2e_tests/deprecate.rs +0 -64
  197. package/src/e2e_tests/dist_tags.rs +0 -56
  198. package/src/e2e_tests/info.rs +0 -43
  199. package/src/e2e_tests/install.rs +0 -27
  200. package/src/e2e_tests/login.rs +0 -64
  201. package/src/e2e_tests/mod.rs +0 -104
  202. package/src/e2e_tests/ping.rs +0 -33
  203. package/src/e2e_tests/publish.rs +0 -68
  204. package/src/e2e_tests/search.rs +0 -14
  205. package/src/e2e_tests/unpublish.rs +0 -37
  206. package/src/main.rs +0 -1411
  207. package/src/scenarios/install_multiple_deps.rs +0 -99
  208. package/src/scenarios/minimum_release_age.rs +0 -45
  209. package/src/scenarios/mod.rs +0 -11
@@ -0,0 +1,9 @@
1
+ import { TestDefinition } from '../types';
2
+ import { installMultipleDepsScenario } from './install-multiple-deps';
3
+ import { metadataScenario } from './metadata';
4
+ import { minimumReleaseAgeScenario } from './minimum-release-age';
5
+ import { searchScenario } from './search';
6
+ import { tarballsScenario } from './tarballs';
7
+ import { uplinkFailureScenario } from './uplink-failure';
8
+ export declare const allScenarios: TestDefinition[];
9
+ export { installMultipleDepsScenario, minimumReleaseAgeScenario, searchScenario, tarballsScenario, metadataScenario, uplinkFailureScenario, };
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const installMultipleDepsScenario: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const metadataScenario: TestDefinition;
@@ -0,0 +1,11 @@
1
+ import { PackageManagerAdapter, TestDefinition } from '../types';
2
+ /**
3
+ * True only for pnpm versions that actually enforce minimumReleaseAge.
4
+ *
5
+ * The cooldown is honored in pnpm 11.1.0+, but it is silently ignored in
6
+ * 11.0.0 / 11.0.1 (and the 11.0.0 release candidates) — those versions install
7
+ * brand-new packages regardless of the configured cooldown. We scope this
8
+ * scenario to pnpm 11.1.0 and newer so it doesn't false-fail on that regression.
9
+ */
10
+ export declare function isPnpm11Plus(adapter: PackageManagerAdapter): boolean;
11
+ export declare const minimumReleaseAgeScenario: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const searchScenario: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const tarballsScenario: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const uplinkFailureScenario: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const auditTest: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const ciTest: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const deprecateTest: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const distTagsTest: TestDefinition;
@@ -0,0 +1,15 @@
1
+ import { allScenarios, installMultipleDepsScenario, metadataScenario, minimumReleaseAgeScenario, searchScenario, tarballsScenario, uplinkFailureScenario } from '../scenarios';
2
+ import { TestDefinition } from '../types';
3
+ import { auditTest } from './audit';
4
+ import { ciTest } from './ci';
5
+ import { deprecateTest } from './deprecate';
6
+ import { distTagsTest } from './dist-tags';
7
+ import { infoTest } from './info';
8
+ import { installTest } from './install';
9
+ import { loginTest } from './login';
10
+ import { pingTest } from './ping';
11
+ import { publishTest } from './publish';
12
+ import { searchTest } from './search';
13
+ import { unpublishTest } from './unpublish';
14
+ export declare const allTests: TestDefinition[];
15
+ export { publishTest, installTest, ciTest, auditTest, infoTest, deprecateTest, distTagsTest, loginTest, pingTest, searchTest, unpublishTest, installMultipleDepsScenario, minimumReleaseAgeScenario, tarballsScenario, metadataScenario, searchScenario, uplinkFailureScenario, allScenarios, };
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const infoTest: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const installTest: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const loginTest: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const pingTest: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const publishTest: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const searchTest: TestDefinition;
@@ -0,0 +1,2 @@
1
+ import { TestDefinition } from '../types';
2
+ export declare const unpublishTest: TestDefinition;
@@ -0,0 +1,91 @@
1
+ import { SpawnOptions } from 'child_process';
2
+ export type ExecOutput = {
3
+ stdout: string;
4
+ stderr: string;
5
+ };
6
+ export type ExecFn = (options: SpawnOptions, ...args: string[]) => Promise<ExecOutput>;
7
+ export type TestContext = {
8
+ registryUrl: string;
9
+ token: string;
10
+ port: number;
11
+ exec: ExecFn;
12
+ adapter: PackageManagerAdapter;
13
+ /** Unique suffix for package names to avoid conflicts across runs */
14
+ runId: string;
15
+ /** Report a sub-test step. Runs the callback and reports pass/fail. */
16
+ subTest: (label: string, fn: () => Promise<void>) => Promise<void>;
17
+ };
18
+ export type SubTestResult = {
19
+ label: string;
20
+ passed: boolean;
21
+ duration: number;
22
+ error?: string;
23
+ };
24
+ export type TestResult = {
25
+ name: string;
26
+ passed: boolean;
27
+ duration: number;
28
+ error?: string;
29
+ subTests?: SubTestResult[];
30
+ };
31
+ export type SuiteResult = {
32
+ adapter: string;
33
+ tests: TestResult[];
34
+ passed: number;
35
+ failed: number;
36
+ skipped: number;
37
+ duration: number;
38
+ };
39
+ export type TestDefinition = {
40
+ name: string;
41
+ run: (ctx: TestContext) => Promise<void>;
42
+ /** Commands required for this test (e.g. 'deprecate', 'search'). Skipped if adapter doesn't support them. */
43
+ requires?: string[];
44
+ /**
45
+ * Minimum timeout (ms) for this test. The effective timeout is the larger of
46
+ * this and the CLI-level --timeout. Use for long scenarios (large tarballs,
47
+ * uplink failure simulation) that outgrow the default per-test budget.
48
+ */
49
+ timeout?: number;
50
+ /**
51
+ * Predicate to gate a test to specific adapters/versions. Returns false to skip.
52
+ * Use for tests that only make sense on a particular package manager or version
53
+ * (e.g. pnpm-only settings). Evaluated after the `requires` check.
54
+ */
55
+ appliesTo?: (adapter: PackageManagerAdapter) => boolean;
56
+ };
57
+ export interface PackageManagerAdapter {
58
+ /** Display name, e.g. "npm@10" */
59
+ name: string;
60
+ /** Package manager type: npm, pnpm, yarn-modern, bun, deno */
61
+ type: 'npm' | 'pnpm' | 'yarn-modern' | 'bun' | 'deno';
62
+ /** Resolved path to the binary */
63
+ bin: string;
64
+ /** Commands this PM supports */
65
+ supports: Set<string>;
66
+ /** Build --registry args */
67
+ registryArg(url: string): string[];
68
+ /** Build --prefix / --cwd args */
69
+ prefixArg(folder: string): string[];
70
+ /** Execute a command with this PM */
71
+ exec(options: SpawnOptions, ...args: string[]): Promise<ExecOutput>;
72
+ /** Prepare a temp project for testing. Returns path to temp folder. */
73
+ prepareProject(packageName: string, version: string, registryUrl: string, port: number, token: string, dependencies?: Record<string, string>, devDependencies?: Record<string, string>): Promise<{
74
+ tempFolder: string;
75
+ }>;
76
+ /** Import a Verdaccio yarn plugin into a project (yarn-modern only) */
77
+ importPlugin?(cwd: string, pluginName: string): Promise<void>;
78
+ }
79
+ export type CliOptions = {
80
+ registry: string;
81
+ pm?: string[];
82
+ test?: string[];
83
+ concurrency: number;
84
+ timeout: number;
85
+ token?: string;
86
+ verbose: boolean;
87
+ /** Port of the mock uplink used by scenario:uplink-failure (also E2E_UPLINK_PORT) */
88
+ uplinkPort?: number;
89
+ /** Print the recommended registry config for the full battery and exit */
90
+ printConfig?: boolean;
91
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Recommended Verdaccio config for running the full e2e-cli battery,
3
+ * printed by `verdaccio-e2e --print-config`. It is what the consuming repos'
4
+ * CI jobs and scripts/run-e2e.sh feed to `verdaccio --config`:
5
+ *
6
+ * - max_body_size raised so scenario:tarballs can publish ~30 MB packages
7
+ * (Verdaccio's default is 10mb)
8
+ * - an `e2emock` uplink + `e2e-uplink-*` package pattern wired to the mock
9
+ * uplink server that scenario:uplink-failure starts on E2E_UPLINK_PORT
10
+ * (short timeout so the "slow uplink" case completes quickly; high
11
+ * max_fails so simulated failures don't trip the circuit breaker for
12
+ * later sub-tests)
13
+ * - NO npmjs uplink: the whole suite publishes every package it consumes,
14
+ * so the registry under test never talks to the outside world and the
15
+ * battery runs fully offline (and deterministically in CI)
16
+ *
17
+ * Relative paths (storage/htpasswd) resolve next to the config file, so write
18
+ * it into a disposable directory.
19
+ */
20
+ export declare const DEFAULT_UPLINK_PORT = 4874;
21
+ export declare function buildE2EConfig(uplinkPort?: number): string;
@@ -0,0 +1,49 @@
1
+ export type PackumentResponse = {
2
+ status: number;
3
+ headers: Headers;
4
+ /** Parsed JSON body, or undefined when the response is not JSON (e.g. 304) */
5
+ body?: any;
6
+ };
7
+ export type TarballDownload = {
8
+ status: number;
9
+ headers: Headers;
10
+ /** Total bytes received */
11
+ bytes: number;
12
+ /** hex-encoded sha1 of the received bytes (matches dist.shasum) */
13
+ sha1: string;
14
+ /** `sha512-<base64>` of the received bytes (matches dist.integrity) */
15
+ integrity: string;
16
+ };
17
+ export type FetchPackumentOptions = {
18
+ /** Request the abbreviated (install) metadata format */
19
+ abbreviated?: boolean;
20
+ /** Send If-None-Match with this value */
21
+ etag?: string;
22
+ /** Bearer token */
23
+ token?: string;
24
+ };
25
+ export declare const ABBREVIATED_ACCEPT = "application/vnd.npm.install-v1+json";
26
+ /**
27
+ * Registry URL for a package name. Scoped names are encoded with the same
28
+ * `%2f` form npm clients use: `@scope%2fname`.
29
+ */
30
+ export declare function packumentUrl(registryUrl: string, pkgName: string): string;
31
+ export declare function fetchPackument(registryUrl: string, pkgName: string, options?: FetchPackumentOptions): Promise<PackumentResponse>;
32
+ export type DownloadTarballOptions = {
33
+ signal?: AbortSignal;
34
+ token?: string;
35
+ /** Called after the first chunk of the body arrives (useful to abort mid-stream) */
36
+ onFirstChunk?: () => void;
37
+ /** Called after every chunk with the total bytes received so far (useful to abort at a threshold) */
38
+ onChunk?: (bytesReceived: number) => void;
39
+ };
40
+ /**
41
+ * Download a tarball fully, computing sha1/sha512 integrity on the fly.
42
+ * Rejects with the underlying error when aborted or the connection drops.
43
+ */
44
+ export declare function downloadTarball(url: string, options?: DownloadTarballOptions): Promise<TarballDownload>;
45
+ /** Compute npm-style dist values (shasum/integrity) for a buffer. */
46
+ export declare function computeDist(buffer: Buffer): {
47
+ shasum: string;
48
+ integrity: string;
49
+ };
@@ -0,0 +1,4 @@
1
+ export { exec, setVerbose } from './process';
2
+ export { createTempFolder, getPackageJSON, getREADME, prepareGenericEmptyProject } from './project';
3
+ export { createUser, pingRegistry } from './registry-client';
4
+ export { normalizeInfo, parseInfoJson } from './info';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Normalize the parsed output of `npm/pnpm info <pkg> --json`.
3
+ *
4
+ * npm 12+ wraps the result in a single-element JSON array
5
+ * (e.g. `[{ "name": "verdaccio", ... }]`) for both full-packument and
6
+ * version-specific queries, whereas older npm versions return a bare object.
7
+ * When multiple results match a range, the array holds one entry per match;
8
+ * the last entry is the highest (latest) version, which is what the tests want.
9
+ *
10
+ * Returns the bare object as-is for backward compatibility.
11
+ */
12
+ export declare function normalizeInfo(parsed: any): any;
13
+ /** Parse `info --json` stdout and normalize to a single info object. */
14
+ export declare function parseInfoJson(stdout: string): any;
@@ -0,0 +1,47 @@
1
+ export type UplinkMode =
2
+ /** Serve packuments and tarballs normally */
3
+ 'ok'
4
+ /** Send tarball headers + half the body, then destroy the socket */
5
+ | 'drop-mid-stream'
6
+ /** Delay every response long enough to trip the registry's uplink timeout */
7
+ | 'slow'
8
+ /** Respond 500 to everything */
9
+ | 'error-500';
10
+ type MockPackage = {
11
+ name: string;
12
+ version: string;
13
+ tarball: Buffer;
14
+ shasum: string;
15
+ integrity: string;
16
+ };
17
+ /**
18
+ * Minimal controllable npm uplink used by scenario:uplink-failure.
19
+ *
20
+ * The registry under test is configured (see --print-config) to proxy the
21
+ * `e2e-uplink-*` package pattern to this server, so the scenario can flip the
22
+ * uplink between healthy, dropping connections mid-tarball, slow, and down.
23
+ */
24
+ export declare class MockUplink {
25
+ readonly port: number;
26
+ mode: UplinkMode;
27
+ requests: string[];
28
+ private server?;
29
+ private packages;
30
+ private searchResults;
31
+ constructor(port: number);
32
+ /** Register a package served by this uplink; tarball is random (incompressible) bytes. */
33
+ addPackage(name: string, tarballBytes?: number): MockPackage;
34
+ /** Register a result served by the /-/v1/search endpoint. */
35
+ addSearchResult(name: string, version?: string): void;
36
+ /**
37
+ * npmjs-faithful /-/v1/search: filters by `text` substring, applies
38
+ * `from`/`size` itself (like registry.npmjs.org does) and reports the real
39
+ * `total` of matches. Mimicking the upstream offsetting is what exposes
40
+ * double pagination in the registry under test.
41
+ */
42
+ private searchResponse;
43
+ private packument;
44
+ start(): Promise<void>;
45
+ stop(): Promise<void>;
46
+ }
47
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Pending contract checks pin registry behavior that is correct per the
3
+ * npmjs contract but still red against some published Verdaccio versions.
4
+ * They are off by default; E2E_PENDING_CONTRACT_CHECKS enables them:
5
+ *
6
+ * E2E_PENDING_CONTRACT_CHECKS=true → all scenarios
7
+ * E2E_PENDING_CONTRACT_CHECKS=tarballs → one scenario
8
+ * E2E_PENDING_CONTRACT_CHECKS=tarballs,search → a list
9
+ *
10
+ * Flip the default once the registry-side fixes are published everywhere.
11
+ */
12
+ export declare function pendingContractChecksEnabled(scenario: string): boolean;
@@ -0,0 +1,11 @@
1
+ import { SpawnOptions } from 'child_process';
2
+ import { ExecOutput } from '../types';
3
+ export declare function setVerbose(v: boolean): void;
4
+ /**
5
+ * Always-on scenario tracing, printed inline with the test output in the same
6
+ * style as the verbose `$ <command>` lines — so a red scenario explains what
7
+ * it actually saw (statuses, headers, bodies, timings) in any run, CI or
8
+ * local, without a reproduction. Accepts util.format tokens (%s %d %j %o).
9
+ */
10
+ export declare function trace(fmt: string, ...args: unknown[]): void;
11
+ export declare function exec(options: SpawnOptions, cmd: string, args: string[]): Promise<ExecOutput>;
@@ -0,0 +1,6 @@
1
+ export declare function createTempFolder(prefix: string): Promise<string>;
2
+ export declare function getPackageJSON(packageName: string, version?: string, dependencies?: Record<string, string>, devDependencies?: Record<string, string>): string;
3
+ export declare function getREADME(packageName: string): string;
4
+ export declare function prepareGenericEmptyProject(packageName: string, version: string, port: number, token: string, registryDomain: string, dependencies?: Record<string, string>, devDependencies?: Record<string, string>): Promise<{
5
+ tempFolder: string;
6
+ }>;
@@ -0,0 +1,17 @@
1
+ import { TestContext } from '../types';
2
+ /** Build a minimal valid npm package tarball (package/package.json inside). */
3
+ export declare function buildPackageTarball(pkgName: string, version: string, dependencies?: Record<string, string>): Buffer;
4
+ /**
5
+ * Publish straight through the registry HTTP API (same PUT an npm client
6
+ * sends). Used for adapters that cannot publish themselves (eg. deno) so
7
+ * every fixture still comes from the registry under test — never from an
8
+ * external registry.
9
+ */
10
+ export declare function publishViaHttp(ctx: TestContext, pkgName: string, version?: string, dependencies?: Record<string, string>): Promise<void>;
11
+ /**
12
+ * Publish a package to the registry under test so later steps (install, ci,
13
+ * audit, info, search…) can consume it without ever touching an external
14
+ * registry — the whole suite must be runnable offline. Uses the package
15
+ * manager when it can publish, the raw HTTP API otherwise (eg. deno).
16
+ */
17
+ export declare function publishLocalPackage(ctx: TestContext, pkgName: string, version?: string, dependencies?: Record<string, string>): Promise<void>;
@@ -0,0 +1,15 @@
1
+ export type RegistryAuth = {
2
+ token: string;
3
+ user: string;
4
+ };
5
+ /**
6
+ * Creates a user on the registry and returns the auth token.
7
+ * Uses a unique username per run to avoid 409 conflicts.
8
+ * Works against any running Verdaccio instance with htpasswd auth.
9
+ */
10
+ export declare function createUser(registryUrl: string, user?: string, password?: string): Promise<RegistryAuth>;
11
+ /**
12
+ * Ping the registry to check it's alive.
13
+ * Uses @verdaccio/registry-cli ping.
14
+ */
15
+ export declare function pingRegistry(registryUrl: string): Promise<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/e2e-cli",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "CLI tool to run Verdaccio e2e tests against any running registry",
@@ -11,11 +11,7 @@
11
11
  },
12
12
  "files": [
13
13
  "build",
14
- "bin",
15
- "Cargo.lock",
16
- "Cargo.toml",
17
- "scripts",
18
- "src"
14
+ "bin"
19
15
  ],
20
16
  "bin": {
21
17
  "verdaccio-e2e": "./bin/e2e-cli.js"
@@ -30,14 +26,20 @@
30
26
  "types": "./build/index.d.ts"
31
27
  }
32
28
  },
33
- "dependencies": {},
34
- "devDependencies": {},
29
+ "dependencies": {
30
+ "@verdaccio/registry-cli": "^1.1.0",
31
+ "debug": "4.4.3",
32
+ "get-port": "7.2.0",
33
+ "js-yaml": "5.2.3"
34
+ },
35
+ "devDependencies": {
36
+ "@types/debug": "4.1.13",
37
+ "@types/js-yaml": "4.0.9",
38
+ "@types/node": "26.2.0",
39
+ "vite": "8.2.1"
40
+ },
35
41
  "scripts": {
36
- "build": "cargo build --release && node scripts/build-js-package.mjs",
37
- "postinstall": "cargo build --release && node scripts/build-js-package.mjs",
38
- "clean": "rimraf build target",
39
- "fmt:check": "cargo fmt -- --check",
40
- "clippy": "cargo clippy --all-targets -- -D warnings",
41
- "docs": "cargo doc --no-deps"
42
+ "build": "vite build && tsc --emitDeclarationOnly -p tsconfig.build.json",
43
+ "clean": "rimraf build"
42
44
  }
43
45
  }