@verdaccio/e2e-ui 2.8.0 → 2.10.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.
- package/README.md +44 -8
- package/build/cjs/commands/index.cjs +1 -2
- package/build/cjs/features.cjs +6 -2
- package/build/cjs/features.cjs.map +1 -1
- package/build/cjs/index.cjs +6 -2
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/tasks/publish.cjs +1 -2
- package/build/cjs/tasks/publish.cjs.map +1 -1
- package/build/cjs/testIds.cjs +3 -2
- package/build/cjs/testIds.cjs.map +1 -1
- package/build/cjs/tests/change-password.cjs +1 -2
- package/build/cjs/tests/detail.cjs +1 -2
- package/build/cjs/tests/failure-modes.cjs +1 -2
- package/build/cjs/tests/home-detail-ux.cjs +1 -2
- package/build/cjs/tests/home.cjs +1 -2
- package/build/cjs/tests/i18n-keys.cjs +1 -2
- package/build/cjs/tests/index.cjs +4 -0
- package/build/cjs/tests/layout.cjs +1 -2
- package/build/cjs/tests/manifest-rendering.cjs +1 -2
- package/build/cjs/tests/prefixed-routing.cjs +53 -0
- package/build/cjs/tests/prefixed-routing.cjs.map +1 -0
- package/build/cjs/tests/provenance.cjs +133 -0
- package/build/cjs/tests/provenance.cjs.map +1 -0
- package/build/cjs/tests/publish.cjs +1 -2
- package/build/cjs/tests/search.cjs +1 -2
- package/build/cjs/tests/session.cjs +1 -2
- package/build/cjs/tests/settings.cjs +1 -2
- package/build/cjs/tests/signin.cjs +1 -2
- package/build/cjs/tests/signup.cjs +1 -2
- package/build/esm/commands/index.js +1 -2
- package/build/esm/features.js +6 -2
- package/build/esm/features.js.map +1 -1
- package/build/esm/index.js +5 -3
- package/build/esm/index.js.map +1 -1
- package/build/esm/tasks/publish.js +1 -2
- package/build/esm/testIds.js +3 -2
- package/build/esm/testIds.js.map +1 -1
- package/build/esm/tests/change-password.js +1 -2
- package/build/esm/tests/detail.js +1 -2
- package/build/esm/tests/failure-modes.js +1 -2
- package/build/esm/tests/home-detail-ux.js +1 -2
- package/build/esm/tests/home.js +1 -2
- package/build/esm/tests/i18n-keys.js +1 -2
- package/build/esm/tests/index.js +3 -1
- package/build/esm/tests/layout.js +1 -2
- package/build/esm/tests/manifest-rendering.js +1 -2
- package/build/esm/tests/prefixed-routing.js +53 -0
- package/build/esm/tests/prefixed-routing.js.map +1 -0
- package/build/esm/tests/provenance.js +133 -0
- package/build/esm/tests/provenance.js.map +1 -0
- package/build/esm/tests/publish.js +1 -2
- package/build/esm/tests/search.js +1 -2
- package/build/esm/tests/session.js +1 -2
- package/build/esm/tests/settings.js +1 -2
- package/build/esm/tests/signin.js +1 -2
- package/build/esm/tests/signup.js +1 -2
- package/build/features.d.ts +12 -0
- package/build/index.d.ts +1 -1
- package/build/testIds.d.ts +4 -0
- package/build/tests/index.d.ts +2 -0
- package/build/tests/prefixed-routing.d.ts +2 -0
- package/build/tests/provenance.d.ts +13 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -52,17 +52,49 @@ homeTests(config);
|
|
|
52
52
|
|
|
53
53
|
## Available suites
|
|
54
54
|
|
|
55
|
-
| Export
|
|
56
|
-
|
|
|
57
|
-
| `homeTests`
|
|
58
|
-
| `signinTests`
|
|
59
|
-
| `layoutTests`
|
|
60
|
-
| `searchTests`
|
|
61
|
-
| `settingsTests`
|
|
62
|
-
| `publishTests`
|
|
55
|
+
| Export | Covers |
|
|
56
|
+
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
57
|
+
| `homeTests` | Empty-registry landing page, help card, 404 |
|
|
58
|
+
| `signinTests` | Login dialog, greeting, logout |
|
|
59
|
+
| `layoutTests` | `/-/static/ui-options.js` health, header chrome, footer |
|
|
60
|
+
| `searchTests` | Search input, query fires, empty state, clear |
|
|
61
|
+
| `settingsTests` | Settings dialog, language picker, language switch |
|
|
62
|
+
| `publishTests` | Publishes via `cy.task`, asserts readme / sidebar / tabs |
|
|
63
|
+
| `provenanceTests` | "Provenance" sidebar chip + dialog for versions carrying `dist.attestations` / `dist.signatures` (9.x, behind `features.provenance.sidebarSection`) |
|
|
63
64
|
|
|
64
65
|
## Configuration
|
|
65
66
|
|
|
67
|
+
### Prefixed routing fixture
|
|
68
|
+
|
|
69
|
+
`prefixedRoutingTests(config)` checks a registry mounted under a URL prefix with
|
|
70
|
+
asynchronous middleware. Register it explicitly; `registerAllTests` does not
|
|
71
|
+
include it because it needs a dedicated server fixture.
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { createRegistryConfig, prefixedRoutingTests } from '@verdaccio/e2e-ui';
|
|
75
|
+
|
|
76
|
+
prefixedRoutingTests(createRegistryConfig({ registryUrl: 'http://localhost:4873' }));
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Alongside `setupVerdaccioTasks`, register these tasks in `setupNodeEvents`:
|
|
80
|
+
|
|
81
|
+
- `startRoutingRegistry`: start an isolated instance of the Verdaccio build under
|
|
82
|
+
test with asynchronous middleware. Return `{ registryUrl, publishUrl }`, where
|
|
83
|
+
`registryUrl` includes the actual Express mount prefix (for example,
|
|
84
|
+
`http://127.0.0.1:4874/registry`) and `publishUrl` reaches the same instance for
|
|
85
|
+
publishing the fixture package. These URLs override the configured registry URL
|
|
86
|
+
for this suite.
|
|
87
|
+
- `stopRoutingRegistry`: close the server, remove its temporary storage, and
|
|
88
|
+
return `null`. It must be safe to call more than once. Also call it from
|
|
89
|
+
`after:spec` so interrupted or failed tests do not leave the fixture running.
|
|
90
|
+
|
|
91
|
+
The consumer owns the server fixture so it tests its own Verdaccio build and
|
|
92
|
+
middleware plugin. The shared suite publishes a scoped package, checks the
|
|
93
|
+
prefixed package list, detail URL, sidebar, README, and ping, then cleans up the
|
|
94
|
+
publish directory and stops the fixture. Normal `testIds` overrides apply.
|
|
95
|
+
|
|
96
|
+
### Registry options
|
|
97
|
+
|
|
66
98
|
```ts
|
|
67
99
|
createRegistryConfig({
|
|
68
100
|
registryUrl: 'http://localhost:4873',
|
|
@@ -82,6 +114,10 @@ inherit from `DEFAULT_TEST_IDS` / `DEFAULT_SELECTORS`.
|
|
|
82
114
|
compatibility with Verdaccio 6.x. Enable it when testing Verdaccio 7.x or 9.x
|
|
83
115
|
builds that support Web UI bearer tokens on protected package tarball routes.
|
|
84
116
|
|
|
117
|
+
`features.provenance.sidebarSection` is disabled by default: the "Provenance"
|
|
118
|
+
sidebar section ships with the 9.x UI (verdaccio/verdaccio#6447). Enable it on
|
|
119
|
+
master and on 7.x once it consumes that `@verdaccio/ui-theme`.
|
|
120
|
+
|
|
85
121
|
## `publishPackage` task
|
|
86
122
|
|
|
87
123
|
Publishes a throwaway package so downstream specs have something to assert on.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/commands/index.ts
|
|
2
2
|
/**
|
|
3
3
|
* Default login form selectors. Kept in sync with `DEFAULT_SELECTORS`
|
|
4
4
|
* in ../testIds.ts — duplicating them here (as plain constants) lets
|
|
@@ -34,6 +34,5 @@ Cypress.Commands.add("login", (user, password, selectors = {}) => {
|
|
|
34
34
|
cy.wait(500);
|
|
35
35
|
cy.get(submitButton).click();
|
|
36
36
|
});
|
|
37
|
-
//#endregion
|
|
38
37
|
|
|
39
38
|
//# sourceMappingURL=index.cjs.map
|
package/build/cjs/features.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/features.ts
|
|
2
2
|
/** Defaults: all flags on. */
|
|
3
3
|
var DEFAULT_FEATURES = {
|
|
4
4
|
search: {
|
|
@@ -57,6 +57,7 @@ var DEFAULT_FEATURES = {
|
|
|
57
57
|
versionLink: false,
|
|
58
58
|
settingsPublishTab: false
|
|
59
59
|
},
|
|
60
|
+
provenance: { sidebarSection: false },
|
|
60
61
|
changePassword: {
|
|
61
62
|
happyPath: true,
|
|
62
63
|
validation: true,
|
|
@@ -122,6 +123,10 @@ function mergeFeatures(defaults, overrides) {
|
|
|
122
123
|
...defaults.homeDetailUx,
|
|
123
124
|
...overrides.homeDetailUx
|
|
124
125
|
},
|
|
126
|
+
provenance: {
|
|
127
|
+
...defaults.provenance,
|
|
128
|
+
...overrides.provenance
|
|
129
|
+
},
|
|
125
130
|
changePassword: {
|
|
126
131
|
...defaults.changePassword,
|
|
127
132
|
...overrides.changePassword
|
|
@@ -137,7 +142,6 @@ function mergeFeatures(defaults, overrides) {
|
|
|
137
142
|
function maybeIt(enabled) {
|
|
138
143
|
return enabled ? it : it.skip;
|
|
139
144
|
}
|
|
140
|
-
//#endregion
|
|
141
145
|
exports.DEFAULT_FEATURES = DEFAULT_FEATURES;
|
|
142
146
|
exports.maybeIt = maybeIt;
|
|
143
147
|
exports.mergeFeatures = mergeFeatures;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.cjs","names":[],"sources":["../../src/features.ts"],"sourcesContent":["import type { DeepPartial } from './testIds';\n\n/**\n * Per-test feature flags for enabling/disabling individual test cases\n * in the e2e-ui suites.\n *\n * The Verdaccio UI behaves differently across branches — search result\n * payload shape differs between the `/-/v1/search` and\n * `/-/verdaccio/data/search/*` endpoints, the language picker was\n * added in a specific minor, etc. Rather than forking the suite per\n * branch, consumers can disable individual tests via\n * `createRegistryConfig({ features: { … } })`.\n *\n * Most flags default to `true` (test runs). Compatibility probes for\n * unreleased server behavior may default to `false`; enable them in\n * consumers that run against a Verdaccio build with the feature.\n * A disabled flag converts the test into a Mocha `it.skip` call — the\n * suite still reports the test but marks it as pending.\n */\nexport interface Features {\n search: {\n /**\n * Whether to run the \"results dropdown renders a matching\n * package\" test. Disable on builds where the search result shape\n * or the Autocomplete rendering differs from the default assumption.\n */\n resultsDropdown: boolean;\n /**\n * Whether to run the \"clicking a result navigates to detail\" test.\n * Depends on the Autocomplete `onSelectItem` → router wiring.\n */\n resultClickNavigation: boolean;\n };\n home: {\n /**\n * Whether to run the `with a published package` sub-block inside\n * `homeTests` (publishes a throwaway package and asserts it\n * renders in the package list).\n */\n publishedPackageRendering: boolean;\n };\n settings: {\n /**\n * Whether to run the \"change language via card click\" test.\n * Depends on the `LanguageSwitch` component layout and its\n * translation sentinels (\"Translations\", \"German\"). Skip on\n * builds that lag behind the upstream translation file.\n */\n languageSwitcher: boolean;\n /**\n * Whether to assert that dates follow the selected language\n * (dayjs locale). Released UIs never load the dayjs locale, so\n * relative dates stay English in every language (fixed in\n * verdaccio/verdaccio#6210) — probe.\n */\n localizedDates: boolean;\n };\n signin: {\n /**\n * Whether to run the three validation tests (disabled submit\n * button, invalid credentials error banner). Depends on the\n * current yup schema and the hard-coded \"Invalid username or\n * password\" error string.\n */\n validationTests: boolean;\n };\n layout: {\n /**\n * Whether to run the dark/light theme switch test. Depends on\n * `web.showThemeSwitch` (defaults to true in ui-theme) and the\n * `header--button--light` / `header--button--dark` testids.\n */\n themeSwitch: boolean;\n };\n publish: {\n /**\n * Whether to run the \"tarball download button fires a GET\" test.\n * Depends on `web.showDownloadTarball` (defaults to true) and\n * the published package manifest having a valid `dist.tarball`.\n */\n downloadTarball: boolean;\n /**\n * Whether to run the private package tarball download tests from\n * the Web UI package list and sidebar.\n *\n * Enable only on Verdaccio builds that accept Web UI bearer tokens\n * on protected npm package/tarball routes. Verdaccio 6.x currently\n * returns HTTP 401 for this flow; the regression is tracked in\n * verdaccio/verdaccio#5765.\n */\n privateDownloadTarball: boolean;\n /**\n * Whether to run the \"raw viewer dialog opens + closes\" test.\n * Depends on `web.showRaw` (defaults to true).\n */\n rawViewer: boolean;\n };\n detail: {\n /**\n * Whether to run the \"visiting /v/<version> pins that version\" test\n * (asserts the sidebar request carries `?v=<version>`).\n */\n versionPinned: boolean;\n /**\n * Whether to run the wire-format test for scoped packages: the UI\n * must request `/-/verdaccio/data/sidebar/@scope/name` with the `@`\n * and `/` literal (npm registry convention), never `%40`-encoded.\n * Pins the regression caught by these suites in\n * verdaccio/verdaccio#6210.\n */\n scopedWireFormat: boolean;\n /**\n * Whether to run the \"nonexistent version renders Not Found\" test.\n * Requires the server to answer 404 for unknown `?v=` values\n * (verdaccio/verdaccio#6210); released lines silently fall back to\n * `latest`, so this defaults to `false` as a probe.\n */\n versionNotFound: boolean;\n /**\n * Whether to run the \"versions tab shows the CURRENT package after\n * SPA navigation\" test. The detail routes reuse one mounted\n * component, and released UIs cache the previous package's versions\n * in local state (fixed in verdaccio/verdaccio#6210) — defaults to\n * `false` as a probe.\n */\n staleVersionsNavigation: boolean;\n };\n manifestRendering: {\n /**\n * Whether to run the string-form manifest tests: `repository`,\n * `funding` and `bugs` in their string/array forms are valid npm\n * and must render (fixed in verdaccio/verdaccio#6210) — probe.\n */\n stringForms: boolean;\n /**\n * Whether to assert gravatar avatars render on the detail sidebar.\n * Released UIs read `avatar` while the sidebar endpoint sends\n * `_avatar` (fixed in verdaccio/verdaccio#6210) — probe.\n */\n gravatarAvatars: boolean;\n /**\n * Whether to assert contributors without email don't collapse into\n * one (fixed in verdaccio/verdaccio#6210) — probe.\n */\n developersWithoutEmail: boolean;\n };\n session: {\n /**\n * Whether to assert that an expired token in localStorage boots the\n * UI logged out (header shows the login button). Holds on every\n * released line.\n */\n expiredTokenLoggedOut: boolean;\n /**\n * Whether to assert the expired token is also PURGED from\n * localStorage on boot — otherwise the api client keeps attaching\n * it (fixed in verdaccio/verdaccio#6210) — probe.\n */\n expiredTokenPurged: boolean;\n };\n failureModes: {\n /**\n * Whether to run the \"backend 5xx on the package list must not\n * render the empty-registry onboarding\" test. Holds on every line\n * (a 5xx carries an HTTP code the UI always treated as an error).\n */\n homeServerError: boolean;\n /**\n * Whether to run the network-failure variant (request never\n * reaches the server). Released UIs treat a network failure as an\n * empty registry and show the onboarding card\n * (verdaccio/verdaccio#6210 fixes it), so this defaults to `false`\n * as a probe.\n */\n homeNetworkError: boolean;\n /**\n * Whether to run the \"5xx on the detail page renders an error\n * state instead of a blank page\" test. Requires the generic error\n * page from verdaccio/verdaccio#6210; released UIs render blank,\n * so this defaults to `false` as a probe.\n */\n detailErrorState: boolean;\n /**\n * Whether to run the \"search 5xx shows an error, not 'no results\n * found'\" test. The error state ships with verdaccio/verdaccio#6210\n * — probe.\n */\n searchError: boolean;\n /**\n * Whether to run the \"failed tarball download shows an error\n * snackbar\" test — clicking download and having nothing happen sent\n * users retrying blindly (fixed in verdaccio/verdaccio#6210) — probe.\n */\n downloadError: boolean;\n };\n i18n: {\n /**\n * Whether to scan the home and detail pages for raw i18n keys\n * (visible text like `sidebar.detail.version`). Holds on every\n * released line — these pages ship fully translated.\n */\n noRawKeysCorePages: boolean;\n /**\n * Whether to scan the security pages (login dialog, /-/web/login,\n * add-user, change-password) for raw i18n keys. The whole\n * `security.*` namespace is missing from every published ui-theme\n * bundle (fixed in verdaccio/verdaccio#6210), so this defaults to\n * `false` as a probe.\n */\n noRawKeysSecurityPages: boolean;\n };\n signup: {\n /**\n * Whether to run the create-user happy path (fill the form on\n * /-/web/add-user, submit, land on the success page) and assert\n * the wire contract: `PUT /-/verdaccio/sec/signup` with a 36-char\n * `sessionId`. Requires the server flag `createUser: true` AND the\n * fixed signup form from verdaccio/verdaccio#6210 — every\n * published ui-theme posts to a URL that only serves the SPA, so\n * this defaults to `false` as a probe.\n */\n happyPath: boolean;\n /**\n * Whether to run the client-side validation tests on the add-user\n * form (invalid email shows a message, url-unsafe username blocks\n * submit). Same requirements as `happyPath`.\n */\n validation: boolean;\n };\n homeDetailUx: {\n /**\n * Whether to run the home toolbar tests: filter narrows the list and\n * lives in `?q=`, `?scope=` restores the scope, no-match message.\n * Ships with the 9.x home toolbar — probe, defaults to `false`.\n */\n homeToolbar: boolean;\n /**\n * Whether to assert the package page tab lives in `?tab=` (click\n * writes it, a link opens it, readme removes it) — probe.\n */\n detailTabInUrl: boolean;\n /**\n * Whether to assert the step-by-step welcome card (setup tabs per\n * package manager, `.npmrc` tab, uplinks note) — probe.\n */\n welcomeGuide: boolean;\n /**\n * Whether to assert the sidebar install box lists `bun` and the\n * `.npmrc` registry line. Needs `bun` in `web.pkgManagers` (default\n * on 9.x) — probe.\n */\n installBunAndNpmrc: boolean;\n /**\n * Whether to assert that a copy button confirms the copy (its\n * accessible name switches to \"Copied\") — probe.\n */\n copyFeedback: boolean;\n /**\n * Whether to assert search results are grouped by origin and a\n * locally published package lands in the \"published here\" group.\n * Needs `web.showUplinks` (default true) — probe.\n */\n searchGrouping: boolean;\n /**\n * Whether to assert that the version on each home list item links\n * to its version page `/-/web/detail/<name>/v/<version>` — probe.\n */\n versionLink: boolean;\n /**\n * Whether to assert the settings dialog has a \"Publishing\" tab with\n * the welcome guide, so it stays reachable once packages exist — probe.\n */\n settingsPublishTab: boolean;\n };\n changePassword: {\n /**\n * Whether to run the happy-path test (submit valid change,\n * expect navigation to the success page, then restore the\n * original password in `after()`).\n *\n * The suite targets /-/web/change-password, which renders only\n * when the server is configured with `flags.changePassword: true`.\n * Disable on registries that do not enable the flag.\n *\n * Also disable on **published verdaccio 6.x** (all lines through\n * 6.5.0): the reset_password handler in\n * `verdaccio/build/api/web/api/user.js` ships with an inverted\n * conditional — `validatePassword(...) === false` gates the\n * `auth.changePassword(...)` call, so a *valid* new password\n * always returns HTTP 400 (`PASSWORD_VALIDATION`). The bug is\n * fixed on the development branch but has not been released\n * in any 6.x tag, so the happy path cannot succeed against an\n * `npm install verdaccio@6` runtime.\n */\n happyPath: boolean;\n /**\n * Whether to run the client-side validation tests (submit button\n * stays disabled while fields are empty / mismatched confirm).\n * Depends on the yup `changePasswordSchema`.\n */\n validation: boolean;\n /**\n * Whether to run the \"wrong old password shows error banner\" test.\n * Depends on the server rejecting the call and the onSubmit catch\n * block surfacing `\"Failed to change password\"` via\n * `LoginDialogFormError`.\n */\n wrongOldPassword: boolean;\n };\n}\n\n/** Defaults: all flags on. */\nexport const DEFAULT_FEATURES: Features = {\n search: {\n resultsDropdown: true,\n resultClickNavigation: true,\n },\n home: {\n publishedPackageRendering: true,\n },\n settings: {\n languageSwitcher: true,\n localizedDates: false,\n },\n signin: {\n validationTests: true,\n },\n layout: {\n themeSwitch: true,\n },\n publish: {\n downloadTarball: true,\n privateDownloadTarball: false,\n rawViewer: true,\n },\n detail: {\n versionPinned: true,\n scopedWireFormat: true,\n versionNotFound: false,\n staleVersionsNavigation: false,\n },\n manifestRendering: {\n stringForms: false,\n gravatarAvatars: false,\n developersWithoutEmail: false,\n },\n session: {\n expiredTokenLoggedOut: true,\n expiredTokenPurged: false,\n },\n failureModes: {\n homeServerError: true,\n homeNetworkError: false,\n detailErrorState: false,\n searchError: false,\n downloadError: false,\n },\n i18n: {\n noRawKeysCorePages: true,\n noRawKeysSecurityPages: false,\n },\n signup: {\n happyPath: false,\n validation: false,\n },\n homeDetailUx: {\n homeToolbar: false,\n detailTabInUrl: false,\n welcomeGuide: false,\n installBunAndNpmrc: false,\n copyFeedback: false,\n searchGrouping: false,\n versionLink: false,\n settingsPublishTab: false,\n },\n changePassword: {\n happyPath: true,\n validation: true,\n wrongOldPassword: true,\n },\n};\n\n/**\n * Merge user overrides into the default feature flags. Per-section,\n * one level deep — matching the style of `mergeTestIds`.\n */\nexport function mergeFeatures(defaults: Features, overrides?: DeepPartial<Features>): Features {\n if (!overrides) return defaults;\n return {\n search: { ...defaults.search, ...overrides.search },\n home: { ...defaults.home, ...overrides.home },\n settings: { ...defaults.settings, ...overrides.settings },\n signin: { ...defaults.signin, ...overrides.signin },\n layout: { ...defaults.layout, ...overrides.layout },\n publish: { ...defaults.publish, ...overrides.publish },\n detail: { ...defaults.detail, ...overrides.detail },\n manifestRendering: { ...defaults.manifestRendering, ...overrides.manifestRendering },\n session: { ...defaults.session, ...overrides.session },\n failureModes: { ...defaults.failureModes, ...overrides.failureModes },\n i18n: { ...defaults.i18n, ...overrides.i18n },\n signup: { ...defaults.signup, ...overrides.signup },\n homeDetailUx: { ...defaults.homeDetailUx, ...overrides.homeDetailUx },\n changePassword: { ...defaults.changePassword, ...overrides.changePassword },\n };\n}\n\n/**\n * Helper that returns either `it` or `it.skip` depending on an\n * enabled flag. Usage:\n *\n * maybeIt(features.search.resultsDropdown)('…', () => { … });\n */\nexport function maybeIt(enabled: boolean): Mocha.TestFunction | Mocha.PendingTestFunction {\n return enabled ? it : it.skip;\n}\n"],"mappings":";;AAwTA,IAAa,mBAA6B;CACxC,QAAQ;EACN,iBAAiB;EACjB,uBAAuB;CACzB;CACA,MAAM,EACJ,2BAA2B,KAC7B;CACA,UAAU;EACR,kBAAkB;EAClB,gBAAgB;CAClB;CACA,QAAQ,EACN,iBAAiB,KACnB;CACA,QAAQ,EACN,aAAa,KACf;CACA,SAAS;EACP,iBAAiB;EACjB,wBAAwB;EACxB,WAAW;CACb;CACA,QAAQ;EACN,eAAe;EACf,kBAAkB;EAClB,iBAAiB;EACjB,yBAAyB;CAC3B;CACA,mBAAmB;EACjB,aAAa;EACb,iBAAiB;EACjB,wBAAwB;CAC1B;CACA,SAAS;EACP,uBAAuB;EACvB,oBAAoB;CACtB;CACA,cAAc;EACZ,iBAAiB;EACjB,kBAAkB;EAClB,kBAAkB;EAClB,aAAa;EACb,eAAe;CACjB;CACA,MAAM;EACJ,oBAAoB;EACpB,wBAAwB;CAC1B;CACA,QAAQ;EACN,WAAW;EACX,YAAY;CACd;CACA,cAAc;EACZ,aAAa;EACb,gBAAgB;EAChB,cAAc;EACd,oBAAoB;EACpB,cAAc;EACd,gBAAgB;EAChB,aAAa;EACb,oBAAoB;CACtB;CACA,gBAAgB;EACd,WAAW;EACX,YAAY;EACZ,kBAAkB;CACpB;AACF;;;;;AAMA,SAAgB,cAAc,UAAoB,WAA6C;CAC7F,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO;EACL,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,MAAM;GAAE,GAAG,SAAS;GAAM,GAAG,UAAU;EAAK;EAC5C,UAAU;GAAE,GAAG,SAAS;GAAU,GAAG,UAAU;EAAS;EACxD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,UAAU;EAAQ;EACrD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,mBAAmB;GAAE,GAAG,SAAS;GAAmB,GAAG,UAAU;EAAkB;EACnF,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,UAAU;EAAQ;EACrD,cAAc;GAAE,GAAG,SAAS;GAAc,GAAG,UAAU;EAAa;EACpE,MAAM;GAAE,GAAG,SAAS;GAAM,GAAG,UAAU;EAAK;EAC5C,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,cAAc;GAAE,GAAG,SAAS;GAAc,GAAG,UAAU;EAAa;EACpE,gBAAgB;GAAE,GAAG,SAAS;GAAgB,GAAG,UAAU;EAAe;CAC5E;AACF;;;;;;;AAQA,SAAgB,QAAQ,SAAkE;CACxF,OAAO,UAAU,KAAK,GAAG;AAC3B"}
|
|
1
|
+
{"version":3,"file":"features.cjs","names":[],"sources":["../../src/features.ts"],"sourcesContent":["import type { DeepPartial } from './testIds';\n\n/**\n * Per-test feature flags for enabling/disabling individual test cases\n * in the e2e-ui suites.\n *\n * The Verdaccio UI behaves differently across branches — search result\n * payload shape differs between the `/-/v1/search` and\n * `/-/verdaccio/data/search/*` endpoints, the language picker was\n * added in a specific minor, etc. Rather than forking the suite per\n * branch, consumers can disable individual tests via\n * `createRegistryConfig({ features: { … } })`.\n *\n * Most flags default to `true` (test runs). Compatibility probes for\n * unreleased server behavior may default to `false`; enable them in\n * consumers that run against a Verdaccio build with the feature.\n * A disabled flag converts the test into a Mocha `it.skip` call — the\n * suite still reports the test but marks it as pending.\n */\nexport interface Features {\n search: {\n /**\n * Whether to run the \"results dropdown renders a matching\n * package\" test. Disable on builds where the search result shape\n * or the Autocomplete rendering differs from the default assumption.\n */\n resultsDropdown: boolean;\n /**\n * Whether to run the \"clicking a result navigates to detail\" test.\n * Depends on the Autocomplete `onSelectItem` → router wiring.\n */\n resultClickNavigation: boolean;\n };\n home: {\n /**\n * Whether to run the `with a published package` sub-block inside\n * `homeTests` (publishes a throwaway package and asserts it\n * renders in the package list).\n */\n publishedPackageRendering: boolean;\n };\n settings: {\n /**\n * Whether to run the \"change language via card click\" test.\n * Depends on the `LanguageSwitch` component layout and its\n * translation sentinels (\"Translations\", \"German\"). Skip on\n * builds that lag behind the upstream translation file.\n */\n languageSwitcher: boolean;\n /**\n * Whether to assert that dates follow the selected language\n * (dayjs locale). Released UIs never load the dayjs locale, so\n * relative dates stay English in every language (fixed in\n * verdaccio/verdaccio#6210) — probe.\n */\n localizedDates: boolean;\n };\n signin: {\n /**\n * Whether to run the three validation tests (disabled submit\n * button, invalid credentials error banner). Depends on the\n * current yup schema and the hard-coded \"Invalid username or\n * password\" error string.\n */\n validationTests: boolean;\n };\n layout: {\n /**\n * Whether to run the dark/light theme switch test. Depends on\n * `web.showThemeSwitch` (defaults to true in ui-theme) and the\n * `header--button--light` / `header--button--dark` testids.\n */\n themeSwitch: boolean;\n };\n publish: {\n /**\n * Whether to run the \"tarball download button fires a GET\" test.\n * Depends on `web.showDownloadTarball` (defaults to true) and\n * the published package manifest having a valid `dist.tarball`.\n */\n downloadTarball: boolean;\n /**\n * Whether to run the private package tarball download tests from\n * the Web UI package list and sidebar.\n *\n * Enable only on Verdaccio builds that accept Web UI bearer tokens\n * on protected npm package/tarball routes. Verdaccio 6.x currently\n * returns HTTP 401 for this flow; the regression is tracked in\n * verdaccio/verdaccio#5765.\n */\n privateDownloadTarball: boolean;\n /**\n * Whether to run the \"raw viewer dialog opens + closes\" test.\n * Depends on `web.showRaw` (defaults to true).\n */\n rawViewer: boolean;\n };\n detail: {\n /**\n * Whether to run the \"visiting /v/<version> pins that version\" test\n * (asserts the sidebar request carries `?v=<version>`).\n */\n versionPinned: boolean;\n /**\n * Whether to run the wire-format test for scoped packages: the UI\n * must request `/-/verdaccio/data/sidebar/@scope/name` with the `@`\n * and `/` literal (npm registry convention), never `%40`-encoded.\n * Pins the regression caught by these suites in\n * verdaccio/verdaccio#6210.\n */\n scopedWireFormat: boolean;\n /**\n * Whether to run the \"nonexistent version renders Not Found\" test.\n * Requires the server to answer 404 for unknown `?v=` values\n * (verdaccio/verdaccio#6210); released lines silently fall back to\n * `latest`, so this defaults to `false` as a probe.\n */\n versionNotFound: boolean;\n /**\n * Whether to run the \"versions tab shows the CURRENT package after\n * SPA navigation\" test. The detail routes reuse one mounted\n * component, and released UIs cache the previous package's versions\n * in local state (fixed in verdaccio/verdaccio#6210) — defaults to\n * `false` as a probe.\n */\n staleVersionsNavigation: boolean;\n };\n manifestRendering: {\n /**\n * Whether to run the string-form manifest tests: `repository`,\n * `funding` and `bugs` in their string/array forms are valid npm\n * and must render (fixed in verdaccio/verdaccio#6210) — probe.\n */\n stringForms: boolean;\n /**\n * Whether to assert gravatar avatars render on the detail sidebar.\n * Released UIs read `avatar` while the sidebar endpoint sends\n * `_avatar` (fixed in verdaccio/verdaccio#6210) — probe.\n */\n gravatarAvatars: boolean;\n /**\n * Whether to assert contributors without email don't collapse into\n * one (fixed in verdaccio/verdaccio#6210) — probe.\n */\n developersWithoutEmail: boolean;\n };\n session: {\n /**\n * Whether to assert that an expired token in localStorage boots the\n * UI logged out (header shows the login button). Holds on every\n * released line.\n */\n expiredTokenLoggedOut: boolean;\n /**\n * Whether to assert the expired token is also PURGED from\n * localStorage on boot — otherwise the api client keeps attaching\n * it (fixed in verdaccio/verdaccio#6210) — probe.\n */\n expiredTokenPurged: boolean;\n };\n failureModes: {\n /**\n * Whether to run the \"backend 5xx on the package list must not\n * render the empty-registry onboarding\" test. Holds on every line\n * (a 5xx carries an HTTP code the UI always treated as an error).\n */\n homeServerError: boolean;\n /**\n * Whether to run the network-failure variant (request never\n * reaches the server). Released UIs treat a network failure as an\n * empty registry and show the onboarding card\n * (verdaccio/verdaccio#6210 fixes it), so this defaults to `false`\n * as a probe.\n */\n homeNetworkError: boolean;\n /**\n * Whether to run the \"5xx on the detail page renders an error\n * state instead of a blank page\" test. Requires the generic error\n * page from verdaccio/verdaccio#6210; released UIs render blank,\n * so this defaults to `false` as a probe.\n */\n detailErrorState: boolean;\n /**\n * Whether to run the \"search 5xx shows an error, not 'no results\n * found'\" test. The error state ships with verdaccio/verdaccio#6210\n * — probe.\n */\n searchError: boolean;\n /**\n * Whether to run the \"failed tarball download shows an error\n * snackbar\" test — clicking download and having nothing happen sent\n * users retrying blindly (fixed in verdaccio/verdaccio#6210) — probe.\n */\n downloadError: boolean;\n };\n i18n: {\n /**\n * Whether to scan the home and detail pages for raw i18n keys\n * (visible text like `sidebar.detail.version`). Holds on every\n * released line — these pages ship fully translated.\n */\n noRawKeysCorePages: boolean;\n /**\n * Whether to scan the security pages (login dialog, /-/web/login,\n * add-user, change-password) for raw i18n keys. The whole\n * `security.*` namespace is missing from every published ui-theme\n * bundle (fixed in verdaccio/verdaccio#6210), so this defaults to\n * `false` as a probe.\n */\n noRawKeysSecurityPages: boolean;\n };\n signup: {\n /**\n * Whether to run the create-user happy path (fill the form on\n * /-/web/add-user, submit, land on the success page) and assert\n * the wire contract: `PUT /-/verdaccio/sec/signup` with a 36-char\n * `sessionId`. Requires the server flag `createUser: true` AND the\n * fixed signup form from verdaccio/verdaccio#6210 — every\n * published ui-theme posts to a URL that only serves the SPA, so\n * this defaults to `false` as a probe.\n */\n happyPath: boolean;\n /**\n * Whether to run the client-side validation tests on the add-user\n * form (invalid email shows a message, url-unsafe username blocks\n * submit). Same requirements as `happyPath`.\n */\n validation: boolean;\n };\n homeDetailUx: {\n /**\n * Whether to run the home toolbar tests: filter narrows the list and\n * lives in `?q=`, `?scope=` restores the scope, no-match message.\n * Ships with the 9.x home toolbar — probe, defaults to `false`.\n */\n homeToolbar: boolean;\n /**\n * Whether to assert the package page tab lives in `?tab=` (click\n * writes it, a link opens it, readme removes it) — probe.\n */\n detailTabInUrl: boolean;\n /**\n * Whether to assert the step-by-step welcome card (setup tabs per\n * package manager, `.npmrc` tab, uplinks note) — probe.\n */\n welcomeGuide: boolean;\n /**\n * Whether to assert the sidebar install box lists `bun` and the\n * `.npmrc` registry line. Needs `bun` in `web.pkgManagers` (default\n * on 9.x) — probe.\n */\n installBunAndNpmrc: boolean;\n /**\n * Whether to assert that a copy button confirms the copy (its\n * accessible name switches to \"Copied\") — probe.\n */\n copyFeedback: boolean;\n /**\n * Whether to assert search results are grouped by origin and a\n * locally published package lands in the \"published here\" group.\n * Needs `web.showUplinks` (default true) — probe.\n */\n searchGrouping: boolean;\n /**\n * Whether to assert that the version on each home list item links\n * to its version page `/-/web/detail/<name>/v/<version>` — probe.\n */\n versionLink: boolean;\n /**\n * Whether to assert the settings dialog has a \"Publishing\" tab with\n * the welcome guide, so it stays reachable once packages exist — probe.\n */\n settingsPublishTab: boolean;\n };\n provenance: {\n /**\n * Whether to run the \"Provenance\" sidebar section tests: a version\n * carrying `dist.attestations` or `dist.signatures` shows a chip\n * under \"Distribution\" that opens a dialog with the statement type,\n * the signing key ids and a link to the attestation bundle, and the\n * build details are only requested when the server announces the\n * endpoint (`capabilities.provenance`). Ships with 9.x\n * (verdaccio/verdaccio#6447) — probe, defaults to `false`.\n */\n sidebarSection: boolean;\n };\n changePassword: {\n /**\n * Whether to run the happy-path test (submit valid change,\n * expect navigation to the success page, then restore the\n * original password in `after()`).\n *\n * The suite targets /-/web/change-password, which renders only\n * when the server is configured with `flags.changePassword: true`.\n * Disable on registries that do not enable the flag.\n *\n * Also disable on **published verdaccio 6.x** (all lines through\n * 6.5.0): the reset_password handler in\n * `verdaccio/build/api/web/api/user.js` ships with an inverted\n * conditional — `validatePassword(...) === false` gates the\n * `auth.changePassword(...)` call, so a *valid* new password\n * always returns HTTP 400 (`PASSWORD_VALIDATION`). The bug is\n * fixed on the development branch but has not been released\n * in any 6.x tag, so the happy path cannot succeed against an\n * `npm install verdaccio@6` runtime.\n */\n happyPath: boolean;\n /**\n * Whether to run the client-side validation tests (submit button\n * stays disabled while fields are empty / mismatched confirm).\n * Depends on the yup `changePasswordSchema`.\n */\n validation: boolean;\n /**\n * Whether to run the \"wrong old password shows error banner\" test.\n * Depends on the server rejecting the call and the onSubmit catch\n * block surfacing `\"Failed to change password\"` via\n * `LoginDialogFormError`.\n */\n wrongOldPassword: boolean;\n };\n}\n\n/** Defaults: all flags on. */\nexport const DEFAULT_FEATURES: Features = {\n search: {\n resultsDropdown: true,\n resultClickNavigation: true,\n },\n home: {\n publishedPackageRendering: true,\n },\n settings: {\n languageSwitcher: true,\n localizedDates: false,\n },\n signin: {\n validationTests: true,\n },\n layout: {\n themeSwitch: true,\n },\n publish: {\n downloadTarball: true,\n privateDownloadTarball: false,\n rawViewer: true,\n },\n detail: {\n versionPinned: true,\n scopedWireFormat: true,\n versionNotFound: false,\n staleVersionsNavigation: false,\n },\n manifestRendering: {\n stringForms: false,\n gravatarAvatars: false,\n developersWithoutEmail: false,\n },\n session: {\n expiredTokenLoggedOut: true,\n expiredTokenPurged: false,\n },\n failureModes: {\n homeServerError: true,\n homeNetworkError: false,\n detailErrorState: false,\n searchError: false,\n downloadError: false,\n },\n i18n: {\n noRawKeysCorePages: true,\n noRawKeysSecurityPages: false,\n },\n signup: {\n happyPath: false,\n validation: false,\n },\n homeDetailUx: {\n homeToolbar: false,\n detailTabInUrl: false,\n welcomeGuide: false,\n installBunAndNpmrc: false,\n copyFeedback: false,\n searchGrouping: false,\n versionLink: false,\n settingsPublishTab: false,\n },\n provenance: {\n sidebarSection: false,\n },\n changePassword: {\n happyPath: true,\n validation: true,\n wrongOldPassword: true,\n },\n};\n\n/**\n * Merge user overrides into the default feature flags. Per-section,\n * one level deep — matching the style of `mergeTestIds`.\n */\nexport function mergeFeatures(defaults: Features, overrides?: DeepPartial<Features>): Features {\n if (!overrides) return defaults;\n return {\n search: { ...defaults.search, ...overrides.search },\n home: { ...defaults.home, ...overrides.home },\n settings: { ...defaults.settings, ...overrides.settings },\n signin: { ...defaults.signin, ...overrides.signin },\n layout: { ...defaults.layout, ...overrides.layout },\n publish: { ...defaults.publish, ...overrides.publish },\n detail: { ...defaults.detail, ...overrides.detail },\n manifestRendering: { ...defaults.manifestRendering, ...overrides.manifestRendering },\n session: { ...defaults.session, ...overrides.session },\n failureModes: { ...defaults.failureModes, ...overrides.failureModes },\n i18n: { ...defaults.i18n, ...overrides.i18n },\n signup: { ...defaults.signup, ...overrides.signup },\n homeDetailUx: { ...defaults.homeDetailUx, ...overrides.homeDetailUx },\n provenance: { ...defaults.provenance, ...overrides.provenance },\n changePassword: { ...defaults.changePassword, ...overrides.changePassword },\n };\n}\n\n/**\n * Helper that returns either `it` or `it.skip` depending on an\n * enabled flag. Usage:\n *\n * maybeIt(features.search.resultsDropdown)('…', () => { … });\n */\nexport function maybeIt(enabled: boolean): Mocha.TestFunction | Mocha.PendingTestFunction {\n return enabled ? it : it.skip;\n}\n"],"mappings":";;AAoUA,IAAa,mBAA6B;CACxC,QAAQ;EACN,iBAAiB;EACjB,uBAAuB;CACzB;CACA,MAAM,EACJ,2BAA2B,KAC7B;CACA,UAAU;EACR,kBAAkB;EAClB,gBAAgB;CAClB;CACA,QAAQ,EACN,iBAAiB,KACnB;CACA,QAAQ,EACN,aAAa,KACf;CACA,SAAS;EACP,iBAAiB;EACjB,wBAAwB;EACxB,WAAW;CACb;CACA,QAAQ;EACN,eAAe;EACf,kBAAkB;EAClB,iBAAiB;EACjB,yBAAyB;CAC3B;CACA,mBAAmB;EACjB,aAAa;EACb,iBAAiB;EACjB,wBAAwB;CAC1B;CACA,SAAS;EACP,uBAAuB;EACvB,oBAAoB;CACtB;CACA,cAAc;EACZ,iBAAiB;EACjB,kBAAkB;EAClB,kBAAkB;EAClB,aAAa;EACb,eAAe;CACjB;CACA,MAAM;EACJ,oBAAoB;EACpB,wBAAwB;CAC1B;CACA,QAAQ;EACN,WAAW;EACX,YAAY;CACd;CACA,cAAc;EACZ,aAAa;EACb,gBAAgB;EAChB,cAAc;EACd,oBAAoB;EACpB,cAAc;EACd,gBAAgB;EAChB,aAAa;EACb,oBAAoB;CACtB;CACA,YAAY,EACV,gBAAgB,MAClB;CACA,gBAAgB;EACd,WAAW;EACX,YAAY;EACZ,kBAAkB;CACpB;AACF;;;;;AAMA,SAAgB,cAAc,UAAoB,WAA6C;CAC7F,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO;EACL,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,MAAM;GAAE,GAAG,SAAS;GAAM,GAAG,UAAU;EAAK;EAC5C,UAAU;GAAE,GAAG,SAAS;GAAU,GAAG,UAAU;EAAS;EACxD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,UAAU;EAAQ;EACrD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,mBAAmB;GAAE,GAAG,SAAS;GAAmB,GAAG,UAAU;EAAkB;EACnF,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,UAAU;EAAQ;EACrD,cAAc;GAAE,GAAG,SAAS;GAAc,GAAG,UAAU;EAAa;EACpE,MAAM;GAAE,GAAG,SAAS;GAAM,GAAG,UAAU;EAAK;EAC5C,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,cAAc;GAAE,GAAG,SAAS;GAAc,GAAG,UAAU;EAAa;EACpE,YAAY;GAAE,GAAG,SAAS;GAAY,GAAG,UAAU;EAAW;EAC9D,gBAAgB;GAAE,GAAG,SAAS;GAAgB,GAAG,UAAU;EAAe;CAC5E;AACF;;;;;;;AAQA,SAAgB,QAAQ,SAAkE;CACxF,OAAO,UAAU,KAAK,GAAG;AAC3B"}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -16,9 +16,11 @@ const require_signup = require("./tests/signup.cjs");
|
|
|
16
16
|
const require_manifest_rendering = require("./tests/manifest-rendering.cjs");
|
|
17
17
|
const require_session = require("./tests/session.cjs");
|
|
18
18
|
const require_home_detail_ux = require("./tests/home-detail-ux.cjs");
|
|
19
|
+
const require_provenance = require("./tests/provenance.cjs");
|
|
20
|
+
const require_prefixed_routing = require("./tests/prefixed-routing.cjs");
|
|
19
21
|
require("./tests/index.cjs");
|
|
20
22
|
let fs = require("fs");
|
|
21
|
-
|
|
23
|
+
// src/index.ts
|
|
22
24
|
/**
|
|
23
25
|
* Build a full RegistryConfig from user-provided options with defaults.
|
|
24
26
|
*
|
|
@@ -177,9 +179,9 @@ function registerAllTests(config) {
|
|
|
177
179
|
require_session.sessionTests(config);
|
|
178
180
|
require_signup.signupTests(config);
|
|
179
181
|
require_home_detail_ux.homeDetailUxTests(config);
|
|
182
|
+
require_provenance.provenanceTests(config);
|
|
180
183
|
require_change_password.changePasswordTests(config);
|
|
181
184
|
}
|
|
182
|
-
//#endregion
|
|
183
185
|
exports.DEFAULT_FEATURES = require_features.DEFAULT_FEATURES;
|
|
184
186
|
exports.DEFAULT_SELECTORS = require_testIds.DEFAULT_SELECTORS;
|
|
185
187
|
exports.DEFAULT_TEST_IDS = require_testIds.DEFAULT_TEST_IDS;
|
|
@@ -194,6 +196,8 @@ exports.i18nKeyTests = require_i18n_keys.i18nKeyTests;
|
|
|
194
196
|
exports.layoutTests = require_layout.layoutTests;
|
|
195
197
|
exports.manifestRenderingTests = require_manifest_rendering.manifestRenderingTests;
|
|
196
198
|
exports.maybeIt = require_features.maybeIt;
|
|
199
|
+
exports.prefixedRoutingTests = require_prefixed_routing.prefixedRoutingTests;
|
|
200
|
+
exports.provenanceTests = require_provenance.provenanceTests;
|
|
197
201
|
exports.publishPackage = require_publish.publishPackage;
|
|
198
202
|
exports.publishTests = require_publish$1.publishTests;
|
|
199
203
|
exports.registerAllTests = registerAllTests;
|
package/build/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { appendFileSync } from 'fs';\n\nimport { DEFAULT_FEATURES, mergeFeatures } from './features';\nimport {\n PublishPackageResult,\n PublishPackageTaskInput,\n UnpublishPackageInput,\n UnpublishPackageResult,\n cleanupPublished,\n publishPackage,\n unpublishPackage,\n} from './tasks';\nimport { DEFAULT_SELECTORS, DEFAULT_TEST_IDS, mergeSelectors, mergeTestIds } from './testIds';\n// Re-export for convenience\nimport {\n changePasswordTests,\n detailTests,\n failureModeTests,\n homeDetailUxTests,\n homeTests,\n i18nKeyTests,\n layoutTests,\n manifestRenderingTests,\n publishTests,\n searchTests,\n sessionTests,\n settingsTests,\n signinTests,\n signupTests,\n} from './tests';\nimport { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';\n\nexport type { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';\nexport type {\n PublishPackageInput,\n PublishPackageTaskInput,\n PublishPackageResult,\n UnpublishPackageInput,\n UnpublishPackageResult,\n} from './tasks';\nexport type { DeepPartial, Selectors, TestIds } from './testIds';\nexport type { Features } from './features';\nexport { DEFAULT_SELECTORS, DEFAULT_TEST_IDS } from './testIds';\nexport { DEFAULT_FEATURES, maybeIt } from './features';\nexport { publishPackage, cleanupPublished, unpublishPackage } from './tasks';\nexport {\n homeTests,\n signinTests,\n publishTests,\n searchTests,\n settingsTests,\n layoutTests,\n changePasswordTests,\n detailTests,\n failureModeTests,\n i18nKeyTests,\n manifestRenderingTests,\n sessionTests,\n signupTests,\n homeDetailUxTests,\n} from './tests';\n\n/**\n * Build a full RegistryConfig from user-provided options with defaults.\n *\n * `testIds` and `selectors` are deep-merged per section with the\n * defaults in `./testIds`. Consumers targeting a non-default Verdaccio\n * build can override just the fields that drifted:\n *\n * createRegistryConfig({\n * registryUrl: 'http://localhost:4873',\n * testIds: {\n * header: { settingsTooltip: 'my-new-settings-btn' },\n * },\n * });\n */\nexport function createRegistryConfig(options: VerdaccioUiOptions): RegistryConfig {\n const url = new URL(options.registryUrl);\n return {\n registryUrl: options.registryUrl,\n port: options.port ?? (parseInt(url.port, 10) || 4873),\n credentials: options.credentials ?? { user: 'test', password: 'test' },\n title: options.title ?? 'Verdaccio',\n testIds: mergeTestIds(DEFAULT_TEST_IDS, options.testIds),\n selectors: mergeSelectors(DEFAULT_SELECTORS, options.selectors),\n features: mergeFeatures(DEFAULT_FEATURES, options.features),\n };\n}\n\n/**\n * Register Verdaccio Cypress tasks in setupNodeEvents.\n *\n * Usage in cypress.config.ts:\n * import { setupVerdaccioTasks } from '@verdaccio/e2e-ui';\n *\n * export default defineConfig({\n * e2e: {\n * setupNodeEvents(on) {\n * setupVerdaccioTasks(on, { registryUrl: 'http://localhost:4873' });\n * },\n * },\n * });\n */\nexport function setupVerdaccioTasks(on: Cypress.PluginEvents, options: VerdaccioUiOptions): void {\n const config = createRegistryConfig(options);\n\n // GitHub Actions Step Summary\n on('after:run', (results) => {\n const summaryFile = process.env.GITHUB_STEP_SUMMARY;\n if (!summaryFile || !results || !('runs' in results)) return;\n\n const cypressResults = results as CypressCommandLine.CypressRunResult;\n const lines: string[] = [];\n\n lines.push('## UI E2E Test Results\\n');\n lines.push('| Spec | Tests | Passing | Failing | Pending | Duration |');\n lines.push('|------|-------|---------|---------|---------|----------|');\n\n for (const run of cypressResults.runs) {\n const specName = run.spec.relative || run.spec.name;\n const stats = run.stats;\n const icon = stats.failures > 0 ? '❌' : '✅';\n const dur = stats.duration ? `${(stats.duration / 1000).toFixed(1)}s` : '-';\n lines.push(\n `| ${icon} ${specName} | ${stats.tests} | ${stats.passes} | ${stats.failures} | ${stats.pending} | ${dur} |`\n );\n }\n\n lines.push('');\n const totals = cypressResults.totalTests ?? 0;\n const passed = cypressResults.totalPassed ?? 0;\n const failed = cypressResults.totalFailed ?? 0;\n const pending = cypressResults.totalPending ?? 0;\n const emoji = failed > 0 ? '❌' : '✅';\n lines.push(\n `${emoji} **${passed} passed**, **${failed} failed**, **${pending} pending** (${totals} total)\\n`\n );\n\n appendFileSync(summaryFile, lines.join('\\n'));\n });\n\n on('task', {\n registry(): RegistryTaskResult {\n return {\n registryUrl: config.registryUrl,\n port: config.port,\n };\n },\n /**\n * Publish a throwaway package to the registry.\n *\n * Usage from a Cypress spec:\n *\n * cy.task('publishPackage', { pkgName: '@verdaccio/pkg-scoped' });\n *\n * Any field not provided falls back to the values configured here\n * (registryUrl, credentials). The task returns a PublishPackageResult.\n */\n async publishPackage(input: PublishPackageTaskInput): Promise<PublishPackageResult> {\n return publishPackage({\n registryUrl: input.registryUrl ?? config.registryUrl,\n credentials: input.credentials ?? config.credentials,\n pkgName: input.pkgName,\n version: input.version,\n dependencies: input.dependencies,\n devDependencies: input.devDependencies,\n manifest: input.manifest,\n unique: input.unique,\n });\n },\n /**\n * Remove a temp project folder returned by a previous publishPackage\n * call. Returns null (Cypress tasks must return something serializable).\n *\n * cy.task('cleanupPublished', result.tempFolder);\n */\n async cleanupPublished(tempFolder: string): Promise<null> {\n await cleanupPublished(tempFolder);\n return null;\n },\n /**\n * Unpublish a package from the registry so the next test starts\n * from a clean slate. Accepts either a package name or a full input\n * object (to reuse a prior tempFolder's token).\n *\n * cy.task('unpublishPackage', '@verdaccio/pkg-scoped');\n * cy.task('unpublishPackage', { pkgName, tempFolder });\n */\n async unpublishPackage(\n input:\n | string\n | (Omit<UnpublishPackageInput, 'registryUrl'> & {\n registryUrl?: string;\n })\n ): Promise<UnpublishPackageResult> {\n const normalized =\n typeof input === 'string'\n ? { pkgName: input, registryUrl: config.registryUrl }\n : { ...input, registryUrl: input.registryUrl ?? config.registryUrl };\n return unpublishPackage(normalized);\n },\n });\n}\n\n/**\n * Register all Verdaccio UI tests.\n *\n * Usage in a spec file:\n * import { registerAllTests, createRegistryConfig } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * registerAllTests(config);\n *\n * Or pick individual suites:\n * import { homeTests, signinTests } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * homeTests(config);\n * signinTests(config);\n */\nexport function registerAllTests(config: RegistryConfig): void {\n homeTests(config);\n signinTests(config);\n layoutTests(config);\n searchTests(config);\n settingsTests(config);\n publishTests(config);\n detailTests(config);\n failureModeTests(config);\n i18nKeyTests(config);\n manifestRenderingTests(config);\n sessionTests(config);\n signupTests(config);\n homeDetailUxTests(config);\n changePasswordTests(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,SAAgB,qBAAqB,SAA6C;CAChF,MAAM,MAAM,IAAI,IAAI,QAAQ,WAAW;CACvC,OAAO;EACL,aAAa,QAAQ;EACrB,MAAM,QAAQ,SAAS,SAAS,IAAI,MAAM,EAAE,KAAK;EACjD,aAAa,QAAQ,eAAe;GAAE,MAAM;GAAQ,UAAU;EAAO;EACrE,OAAO,QAAQ,SAAS;EACxB,SAAS,gBAAA,aAAa,gBAAA,kBAAkB,QAAQ,OAAO;EACvD,WAAW,gBAAA,eAAe,gBAAA,mBAAmB,QAAQ,SAAS;EAC9D,UAAU,iBAAA,cAAc,iBAAA,kBAAkB,QAAQ,QAAQ;CAC5D;AACF;;;;;;;;;;;;;;;AAgBA,SAAgB,oBAAoB,IAA0B,SAAmC;CAC/F,MAAM,SAAS,qBAAqB,OAAO;CAG3C,GAAG,cAAc,YAAY;EAC3B,MAAM,cAAc,QAAQ,IAAI;EAChC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,UAAU,UAAU;EAEtD,MAAM,iBAAiB;EACvB,MAAM,QAAkB,CAAC;EAEzB,MAAM,KAAK,0BAA0B;EACrC,MAAM,KAAK,2DAA2D;EACtE,MAAM,KAAK,2DAA2D;EAEtE,KAAK,MAAM,OAAO,eAAe,MAAM;GACrC,MAAM,WAAW,IAAI,KAAK,YAAY,IAAI,KAAK;GAC/C,MAAM,QAAQ,IAAI;GAClB,MAAM,OAAO,MAAM,WAAW,IAAI,MAAM;GACxC,MAAM,MAAM,MAAM,WAAW,IAAI,MAAM,WAAW,IAAA,CAAM,QAAQ,CAA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AAY,MAAM;CAClB,eAAA,YAAY,MAAM;CAClB,eAAA,YAAY,MAAM;CAClB,iBAAA,cAAc,MAAM;CACpB,kBAAA,aAAa,MAAM;CACnB,eAAA,YAAY,MAAM;CAClB,sBAAA,iBAAiB,MAAM;CACvB,kBAAA,aAAa,MAAM;CACnB,2BAAA,uBAAuB,MAAM;CAC7B,gBAAA,aAAa,MAAM;CACnB,eAAA,YAAY,MAAM;CAClB,uBAAA,kBAAkB,MAAM;CACxB,wBAAA,oBAAoB,MAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["mergeTestIds","DEFAULT_TEST_IDS","mergeSelectors","DEFAULT_SELECTORS","mergeFeatures","DEFAULT_FEATURES","publishPackage","cleanupPublished","unpublishPackage"],"sources":["../../src/index.ts"],"sourcesContent":["import { appendFileSync } from 'fs';\n\nimport { DEFAULT_FEATURES, mergeFeatures } from './features';\nimport {\n PublishPackageResult,\n PublishPackageTaskInput,\n UnpublishPackageInput,\n UnpublishPackageResult,\n cleanupPublished,\n publishPackage,\n unpublishPackage,\n} from './tasks';\nimport { DEFAULT_SELECTORS, DEFAULT_TEST_IDS, mergeSelectors, mergeTestIds } from './testIds';\n// Re-export for convenience\nimport {\n changePasswordTests,\n detailTests,\n failureModeTests,\n homeDetailUxTests,\n homeTests,\n i18nKeyTests,\n layoutTests,\n manifestRenderingTests,\n provenanceTests,\n publishTests,\n searchTests,\n sessionTests,\n settingsTests,\n signinTests,\n signupTests,\n} from './tests';\nimport { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';\n\nexport type { RegistryConfig, RegistryTaskResult, VerdaccioUiOptions } from './types';\nexport type {\n PublishPackageInput,\n PublishPackageTaskInput,\n PublishPackageResult,\n UnpublishPackageInput,\n UnpublishPackageResult,\n} from './tasks';\nexport type { DeepPartial, Selectors, TestIds } from './testIds';\nexport type { Features } from './features';\nexport { DEFAULT_SELECTORS, DEFAULT_TEST_IDS } from './testIds';\nexport { DEFAULT_FEATURES, maybeIt } from './features';\nexport { publishPackage, cleanupPublished, unpublishPackage } from './tasks';\nexport {\n homeTests,\n signinTests,\n publishTests,\n searchTests,\n settingsTests,\n layoutTests,\n changePasswordTests,\n detailTests,\n failureModeTests,\n i18nKeyTests,\n manifestRenderingTests,\n sessionTests,\n signupTests,\n homeDetailUxTests,\n provenanceTests,\n prefixedRoutingTests,\n} from './tests';\n\n/**\n * Build a full RegistryConfig from user-provided options with defaults.\n *\n * `testIds` and `selectors` are deep-merged per section with the\n * defaults in `./testIds`. Consumers targeting a non-default Verdaccio\n * build can override just the fields that drifted:\n *\n * createRegistryConfig({\n * registryUrl: 'http://localhost:4873',\n * testIds: {\n * header: { settingsTooltip: 'my-new-settings-btn' },\n * },\n * });\n */\nexport function createRegistryConfig(options: VerdaccioUiOptions): RegistryConfig {\n const url = new URL(options.registryUrl);\n return {\n registryUrl: options.registryUrl,\n port: options.port ?? (parseInt(url.port, 10) || 4873),\n credentials: options.credentials ?? { user: 'test', password: 'test' },\n title: options.title ?? 'Verdaccio',\n testIds: mergeTestIds(DEFAULT_TEST_IDS, options.testIds),\n selectors: mergeSelectors(DEFAULT_SELECTORS, options.selectors),\n features: mergeFeatures(DEFAULT_FEATURES, options.features),\n };\n}\n\n/**\n * Register Verdaccio Cypress tasks in setupNodeEvents.\n *\n * Usage in cypress.config.ts:\n * import { setupVerdaccioTasks } from '@verdaccio/e2e-ui';\n *\n * export default defineConfig({\n * e2e: {\n * setupNodeEvents(on) {\n * setupVerdaccioTasks(on, { registryUrl: 'http://localhost:4873' });\n * },\n * },\n * });\n */\nexport function setupVerdaccioTasks(on: Cypress.PluginEvents, options: VerdaccioUiOptions): void {\n const config = createRegistryConfig(options);\n\n // GitHub Actions Step Summary\n on('after:run', (results) => {\n const summaryFile = process.env.GITHUB_STEP_SUMMARY;\n if (!summaryFile || !results || !('runs' in results)) return;\n\n const cypressResults = results as CypressCommandLine.CypressRunResult;\n const lines: string[] = [];\n\n lines.push('## UI E2E Test Results\\n');\n lines.push('| Spec | Tests | Passing | Failing | Pending | Duration |');\n lines.push('|------|-------|---------|---------|---------|----------|');\n\n for (const run of cypressResults.runs) {\n const specName = run.spec.relative || run.spec.name;\n const stats = run.stats;\n const icon = stats.failures > 0 ? '❌' : '✅';\n const dur = stats.duration ? `${(stats.duration / 1000).toFixed(1)}s` : '-';\n lines.push(\n `| ${icon} ${specName} | ${stats.tests} | ${stats.passes} | ${stats.failures} | ${stats.pending} | ${dur} |`\n );\n }\n\n lines.push('');\n const totals = cypressResults.totalTests ?? 0;\n const passed = cypressResults.totalPassed ?? 0;\n const failed = cypressResults.totalFailed ?? 0;\n const pending = cypressResults.totalPending ?? 0;\n const emoji = failed > 0 ? '❌' : '✅';\n lines.push(\n `${emoji} **${passed} passed**, **${failed} failed**, **${pending} pending** (${totals} total)\\n`\n );\n\n appendFileSync(summaryFile, lines.join('\\n'));\n });\n\n on('task', {\n registry(): RegistryTaskResult {\n return {\n registryUrl: config.registryUrl,\n port: config.port,\n };\n },\n /**\n * Publish a throwaway package to the registry.\n *\n * Usage from a Cypress spec:\n *\n * cy.task('publishPackage', { pkgName: '@verdaccio/pkg-scoped' });\n *\n * Any field not provided falls back to the values configured here\n * (registryUrl, credentials). The task returns a PublishPackageResult.\n */\n async publishPackage(input: PublishPackageTaskInput): Promise<PublishPackageResult> {\n return publishPackage({\n registryUrl: input.registryUrl ?? config.registryUrl,\n credentials: input.credentials ?? config.credentials,\n pkgName: input.pkgName,\n version: input.version,\n dependencies: input.dependencies,\n devDependencies: input.devDependencies,\n manifest: input.manifest,\n unique: input.unique,\n });\n },\n /**\n * Remove a temp project folder returned by a previous publishPackage\n * call. Returns null (Cypress tasks must return something serializable).\n *\n * cy.task('cleanupPublished', result.tempFolder);\n */\n async cleanupPublished(tempFolder: string): Promise<null> {\n await cleanupPublished(tempFolder);\n return null;\n },\n /**\n * Unpublish a package from the registry so the next test starts\n * from a clean slate. Accepts either a package name or a full input\n * object (to reuse a prior tempFolder's token).\n *\n * cy.task('unpublishPackage', '@verdaccio/pkg-scoped');\n * cy.task('unpublishPackage', { pkgName, tempFolder });\n */\n async unpublishPackage(\n input:\n | string\n | (Omit<UnpublishPackageInput, 'registryUrl'> & {\n registryUrl?: string;\n })\n ): Promise<UnpublishPackageResult> {\n const normalized =\n typeof input === 'string'\n ? { pkgName: input, registryUrl: config.registryUrl }\n : { ...input, registryUrl: input.registryUrl ?? config.registryUrl };\n return unpublishPackage(normalized);\n },\n });\n}\n\n/**\n * Register all Verdaccio UI tests.\n *\n * Usage in a spec file:\n * import { registerAllTests, createRegistryConfig } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * registerAllTests(config);\n *\n * Or pick individual suites:\n * import { homeTests, signinTests } from '@verdaccio/e2e-ui';\n *\n * const config = createRegistryConfig({ registryUrl: 'http://localhost:4873' });\n * homeTests(config);\n * signinTests(config);\n */\nexport function registerAllTests(config: RegistryConfig): void {\n homeTests(config);\n signinTests(config);\n layoutTests(config);\n searchTests(config);\n settingsTests(config);\n publishTests(config);\n detailTests(config);\n failureModeTests(config);\n i18nKeyTests(config);\n manifestRenderingTests(config);\n sessionTests(config);\n signupTests(config);\n homeDetailUxTests(config);\n provenanceTests(config);\n changePasswordTests(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,SAAgB,qBAAqB,SAA6C;CAChF,MAAM,MAAM,IAAI,IAAI,QAAQ,WAAW;CACvC,OAAO;EACL,aAAa,QAAQ;EACrB,MAAM,QAAQ,SAAS,SAAS,IAAI,MAAM,EAAE,KAAK;EACjD,aAAa,QAAQ,eAAe;GAAE,MAAM;GAAQ,UAAU;EAAO;EACrE,OAAO,QAAQ,SAAS;EACxB,SAASA,gBAAAA,aAAaC,gBAAAA,kBAAkB,QAAQ,OAAO;EACvD,WAAWC,gBAAAA,eAAeC,gBAAAA,mBAAmB,QAAQ,SAAS;EAC9D,UAAUC,iBAAAA,cAAcC,iB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AAOC,gBAAAA,eAAe;IACpB,aAAa,MAAM,eAAe,OAAO;IACzC,aAAa,MAAM,eAAe,OAAO;IACzC,SAAS,MAAM;IACf,SAAS,MAAM;IACf,cAAc,MAAM;IACpB,iBAAiB,MAAM;IACvB,UAAU,MAAM;IAChB,QAAQ,MAAM;GAChB,CAAC;EACH;;;;;;;EAOA,MAAM,iBAAiB,YAAmC;GACxD,MAAMC,gBAAAA,iBAAiB,UAAU;GACjC,OAAO;EACT;;;;;;;;;EASA,MAAM,iBACJ,OAKiC;GACjC,MAAM,aACJ,OAAO,UAAU,WACb;IAAE,SAAS;IAAO,aAAa,OAAO;GAAY,IAClD;IAAE,GAAG;IAAO,aAAa,MAAM,eAAe,OAAO;GAAY;GACvE,OAAOC,gBAAAA,iBAAiB,UAAU;EACpC;CACF,CAAC;AACH;;;;;;;;;;;;;;;;;AAkBA,SAAgB,iBAAiB,QAA8B;CAC7D,aAAA,UAAU,MAAM;CAChB,eAAA,YAAY,MAAM;CAClB,eAAA,YAAY,MAAM;CAClB,eAAA,YAAY,MAAM;CAClB,iBAAA,cAAc,MAAM;CACpB,kBAAA,aAAa,MAAM;CACnB,eAAA,YAAY,MAAM;CAClB,sBAAA,iBAAiB,MAAM;CACvB,kBAAA,aAAa,MAAM;CACnB,2BAAA,uBAAuB,MAAM;CAC7B,gBAAA,aAAa,MAAM;CACnB,eAAA,YAAY,MAAM;CAClB,uBAAA,kBAAkB,MAAM;CACxB,mBAAA,gBAAgB,MAAM;CACtB,wBAAA,oBAAoB,MAAM;AAC5B"}
|
|
@@ -2,7 +2,7 @@ let child_process = require("child_process");
|
|
|
2
2
|
let fs_promises = require("fs/promises");
|
|
3
3
|
let os = require("os");
|
|
4
4
|
let path = require("path");
|
|
5
|
-
|
|
5
|
+
// src/tasks/publish.ts
|
|
6
6
|
function sanitizeFolderName(name) {
|
|
7
7
|
return name.replace(/[^a-zA-Z0-9-_]/g, "-");
|
|
8
8
|
}
|
|
@@ -238,7 +238,6 @@ async function unpublishPackage(input) {
|
|
|
238
238
|
}).catch(() => void 0);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
//#endregion
|
|
242
241
|
exports.cleanupPublished = cleanupPublished;
|
|
243
242
|
exports.publishPackage = publishPackage;
|
|
244
243
|
exports.unpublishPackage = unpublishPackage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.cjs","names":[],"sources":["../../../src/tasks/publish.ts"],"sourcesContent":["import { spawn } from 'child_process';\nimport { mkdtemp, rm, writeFile } from 'fs/promises';\nimport { tmpdir } from 'os';\nimport { join } from 'path';\n\nexport interface PublishPackageInput {\n pkgName: string;\n version?: string;\n registryUrl: string;\n credentials: { user: string; password: string };\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n /**\n * Extra fields merged into the generated package.json AFTER the\n * defaults, so fixtures can carry arbitrary manifest shapes: a string\n * `repository`, a `funding` array, `contributors` without email, a\n * non-string `homepage`… — exactly the field forms npm accepts on\n * publish but UIs tend to mishandle. `name`, `version` and\n * `publishConfig` always win over this override.\n */\n manifest?: Record<string, unknown>;\n /**\n * When true, append a timestamp suffix to the version so reruns against\n * a persistent registry don't collide on 403. The suffix is a valid\n * semver prerelease, e.g. `1.0.0-t1712345678`. Defaults to false.\n */\n unique?: boolean;\n}\n\n/**\n * Shape of the argument passed to `cy.task('publishPackage', ...)`.\n *\n * `registryUrl` and `credentials` are optional here (they fall back to\n * whatever was configured in `setupVerdaccioTasks`), but `pkgName` is\n * still required — every publish needs a name.\n */\nexport type PublishPackageTaskInput = Partial<Omit<PublishPackageInput, 'pkgName'>> & {\n pkgName: string;\n};\n\nexport interface PublishPackageResult {\n pkgName: string;\n version: string;\n tempFolder: string;\n stdout: string;\n stderr: string;\n exitCode: number;\n}\n\nfunction sanitizeFolderName(name: string): string {\n return name.replace(/[^a-zA-Z0-9-_]/g, '-');\n}\n\n/**\n * Obtain a registry-API-compatible (legacy) auth token for publish.\n *\n * Strategy: create a throwaway user per call. `PUT /-/user/org.couchdb.user:<name>`\n * only returns a token on CREATE (and 409s on existing users), so we\n * guarantee success by generating a unique username each time.\n *\n * We need a legacy token specifically because:\n * - Verdaccio's default API middleware accepts legacy tokens but NOT\n * JWTs from `/-/verdaccio/sec/login`\n * - Modern npm (>= 10.x) refuses to run `npm publish` at all without\n * an `_authToken` entry in `.npmrc`, even against a registry that\n * allows `$anonymous` publish — it errors out client-side\n *\n * The throwaway user stays in the test registry's htpasswd store after\n * the run, which is fine for ephemeral CI environments and local temp\n * setups (both wipe storage between runs).\n */\nasync function obtainLegacyToken(registryUrl: string): Promise<{ user: string; token: string }> {\n const user = `e2e-bot-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;\n const password = 'e2e-bot-password';\n const base = registryUrl.replace(/\\/$/, '');\n const url = `${base}/-/user/org.couchdb.user:${encodeURIComponent(user)}`;\n const res = await fetch(url, {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n name: user,\n password,\n _id: `org.couchdb.user:${user}`,\n type: 'user',\n roles: [],\n }),\n });\n if (!res.ok) {\n const body = await res.text();\n throw new Error(\n `[publishPackage] failed to create throwaway user \"${user}\" ` +\n `(HTTP ${res.status}): ${body}`\n );\n }\n const json = (await res.json()) as { token?: string };\n if (!json.token) {\n throw new Error(\n `[publishPackage] user creation response did not contain a token: ${JSON.stringify(json)}`\n );\n }\n return { user, token: json.token };\n}\n\nasync function createTempProject(\n pkgName: string,\n version: string,\n registryUrl: string,\n token: string,\n dependencies: Record<string, string>,\n devDependencies: Record<string, string>,\n manifestOverrides: Record<string, unknown> = {}\n): Promise<string> {\n const tempFolder = await mkdtemp(\n join(tmpdir(), `verdaccio-e2e-ui-${sanitizeFolderName(pkgName)}-`)\n );\n const manifest = {\n description: `e2e test fixture ${pkgName}`,\n main: 'index.js',\n dependencies,\n devDependencies,\n keywords: ['verdaccio', 'e2e', 'test'],\n author: 'Verdaccio E2E <verdaccio@example.org>',\n license: 'MIT',\n // Fixture-specific manifest shapes (string `repository`, `funding`\n // arrays, contributors without email…) — npm accepts them on\n // publish, so the UI must render them. Identity fields and\n // publishConfig below always win over the overrides.\n ...manifestOverrides,\n name: pkgName,\n version,\n // Scoped packages default to `restricted` access which modern npm\n // refuses to publish anonymously. Pin it to `public` so the CLI\n // skips that check for fixtures like `@verdaccio/pkg-scoped`.\n publishConfig: {\n access: 'public',\n registry: registryUrl,\n },\n };\n await writeFile(join(tempFolder, 'package.json'), JSON.stringify(manifest, null, 2));\n await writeFile(\n join(tempFolder, 'README.md'),\n `# ${pkgName}\\n\\nPublished by @verdaccio/e2e-ui for e2e testing.\\n`\n );\n await writeFile(join(tempFolder, 'index.js'), `module.exports = ${JSON.stringify(pkgName)};\\n`);\n\n // `.npmrc` — include an `_authToken` scoped to the registry host so\n // modern npm (>= 10.x) is willing to run `npm publish`. Without this\n // the CLI errors client-side with \"This command requires you to be\n // logged in.\" even against a registry configured for `$anonymous`\n // publish. The token is a legacy Verdaccio auth token obtained by\n // creating a throwaway user via `PUT /-/user/...`.\n const registryHost = registryUrl.replace(/^https?:/, '');\n const npmrc = [\n `registry=${registryUrl}`,\n `${registryHost}/:_authToken=${token}`,\n // Force public access for scoped packages.\n 'access=public',\n '',\n ].join('\\n');\n await writeFile(join(tempFolder, '.npmrc'), npmrc);\n\n return tempFolder;\n}\n\nfunction spawnNpmPublish(\n cwd: string,\n registryUrl: string\n): Promise<{ stdout: string; stderr: string; exitCode: number }> {\n return new Promise((resolvePromise, rejectPromise) => {\n // `--tag latest` is required so npm accepts prerelease versions\n // (e.g. `1.0.0-t<ts>` when `unique: true`). Without it npm bails\n // with \"You must specify a tag using --tag when publishing a\n // prerelease version.\" For non-prerelease versions it's a no-op.\n const proc = spawn(\n 'npm',\n ['publish', '--registry', registryUrl, '--tag', 'latest', '--loglevel=error'],\n {\n cwd,\n env: { ...process.env },\n }\n );\n let stdout = '';\n let stderr = '';\n proc.stdout.on('data', (chunk) => {\n stdout += chunk.toString();\n });\n proc.stderr.on('data', (chunk) => {\n stderr += chunk.toString();\n });\n proc.on('error', rejectPromise);\n proc.on('close', (code) => {\n resolvePromise({ stdout, stderr, exitCode: code ?? -1 });\n });\n });\n}\n\n/**\n * Publish a throwaway npm package to the target Verdaccio registry.\n *\n * Flow:\n * 1. Create a throwaway user via `PUT /-/user/...` and capture its\n * legacy auth token. See `obtainLegacyToken` for why.\n * 2. Scaffold a temp project with `package.json`, `README.md`,\n * `index.js`, and an `.npmrc` that includes the token.\n * 3. Spawn `npm publish` from that temp dir.\n *\n * `input.credentials` is kept on the signature for forward-compat but\n * is currently unused — each call mints its own throwaway user.\n *\n * Throws on non-zero npm exit. Returns the temp folder path on success\n * so callers can inspect or clean up.\n */\nexport async function publishPackage(input: PublishPackageInput): Promise<PublishPackageResult> {\n const baseVersion = input.version ?? '1.0.0';\n const version = input.unique ? `${baseVersion}-t${Date.now()}` : baseVersion;\n\n const { token } = await obtainLegacyToken(input.registryUrl);\n\n const tempFolder = await createTempProject(\n input.pkgName,\n version,\n input.registryUrl,\n token,\n input.dependencies ?? {},\n input.devDependencies ?? {},\n input.manifest ?? {}\n );\n const { stdout, stderr, exitCode } = await spawnNpmPublish(tempFolder, input.registryUrl);\n if (exitCode !== 0) {\n throw new Error(\n `[publishPackage] npm publish failed for ${input.pkgName}@${version} ` +\n `(exit ${exitCode}):\\n${stderr || stdout}`\n );\n }\n return { pkgName: input.pkgName, version, tempFolder, stdout, stderr, exitCode };\n}\n\n/**\n * Remove a temp project folder previously created by publishPackage.\n * Safe to call with a missing path or a path outside the OS tmp dir —\n * in the latter case it refuses rather than rm-rf'ing arbitrary paths.\n */\nexport async function cleanupPublished(tempFolder: string): Promise<void> {\n if (!tempFolder) return;\n const tmpRoot = tmpdir();\n if (!tempFolder.startsWith(tmpRoot)) {\n throw new Error(`[cleanupPublished] refusing to remove \"${tempFolder}\" — not under ${tmpRoot}`);\n }\n await rm(tempFolder, { recursive: true, force: true });\n}\n\nexport interface UnpublishPackageInput {\n registryUrl: string;\n pkgName: string;\n /**\n * Temp folder returned by a previous `publishPackage` call. If\n * provided, its existing `.npmrc` (which already carries a legacy\n * auth token) is reused for the unpublish call — no extra throwaway\n * user is minted. Otherwise this task creates its own.\n */\n tempFolder?: string;\n}\n\nexport interface UnpublishPackageResult {\n pkgName: string;\n stdout: string;\n stderr: string;\n exitCode: number;\n /**\n * True if the package was already absent (HTTP 404 from the\n * registry). Tests typically want to treat this as success.\n */\n alreadyGone: boolean;\n}\n\nfunction spawnNpmUnpublish(\n cwd: string,\n registryUrl: string,\n pkgSpec: string\n): Promise<{ stdout: string; stderr: string; exitCode: number }> {\n return new Promise((resolvePromise, rejectPromise) => {\n const proc = spawn(\n 'npm',\n ['unpublish', pkgSpec, '--force', '--registry', registryUrl, '--loglevel=error'],\n {\n cwd,\n env: { ...process.env },\n }\n );\n let stdout = '';\n let stderr = '';\n proc.stdout.on('data', (chunk) => {\n stdout += chunk.toString();\n });\n proc.stderr.on('data', (chunk) => {\n stderr += chunk.toString();\n });\n proc.on('error', rejectPromise);\n proc.on('close', (code) => {\n resolvePromise({ stdout, stderr, exitCode: code ?? -1 });\n });\n });\n}\n\n/**\n * Unpublish a package from the target registry so subsequent tests\n * start from a clean slate.\n *\n * If `tempFolder` is provided (typically from a prior `publishPackage`\n * result), its `.npmrc` is reused so no extra throwaway user is\n * minted. Otherwise this function creates its own temp folder + token.\n * Either way the temp folder used by THIS call is removed on exit\n * (but callers still own the lifecycle of a tempFolder they passed in).\n *\n * Treats HTTP 404 / \"tarball does not exist\" as success so reruns and\n * parallel teardowns don't flap.\n */\nexport async function unpublishPackage(\n input: UnpublishPackageInput\n): Promise<UnpublishPackageResult> {\n let workingFolder = input.tempFolder;\n let ownsWorkingFolder = false;\n\n if (!workingFolder) {\n ownsWorkingFolder = true;\n const { token } = await obtainLegacyToken(input.registryUrl);\n workingFolder = await mkdtemp(join(tmpdir(), `verdaccio-e2e-ui-unpublish-`));\n const registryHost = input.registryUrl.replace(/^https?:/, '');\n await writeFile(\n join(workingFolder, '.npmrc'),\n [`registry=${input.registryUrl}`, `${registryHost}/:_authToken=${token}`, ''].join('\\n')\n );\n }\n\n try {\n const { stdout, stderr, exitCode } = await spawnNpmUnpublish(\n workingFolder,\n input.registryUrl,\n input.pkgName\n );\n\n // Treat \"already absent\" as success. npm prints slightly different\n // messages depending on version — match loosely.\n const alreadyGone = /404|not found|no such package|does not (exist|match)/i.test(\n `${stderr}\\n${stdout}`\n );\n\n if (exitCode !== 0 && !alreadyGone) {\n throw new Error(\n `[unpublishPackage] npm unpublish failed for ${input.pkgName} ` +\n `(exit ${exitCode}):\\n${stderr || stdout}`\n );\n }\n\n return {\n pkgName: input.pkgName,\n stdout,\n stderr,\n exitCode,\n alreadyGone,\n };\n } finally {\n if (ownsWorkingFolder && workingFolder) {\n await rm(workingFolder, { recursive: true, force: true }).catch(() => undefined);\n }\n }\n}\n"],"mappings":";;;;;AAiDA,SAAS,mBAAmB,MAAsB;CAChD,OAAO,KAAK,QAAQ,mBAAmB,GAAG;AAC5C;;;;;;;;;;;;;;;;;;;AAoBA,eAAe,kBAAkB,aAA+D;CAC9F,MAAM,OAAO,WAAW,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;CAC3E,MAAM,WAAW;CAEjB,MAAM,MAAM,GADC,YAAY,QAAQ,OAAO,EACzB,EAAK,2BAA2B,mBAAmB,IAAI;CACtE,MAAM,MAAM,MAAM,MAAM,KAAK;EAC3B,QAAQ;EACR,SAAS,EAAE,gBAAgB,mBAAmB;EAC9C,MAAM,KAAK,UAAU;GACnB,MAAM;GACN;GACA,KAAK,oBAAoB;GACzB,MAAM;GACN,OAAO,CAAC;EACV,CAAC;CACH,CAAC;CACD,IAAI,CAAC,IAAI,IAAI;EACX,MAAM,OAAO,MAAM,IAAI,KAAK;EAC5B,MAAM,IAAI,MACR,qDAAqD,KAAK,UAC/C,IAAI,OAAO,KAAK,MAC7B;CAC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M,OACR;EAIA,MAAM,cAAc,wDAAwD,KAC1E,GAAG,OAAO,IAAI,QAChB;EAEA,IAAI,aAAa,KAAK,CAAC,aACrB,MAAM,IAAI,MACR,+CAA+C,MAAM,QAAQ,SAClD,SAAS,MAAM,UAAU,QACtC;EAGF,OAAO;GACL,SAAS,MAAM;GACf;GACA;GACA;GACA;EACF;CACF,UAAU;EACR,IAAI,qBAAqB,eACvB,OAAA,GAAM,YAAA,GAAA,CAAG,eAAe;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC,CAAC,CAAC,YAAY,KAAA,CAAS;CAEnF;AACF"}
|
|
1
|
+
{"version":3,"file":"publish.cjs","names":["mkdtemp","join","tmpdir","writeFile","spawn","rm"],"sources":["../../../src/tasks/publish.ts"],"sourcesContent":["import { spawn } from 'child_process';\nimport { mkdtemp, rm, writeFile } from 'fs/promises';\nimport { tmpdir } from 'os';\nimport { join } from 'path';\n\nexport interface PublishPackageInput {\n pkgName: string;\n version?: string;\n registryUrl: string;\n credentials: { user: string; password: string };\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n /**\n * Extra fields merged into the generated package.json AFTER the\n * defaults, so fixtures can carry arbitrary manifest shapes: a string\n * `repository`, a `funding` array, `contributors` without email, a\n * non-string `homepage`… — exactly the field forms npm accepts on\n * publish but UIs tend to mishandle. `name`, `version` and\n * `publishConfig` always win over this override.\n */\n manifest?: Record<string, unknown>;\n /**\n * When true, append a timestamp suffix to the version so reruns against\n * a persistent registry don't collide on 403. The suffix is a valid\n * semver prerelease, e.g. `1.0.0-t1712345678`. Defaults to false.\n */\n unique?: boolean;\n}\n\n/**\n * Shape of the argument passed to `cy.task('publishPackage', ...)`.\n *\n * `registryUrl` and `credentials` are optional here (they fall back to\n * whatever was configured in `setupVerdaccioTasks`), but `pkgName` is\n * still required — every publish needs a name.\n */\nexport type PublishPackageTaskInput = Partial<Omit<PublishPackageInput, 'pkgName'>> & {\n pkgName: string;\n};\n\nexport interface PublishPackageResult {\n pkgName: string;\n version: string;\n tempFolder: string;\n stdout: string;\n stderr: string;\n exitCode: number;\n}\n\nfunction sanitizeFolderName(name: string): string {\n return name.replace(/[^a-zA-Z0-9-_]/g, '-');\n}\n\n/**\n * Obtain a registry-API-compatible (legacy) auth token for publish.\n *\n * Strategy: create a throwaway user per call. `PUT /-/user/org.couchdb.user:<name>`\n * only returns a token on CREATE (and 409s on existing users), so we\n * guarantee success by generating a unique username each time.\n *\n * We need a legacy token specifically because:\n * - Verdaccio's default API middleware accepts legacy tokens but NOT\n * JWTs from `/-/verdaccio/sec/login`\n * - Modern npm (>= 10.x) refuses to run `npm publish` at all without\n * an `_authToken` entry in `.npmrc`, even against a registry that\n * allows `$anonymous` publish — it errors out client-side\n *\n * The throwaway user stays in the test registry's htpasswd store after\n * the run, which is fine for ephemeral CI environments and local temp\n * setups (both wipe storage between runs).\n */\nasync function obtainLegacyToken(registryUrl: string): Promise<{ user: string; token: string }> {\n const user = `e2e-bot-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;\n const password = 'e2e-bot-password';\n const base = registryUrl.replace(/\\/$/, '');\n const url = `${base}/-/user/org.couchdb.user:${encodeURIComponent(user)}`;\n const res = await fetch(url, {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n name: user,\n password,\n _id: `org.couchdb.user:${user}`,\n type: 'user',\n roles: [],\n }),\n });\n if (!res.ok) {\n const body = await res.text();\n throw new Error(\n `[publishPackage] failed to create throwaway user \"${user}\" ` +\n `(HTTP ${res.status}): ${body}`\n );\n }\n const json = (await res.json()) as { token?: string };\n if (!json.token) {\n throw new Error(\n `[publishPackage] user creation response did not contain a token: ${JSON.stringify(json)}`\n );\n }\n return { user, token: json.token };\n}\n\nasync function createTempProject(\n pkgName: string,\n version: string,\n registryUrl: string,\n token: string,\n dependencies: Record<string, string>,\n devDependencies: Record<string, string>,\n manifestOverrides: Record<string, unknown> = {}\n): Promise<string> {\n const tempFolder = await mkdtemp(\n join(tmpdir(), `verdaccio-e2e-ui-${sanitizeFolderName(pkgName)}-`)\n );\n const manifest = {\n description: `e2e test fixture ${pkgName}`,\n main: 'index.js',\n dependencies,\n devDependencies,\n keywords: ['verdaccio', 'e2e', 'test'],\n author: 'Verdaccio E2E <verdaccio@example.org>',\n license: 'MIT',\n // Fixture-specific manifest shapes (string `repository`, `funding`\n // arrays, contributors without email…) — npm accepts them on\n // publish, so the UI must render them. Identity fields and\n // publishConfig below always win over the overrides.\n ...manifestOverrides,\n name: pkgName,\n version,\n // Scoped packages default to `restricted` access which modern npm\n // refuses to publish anonymously. Pin it to `public` so the CLI\n // skips that check for fixtures like `@verdaccio/pkg-scoped`.\n publishConfig: {\n access: 'public',\n registry: registryUrl,\n },\n };\n await writeFile(join(tempFolder, 'package.json'), JSON.stringify(manifest, null, 2));\n await writeFile(\n join(tempFolder, 'README.md'),\n `# ${pkgName}\\n\\nPublished by @verdaccio/e2e-ui for e2e testing.\\n`\n );\n await writeFile(join(tempFolder, 'index.js'), `module.exports = ${JSON.stringify(pkgName)};\\n`);\n\n // `.npmrc` — include an `_authToken` scoped to the registry host so\n // modern npm (>= 10.x) is willing to run `npm publish`. Without this\n // the CLI errors client-side with \"This command requires you to be\n // logged in.\" even against a registry configured for `$anonymous`\n // publish. The token is a legacy Verdaccio auth token obtained by\n // creating a throwaway user via `PUT /-/user/...`.\n const registryHost = registryUrl.replace(/^https?:/, '');\n const npmrc = [\n `registry=${registryUrl}`,\n `${registryHost}/:_authToken=${token}`,\n // Force public access for scoped packages.\n 'access=public',\n '',\n ].join('\\n');\n await writeFile(join(tempFolder, '.npmrc'), npmrc);\n\n return tempFolder;\n}\n\nfunction spawnNpmPublish(\n cwd: string,\n registryUrl: string\n): Promise<{ stdout: string; stderr: string; exitCode: number }> {\n return new Promise((resolvePromise, rejectPromise) => {\n // `--tag latest` is required so npm accepts prerelease versions\n // (e.g. `1.0.0-t<ts>` when `unique: true`). Without it npm bails\n // with \"You must specify a tag using --tag when publishing a\n // prerelease version.\" For non-prerelease versions it's a no-op.\n const proc = spawn(\n 'npm',\n ['publish', '--registry', registryUrl, '--tag', 'latest', '--loglevel=error'],\n {\n cwd,\n env: { ...process.env },\n }\n );\n let stdout = '';\n let stderr = '';\n proc.stdout.on('data', (chunk) => {\n stdout += chunk.toString();\n });\n proc.stderr.on('data', (chunk) => {\n stderr += chunk.toString();\n });\n proc.on('error', rejectPromise);\n proc.on('close', (code) => {\n resolvePromise({ stdout, stderr, exitCode: code ?? -1 });\n });\n });\n}\n\n/**\n * Publish a throwaway npm package to the target Verdaccio registry.\n *\n * Flow:\n * 1. Create a throwaway user via `PUT /-/user/...` and capture its\n * legacy auth token. See `obtainLegacyToken` for why.\n * 2. Scaffold a temp project with `package.json`, `README.md`,\n * `index.js`, and an `.npmrc` that includes the token.\n * 3. Spawn `npm publish` from that temp dir.\n *\n * `input.credentials` is kept on the signature for forward-compat but\n * is currently unused — each call mints its own throwaway user.\n *\n * Throws on non-zero npm exit. Returns the temp folder path on success\n * so callers can inspect or clean up.\n */\nexport async function publishPackage(input: PublishPackageInput): Promise<PublishPackageResult> {\n const baseVersion = input.version ?? '1.0.0';\n const version = input.unique ? `${baseVersion}-t${Date.now()}` : baseVersion;\n\n const { token } = await obtainLegacyToken(input.registryUrl);\n\n const tempFolder = await createTempProject(\n input.pkgName,\n version,\n input.registryUrl,\n token,\n input.dependencies ?? {},\n input.devDependencies ?? {},\n input.manifest ?? {}\n );\n const { stdout, stderr, exitCode } = await spawnNpmPublish(tempFolder, input.registryUrl);\n if (exitCode !== 0) {\n throw new Error(\n `[publishPackage] npm publish failed for ${input.pkgName}@${version} ` +\n `(exit ${exitCode}):\\n${stderr || stdout}`\n );\n }\n return { pkgName: input.pkgName, version, tempFolder, stdout, stderr, exitCode };\n}\n\n/**\n * Remove a temp project folder previously created by publishPackage.\n * Safe to call with a missing path or a path outside the OS tmp dir —\n * in the latter case it refuses rather than rm-rf'ing arbitrary paths.\n */\nexport async function cleanupPublished(tempFolder: string): Promise<void> {\n if (!tempFolder) return;\n const tmpRoot = tmpdir();\n if (!tempFolder.startsWith(tmpRoot)) {\n throw new Error(`[cleanupPublished] refusing to remove \"${tempFolder}\" — not under ${tmpRoot}`);\n }\n await rm(tempFolder, { recursive: true, force: true });\n}\n\nexport interface UnpublishPackageInput {\n registryUrl: string;\n pkgName: string;\n /**\n * Temp folder returned by a previous `publishPackage` call. If\n * provided, its existing `.npmrc` (which already carries a legacy\n * auth token) is reused for the unpublish call — no extra throwaway\n * user is minted. Otherwise this task creates its own.\n */\n tempFolder?: string;\n}\n\nexport interface UnpublishPackageResult {\n pkgName: string;\n stdout: string;\n stderr: string;\n exitCode: number;\n /**\n * True if the package was already absent (HTTP 404 from the\n * registry). Tests typically want to treat this as success.\n */\n alreadyGone: boolean;\n}\n\nfunction spawnNpmUnpublish(\n cwd: string,\n registryUrl: string,\n pkgSpec: string\n): Promise<{ stdout: string; stderr: string; exitCode: number }> {\n return new Promise((resolvePromise, rejectPromise) => {\n const proc = spawn(\n 'npm',\n ['unpublish', pkgSpec, '--force', '--registry', registryUrl, '--loglevel=error'],\n {\n cwd,\n env: { ...process.env },\n }\n );\n let stdout = '';\n let stderr = '';\n proc.stdout.on('data', (chunk) => {\n stdout += chunk.toString();\n });\n proc.stderr.on('data', (chunk) => {\n stderr += chunk.toString();\n });\n proc.on('error', rejectPromise);\n proc.on('close', (code) => {\n resolvePromise({ stdout, stderr, exitCode: code ?? -1 });\n });\n });\n}\n\n/**\n * Unpublish a package from the target registry so subsequent tests\n * start from a clean slate.\n *\n * If `tempFolder` is provided (typically from a prior `publishPackage`\n * result), its `.npmrc` is reused so no extra throwaway user is\n * minted. Otherwise this function creates its own temp folder + token.\n * Either way the temp folder used by THIS call is removed on exit\n * (but callers still own the lifecycle of a tempFolder they passed in).\n *\n * Treats HTTP 404 / \"tarball does not exist\" as success so reruns and\n * parallel teardowns don't flap.\n */\nexport async function unpublishPackage(\n input: UnpublishPackageInput\n): Promise<UnpublishPackageResult> {\n let workingFolder = input.tempFolder;\n let ownsWorkingFolder = false;\n\n if (!workingFolder) {\n ownsWorkingFolder = true;\n const { token } = await obtainLegacyToken(input.registryUrl);\n workingFolder = await mkdtemp(join(tmpdir(), `verdaccio-e2e-ui-unpublish-`));\n const registryHost = input.registryUrl.replace(/^https?:/, '');\n await writeFile(\n join(workingFolder, '.npmrc'),\n [`registry=${input.registryUrl}`, `${registryHost}/:_authToken=${token}`, ''].join('\\n')\n );\n }\n\n try {\n const { stdout, stderr, exitCode } = await spawnNpmUnpublish(\n workingFolder,\n input.registryUrl,\n input.pkgName\n );\n\n // Treat \"already absent\" as success. npm prints slightly different\n // messages depending on version — match loosely.\n const alreadyGone = /404|not found|no such package|does not (exist|match)/i.test(\n `${stderr}\\n${stdout}`\n );\n\n if (exitCode !== 0 && !alreadyGone) {\n throw new Error(\n `[unpublishPackage] npm unpublish failed for ${input.pkgName} ` +\n `(exit ${exitCode}):\\n${stderr || stdout}`\n );\n }\n\n return {\n pkgName: input.pkgName,\n stdout,\n stderr,\n exitCode,\n alreadyGone,\n };\n } finally {\n if (ownsWorkingFolder && workingFolder) {\n await rm(workingFolder, { recursive: true, force: true }).catch(() => undefined);\n }\n }\n}\n"],"mappings":";;;;;AAiDA,SAAS,mBAAmB,MAAsB;CAChD,OAAO,KAAK,QAAQ,mBAAmB,GAAG;AAC5C;;;;;;;;;;;;;;;;;;;AAoBA,eAAe,kBAAkB,aAA+D;CAC9F,MAAM,OAAO,WAAW,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;CAC3E,MAAM,WAAW;CAEjB,MAAM,MAAM,GADC,YAAY,QAAQ,OAAO,EACzB,EAAK,2BAA2B,mBAAmB,IAAI;CACtE,MAAM,MAAM,MAAM,MAAM,KAAK;EAC3B,QAAQ;EACR,SAAS,EAAE,gBAAgB,mBAAmB;EAC9C,MAAM,KAAK,UAAU;GACnB,MAAM;GACN;GACA,KAAK,oBA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AY,EAAE;EAC7D,OAAA,GAAMC,YAAAA,UAAAA,EAAAA,GACJF,KAAAA,KAAAA,CAAK,eAAe,QAAQ,GAC5B;GAAC,YAAY,MAAM;GAAe,GAAG,aAAa,eAAe;GAAS;EAAE,CAAC,CAAC,KAAK,IAAI,CACzF;CACF;CAEA,IAAI;EACF,MAAM,EAAE,QAAQ,QAAQ,aAAa,MAAM,kBACzC,eACA,MAAM,aACN,MAAM,OACR;EAIA,MAAM,cAAc,wDAAwD,KAC1E,GAAG,OAAO,IAAI,QAChB;EAEA,IAAI,aAAa,KAAK,CAAC,aACrB,MAAM,IAAI,MACR,+CAA+C,MAAM,QAAQ,SAClD,SAAS,MAAM,UAAU,QACtC;EAGF,OAAO;GACL,SAAS,MAAM;GACf;GACA;GACA;GACA;EACF;CACF,UAAU;EACR,IAAI,qBAAqB,eACvB,OAAA,GAAMI,YAAAA,GAAAA,CAAG,eAAe;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC,CAAC,CAAC,YAAY,KAAA,CAAS;CAEnF;AACF"}
|
package/build/cjs/testIds.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/testIds.ts
|
|
2
2
|
/**
|
|
3
3
|
* Defaults matching Verdaccio 6.x (bundled ui-theme@9.0.0-next-9.x).
|
|
4
4
|
* Overridable via `createRegistryConfig({ testIds: { ... } })`.
|
|
@@ -55,6 +55,8 @@ var DEFAULT_TEST_IDS = {
|
|
|
55
55
|
installBun: "installListItem-bun",
|
|
56
56
|
installNpmrc: "install-npmrc",
|
|
57
57
|
installNpmrcCopy: "installNpmrc",
|
|
58
|
+
provenanceBadge: "provenance-badge",
|
|
59
|
+
provenanceDialog: "registryInfo--dialog",
|
|
58
60
|
readmeTab: "readme-tab",
|
|
59
61
|
keywordList: "keyword-list",
|
|
60
62
|
dependenciesTab: "dependencies-tab",
|
|
@@ -148,7 +150,6 @@ function mergeSelectors(defaults, overrides) {
|
|
|
148
150
|
}
|
|
149
151
|
};
|
|
150
152
|
}
|
|
151
|
-
//#endregion
|
|
152
153
|
exports.DEFAULT_SELECTORS = DEFAULT_SELECTORS;
|
|
153
154
|
exports.DEFAULT_TEST_IDS = DEFAULT_TEST_IDS;
|
|
154
155
|
exports.mergeSelectors = mergeSelectors;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testIds.cjs","names":[],"sources":["../../src/testIds.ts"],"sourcesContent":["/**\n * Configurable DOM selectors used by the e2e-ui test suites.\n *\n * The Verdaccio UI is a moving target — data-testids can and do change\n * between majors — so every selector referenced by a test lives here\n * and can be overridden by consumers of `@verdaccio/e2e-ui` via\n * `createRegistryConfig({ testIds, selectors })`.\n *\n * The defaults below match Verdaccio 6.x as of the last time we audited\n * the ui-components source. If a selector moves, override just the\n * affected field instead of forking the suite.\n */\n\n/**\n * Map of data-testid values used by the test suites, grouped by UI\n * section. Each field holds the bare testid string (no `data-testid=\"…\"`\n * wrapping) — the test helpers pass it through `cy.getByTestId(...)`.\n */\nexport interface TestIds {\n home: {\n /** Help card shown on the empty-registry landing page. */\n helpCard: string;\n /** 404 \"not found\" container. */\n notFound: string;\n /** Filter / scope / sort bar above the package list (9.x). */\n packageListToolbar: string;\n /** Text filter input inside the toolbar. */\n packageListFilter: string;\n /** Native input of the scope select (only with more than one scope). */\n packageListScope: string;\n /** Message shown when the filter matches no package. */\n packageListNoMatch: string;\n /** Prefix of the welcome card setup tabs: `<prefix><manager>`. */\n helpSetupTabPrefix: string;\n /** Note on the welcome card explaining cached uplink packages. */\n helpUplinksNote: string;\n /** Step list of the publishing guide, in the welcome card and the settings (9.x). */\n helpGuide: string;\n };\n header: {\n /** Outermost `<NavBar>` element. */\n container: string;\n /** Inner wrapper inside the nav bar. */\n innerNavBar: string;\n /** Right-side action cluster wrapper. */\n right: string;\n /** Wrapper around the header search input. */\n searchContainer: string;\n /** Default SVG Verdaccio logo. */\n defaultLogo: string;\n /** Custom (user-provided) logo image. */\n customLogo: string;\n /** \"Login\" button shown when logged out. */\n loginButton: string;\n /** Gear icon that opens the settings dialog. */\n settingsTooltip: string;\n /** \"Publishing\" tab of the settings dialog (9.x). */\n settingsPublishTab: string;\n /** Panel of the \"Publishing\" tab (9.x). */\n settingsPublishPanel: string;\n /** Info icon that opens the registry info dialog. */\n infoTooltip: string;\n /**\n * Theme switch button shown while in LIGHT mode (clicking it\n * flips to dark). The underlying component swaps between this\n * and `themeSwitchDark` based on `isDarkMode`.\n */\n themeSwitchLight: string;\n /** Theme switch button shown while in DARK mode. */\n themeSwitchDark: string;\n /** Menu icon shown after login (opens the logged-in menu). */\n logInDialogIcon: string;\n /** \"Log out\" entry inside the logged-in menu. */\n logOutDialogIcon: string;\n /** \"Hi <username>\" label inside the logged-in menu. */\n greetingsLabel: string;\n };\n footer: {\n /** Outer footer wrapper. */\n container: string;\n /** \"Powered by\" version text on the right side of the footer. */\n version: string;\n };\n login: {\n /** Login dialog container (the MUI Dialog root). */\n dialog: string;\n /** DialogContent wrapper inside the login dialog. */\n dialogContent: string;\n /**\n * Error banner shown inside the login dialog when the server\n * rejects credentials (or any other `errors.root` message the form\n * sets). Renders inside the `LoginDialogFormError` component.\n */\n error: string;\n };\n package: {\n /** Wrapper around the list of packages on the home page. */\n itemList: string;\n /** Package name link in the package list (home + search results). */\n title: string;\n /** Version link of a package list item, to its version page (9.x). */\n versionLink: string;\n /** Readme container on the package detail page. */\n readme: string;\n /** Sidebar container on the package detail page. */\n sidebar: string;\n /** Install commands section list. */\n installList: string;\n /** Individual install line for npm. */\n installNpm: string;\n /** Individual install line for yarn. */\n installYarn: string;\n /** Individual install line for pnpm. */\n installPnpm: string;\n /** Individual install line for bun (9.x). */\n installBun: string;\n /** `.npmrc` registry line below the install commands (9.x). */\n installNpmrc: string;\n /** Copy button of the `.npmrc` registry line. */\n installNpmrcCopy: string;\n /** Tab that shows the readme. */\n readmeTab: string;\n /** Keyword list below the install section. */\n keywordList: string;\n /** Tab that reveals the dependencies view. */\n dependenciesTab: string;\n /** Dependencies list wrapper (one entry per dep). */\n dependencies: string;\n /** Tab that reveals the versions view. */\n versionsTab: string;\n /** \"latest\" tag row inside the versions view. */\n tagLatest: string;\n /** Tab that reveals the uplinks view. */\n uplinksTab: string;\n /** Empty-state message when the package has no uplinks. */\n noUplinks: string;\n /** Action-bar tarball download FAB. */\n downloadTarballBtn: string;\n /** Package list tarball download button. */\n downloadTarball: string;\n /** Action-bar \"view raw manifest\" FAB. */\n rawBtn: string;\n /** Full-screen dialog that opens when `rawBtn` is clicked. */\n rawViewerDialog: string;\n /** Close button inside the raw viewer dialog. */\n closeRawViewer: string;\n };\n search: {\n /** Prefix of the origin group headers: `<prefix>private|cached|remote`. */\n groupPrefix: string;\n /** Prefix of the origin icon on each result: `<prefix>private|...`. */\n originPrefix: string;\n };\n errors: {\n /**\n * Generic error page shown when a data request fails without a\n * specific status (5xx, network failure). Added by\n * verdaccio/verdaccio#6210 — only present on builds with that fix.\n */\n genericError: string;\n };\n}\n\n/**\n * CSS selectors (not data-testids) used by the test suites. These are\n * things like form-field IDs and framework-specific class names that\n * Verdaccio's UI exposes as plain selectors rather than testids.\n */\nexport interface Selectors {\n /** Class applied to the parsed README markdown body. */\n markdownBody: string;\n loginDialog: {\n /** Username text input inside the login dialog. */\n usernameInput: string;\n /** Password text input inside the login dialog. */\n passwordInput: string;\n /** Submit button inside the login dialog. */\n submitButton: string;\n };\n signup: {\n /** Username input on /-/web/add-user (shares ids with the login form). */\n usernameInput: string;\n /** Password input on /-/web/add-user. */\n passwordInput: string;\n /** Email input on /-/web/add-user (only email-typed input on the page). */\n emailInput: string;\n /** Submit button on /-/web/add-user. */\n submitButton: string;\n };\n}\n\n/**\n * Defaults matching Verdaccio 6.x (bundled ui-theme@9.0.0-next-9.x).\n * Overridable via `createRegistryConfig({ testIds: { ... } })`.\n */\nexport const DEFAULT_TEST_IDS: TestIds = {\n home: {\n helpCard: 'help-card',\n notFound: '404',\n packageListToolbar: 'package-list-toolbar',\n packageListFilter: 'package-list-filter',\n packageListScope: 'package-list-scope',\n packageListNoMatch: 'package-list-no-match',\n helpSetupTabPrefix: 'help-setup-',\n helpUplinksNote: 'help-uplinks-note',\n helpGuide: 'help-guide',\n },\n header: {\n container: 'header',\n innerNavBar: 'inner-nav-bar',\n right: 'header-right',\n searchContainer: 'search-container',\n defaultLogo: 'default-logo',\n customLogo: 'custom-logo',\n loginButton: 'header--button-login',\n settingsTooltip: 'header--tooltip-settings',\n settingsPublishTab: 'settings-publish-tab',\n settingsPublishPanel: 'settings-publish',\n infoTooltip: 'header--tooltip-info',\n themeSwitchLight: 'header--button--light',\n themeSwitchDark: 'header--button--dark',\n logInDialogIcon: 'logInDialogIcon',\n logOutDialogIcon: 'logOutDialogIcon',\n greetingsLabel: 'greetings-label',\n },\n footer: {\n container: 'footer',\n version: 'version-footer',\n },\n login: {\n dialog: 'login--dialog',\n dialogContent: 'dialogContentLogin',\n error: 'error',\n },\n package: {\n itemList: 'package-item-list',\n title: 'package-title',\n versionLink: 'package-version-link',\n readme: 'readme',\n sidebar: 'sidebar',\n installList: 'installList',\n installNpm: 'installListItem-npm',\n installYarn: 'installListItem-yarn',\n installPnpm: 'installListItem-pnpm',\n installBun: 'installListItem-bun',\n installNpmrc: 'install-npmrc',\n installNpmrcCopy: 'installNpmrc',\n readmeTab: 'readme-tab',\n keywordList: 'keyword-list',\n dependenciesTab: 'dependencies-tab',\n dependencies: 'dependencies',\n versionsTab: 'versions-tab',\n tagLatest: 'tag-latest',\n uplinksTab: 'uplinks-tab',\n noUplinks: 'no-uplinks',\n downloadTarballBtn: 'download-tarball-btn',\n downloadTarball: 'download-tarball',\n rawBtn: 'raw-btn',\n rawViewerDialog: 'rawViewer--dialog',\n closeRawViewer: 'close-raw-viewer',\n },\n search: {\n groupPrefix: 'search-group-',\n originPrefix: 'search-origin-',\n },\n errors: {\n genericError: 'generic-error',\n },\n};\n\n/**\n * Defaults for non-testid CSS selectors. Overridable via\n * `createRegistryConfig({ selectors: { ... } })`.\n */\nexport const DEFAULT_SELECTORS: Selectors = {\n markdownBody: '.markdown-body',\n loginDialog: {\n usernameInput: '#login--dialog-username',\n passwordInput: '#login--dialog-password',\n submitButton: '#login--dialog-button-submit',\n },\n signup: {\n usernameInput: '#login--dialog-username',\n passwordInput: '#login--dialog-password',\n emailInput: 'input[type=\"email\"]',\n submitButton: 'button[type=\"submit\"]',\n },\n};\n\n/** Deep-partial helper — every field of a nested object becomes optional. */\nexport type DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\n/**\n * Merge user overrides into the default testIds map. Merging is\n * per-section (one level deep): `overrides.header` replaces individual\n * fields under `defaults.header` without touching `defaults.footer`.\n * The shape is fixed and small, so we enumerate sections by hand\n * rather than relying on a recursive generic merger.\n */\nexport function mergeTestIds(defaults: TestIds, overrides?: DeepPartial<TestIds>): TestIds {\n if (!overrides) return defaults;\n return {\n home: { ...defaults.home, ...overrides.home },\n header: { ...defaults.header, ...overrides.header },\n footer: { ...defaults.footer, ...overrides.footer },\n login: { ...defaults.login, ...overrides.login },\n package: { ...defaults.package, ...overrides.package },\n search: { ...defaults.search, ...overrides.search },\n errors: { ...defaults.errors, ...overrides.errors },\n };\n}\n\n/** Same idea as `mergeTestIds`, for the CSS-selector block. */\nexport function mergeSelectors(defaults: Selectors, overrides?: DeepPartial<Selectors>): Selectors {\n if (!overrides) return defaults;\n return {\n markdownBody: overrides.markdownBody ?? defaults.markdownBody,\n loginDialog: { ...defaults.loginDialog, ...overrides.loginDialog },\n signup: { ...defaults.signup, ...overrides.signup },\n };\n}\n"],"mappings":";;;;;AAmMA,IAAa,mBAA4B;CACvC,MAAM;EACJ,UAAU;EACV,UAAU;EACV,oBAAoB;EACpB,mBAAmB;EACnB,kBAAkB;EAClB,oBAAoB;EACpB,oBAAoB;EACpB,iBAAiB;EACjB,WAAW;CACb;CACA,QAAQ;EACN,WAAW;EACX,aAAa;EACb,OAAO;EACP,iBAAiB;EACjB,aAAa;EACb,Y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AQ,GAAG,UAAU;EAAO;CACpD;AACF;;AAGA,SAAgB,eAAe,UAAqB,WAA+C;CACjG,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO;EACL,cAAc,UAAU,gBAAgB,SAAS;EACjD,aAAa;GAAE,GAAG,SAAS;GAAa,GAAG,UAAU;EAAY;EACjE,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;CACpD;AACF"}
|
|
1
|
+
{"version":3,"file":"testIds.cjs","names":[],"sources":["../../src/testIds.ts"],"sourcesContent":["/**\n * Configurable DOM selectors used by the e2e-ui test suites.\n *\n * The Verdaccio UI is a moving target — data-testids can and do change\n * between majors — so every selector referenced by a test lives here\n * and can be overridden by consumers of `@verdaccio/e2e-ui` via\n * `createRegistryConfig({ testIds, selectors })`.\n *\n * The defaults below match Verdaccio 6.x as of the last time we audited\n * the ui-components source. If a selector moves, override just the\n * affected field instead of forking the suite.\n */\n\n/**\n * Map of data-testid values used by the test suites, grouped by UI\n * section. Each field holds the bare testid string (no `data-testid=\"…\"`\n * wrapping) — the test helpers pass it through `cy.getByTestId(...)`.\n */\nexport interface TestIds {\n home: {\n /** Help card shown on the empty-registry landing page. */\n helpCard: string;\n /** 404 \"not found\" container. */\n notFound: string;\n /** Filter / scope / sort bar above the package list (9.x). */\n packageListToolbar: string;\n /** Text filter input inside the toolbar. */\n packageListFilter: string;\n /** Native input of the scope select (only with more than one scope). */\n packageListScope: string;\n /** Message shown when the filter matches no package. */\n packageListNoMatch: string;\n /** Prefix of the welcome card setup tabs: `<prefix><manager>`. */\n helpSetupTabPrefix: string;\n /** Note on the welcome card explaining cached uplink packages. */\n helpUplinksNote: string;\n /** Step list of the publishing guide, in the welcome card and the settings (9.x). */\n helpGuide: string;\n };\n header: {\n /** Outermost `<NavBar>` element. */\n container: string;\n /** Inner wrapper inside the nav bar. */\n innerNavBar: string;\n /** Right-side action cluster wrapper. */\n right: string;\n /** Wrapper around the header search input. */\n searchContainer: string;\n /** Default SVG Verdaccio logo. */\n defaultLogo: string;\n /** Custom (user-provided) logo image. */\n customLogo: string;\n /** \"Login\" button shown when logged out. */\n loginButton: string;\n /** Gear icon that opens the settings dialog. */\n settingsTooltip: string;\n /** \"Publishing\" tab of the settings dialog (9.x). */\n settingsPublishTab: string;\n /** Panel of the \"Publishing\" tab (9.x). */\n settingsPublishPanel: string;\n /** Info icon that opens the registry info dialog. */\n infoTooltip: string;\n /**\n * Theme switch button shown while in LIGHT mode (clicking it\n * flips to dark). The underlying component swaps between this\n * and `themeSwitchDark` based on `isDarkMode`.\n */\n themeSwitchLight: string;\n /** Theme switch button shown while in DARK mode. */\n themeSwitchDark: string;\n /** Menu icon shown after login (opens the logged-in menu). */\n logInDialogIcon: string;\n /** \"Log out\" entry inside the logged-in menu. */\n logOutDialogIcon: string;\n /** \"Hi <username>\" label inside the logged-in menu. */\n greetingsLabel: string;\n };\n footer: {\n /** Outer footer wrapper. */\n container: string;\n /** \"Powered by\" version text on the right side of the footer. */\n version: string;\n };\n login: {\n /** Login dialog container (the MUI Dialog root). */\n dialog: string;\n /** DialogContent wrapper inside the login dialog. */\n dialogContent: string;\n /**\n * Error banner shown inside the login dialog when the server\n * rejects credentials (or any other `errors.root` message the form\n * sets). Renders inside the `LoginDialogFormError` component.\n */\n error: string;\n };\n package: {\n /** Wrapper around the list of packages on the home page. */\n itemList: string;\n /** Package name link in the package list (home + search results). */\n title: string;\n /** Version link of a package list item, to its version page (9.x). */\n versionLink: string;\n /** Readme container on the package detail page. */\n readme: string;\n /** Sidebar container on the package detail page. */\n sidebar: string;\n /** Install commands section list. */\n installList: string;\n /** Individual install line for npm. */\n installNpm: string;\n /** Individual install line for yarn. */\n installYarn: string;\n /** Individual install line for pnpm. */\n installPnpm: string;\n /** Individual install line for bun (9.x). */\n installBun: string;\n /** `.npmrc` registry line below the install commands (9.x). */\n installNpmrc: string;\n /** Copy button of the `.npmrc` registry line. */\n installNpmrcCopy: string;\n /** Chip of the \"Provenance\" sidebar section that opens the provenance dialog (9.x). */\n provenanceBadge: string;\n /** Root of the provenance dialog (shares the registry info dialog container). */\n provenanceDialog: string;\n /** Tab that shows the readme. */\n readmeTab: string;\n /** Keyword list below the install section. */\n keywordList: string;\n /** Tab that reveals the dependencies view. */\n dependenciesTab: string;\n /** Dependencies list wrapper (one entry per dep). */\n dependencies: string;\n /** Tab that reveals the versions view. */\n versionsTab: string;\n /** \"latest\" tag row inside the versions view. */\n tagLatest: string;\n /** Tab that reveals the uplinks view. */\n uplinksTab: string;\n /** Empty-state message when the package has no uplinks. */\n noUplinks: string;\n /** Action-bar tarball download FAB. */\n downloadTarballBtn: string;\n /** Package list tarball download button. */\n downloadTarball: string;\n /** Action-bar \"view raw manifest\" FAB. */\n rawBtn: string;\n /** Full-screen dialog that opens when `rawBtn` is clicked. */\n rawViewerDialog: string;\n /** Close button inside the raw viewer dialog. */\n closeRawViewer: string;\n };\n search: {\n /** Prefix of the origin group headers: `<prefix>private|cached|remote`. */\n groupPrefix: string;\n /** Prefix of the origin icon on each result: `<prefix>private|...`. */\n originPrefix: string;\n };\n errors: {\n /**\n * Generic error page shown when a data request fails without a\n * specific status (5xx, network failure). Added by\n * verdaccio/verdaccio#6210 — only present on builds with that fix.\n */\n genericError: string;\n };\n}\n\n/**\n * CSS selectors (not data-testids) used by the test suites. These are\n * things like form-field IDs and framework-specific class names that\n * Verdaccio's UI exposes as plain selectors rather than testids.\n */\nexport interface Selectors {\n /** Class applied to the parsed README markdown body. */\n markdownBody: string;\n loginDialog: {\n /** Username text input inside the login dialog. */\n usernameInput: string;\n /** Password text input inside the login dialog. */\n passwordInput: string;\n /** Submit button inside the login dialog. */\n submitButton: string;\n };\n signup: {\n /** Username input on /-/web/add-user (shares ids with the login form). */\n usernameInput: string;\n /** Password input on /-/web/add-user. */\n passwordInput: string;\n /** Email input on /-/web/add-user (only email-typed input on the page). */\n emailInput: string;\n /** Submit button on /-/web/add-user. */\n submitButton: string;\n };\n}\n\n/**\n * Defaults matching Verdaccio 6.x (bundled ui-theme@9.0.0-next-9.x).\n * Overridable via `createRegistryConfig({ testIds: { ... } })`.\n */\nexport const DEFAULT_TEST_IDS: TestIds = {\n home: {\n helpCard: 'help-card',\n notFound: '404',\n packageListToolbar: 'package-list-toolbar',\n packageListFilter: 'package-list-filter',\n packageListScope: 'package-list-scope',\n packageListNoMatch: 'package-list-no-match',\n helpSetupTabPrefix: 'help-setup-',\n helpUplinksNote: 'help-uplinks-note',\n helpGuide: 'help-guide',\n },\n header: {\n container: 'header',\n innerNavBar: 'inner-nav-bar',\n right: 'header-right',\n searchContainer: 'search-container',\n defaultLogo: 'default-logo',\n customLogo: 'custom-logo',\n loginButton: 'header--button-login',\n settingsTooltip: 'header--tooltip-settings',\n settingsPublishTab: 'settings-publish-tab',\n settingsPublishPanel: 'settings-publish',\n infoTooltip: 'header--tooltip-info',\n themeSwitchLight: 'header--button--light',\n themeSwitchDark: 'header--button--dark',\n logInDialogIcon: 'logInDialogIcon',\n logOutDialogIcon: 'logOutDialogIcon',\n greetingsLabel: 'greetings-label',\n },\n footer: {\n container: 'footer',\n version: 'version-footer',\n },\n login: {\n dialog: 'login--dialog',\n dialogContent: 'dialogContentLogin',\n error: 'error',\n },\n package: {\n itemList: 'package-item-list',\n title: 'package-title',\n versionLink: 'package-version-link',\n readme: 'readme',\n sidebar: 'sidebar',\n installList: 'installList',\n installNpm: 'installListItem-npm',\n installYarn: 'installListItem-yarn',\n installPnpm: 'installListItem-pnpm',\n installBun: 'installListItem-bun',\n installNpmrc: 'install-npmrc',\n installNpmrcCopy: 'installNpmrc',\n provenanceBadge: 'provenance-badge',\n provenanceDialog: 'registryInfo--dialog',\n readmeTab: 'readme-tab',\n keywordList: 'keyword-list',\n dependenciesTab: 'dependencies-tab',\n dependencies: 'dependencies',\n versionsTab: 'versions-tab',\n tagLatest: 'tag-latest',\n uplinksTab: 'uplinks-tab',\n noUplinks: 'no-uplinks',\n downloadTarballBtn: 'download-tarball-btn',\n downloadTarball: 'download-tarball',\n rawBtn: 'raw-btn',\n rawViewerDialog: 'rawViewer--dialog',\n closeRawViewer: 'close-raw-viewer',\n },\n search: {\n groupPrefix: 'search-group-',\n originPrefix: 'search-origin-',\n },\n errors: {\n genericError: 'generic-error',\n },\n};\n\n/**\n * Defaults for non-testid CSS selectors. Overridable via\n * `createRegistryConfig({ selectors: { ... } })`.\n */\nexport const DEFAULT_SELECTORS: Selectors = {\n markdownBody: '.markdown-body',\n loginDialog: {\n usernameInput: '#login--dialog-username',\n passwordInput: '#login--dialog-password',\n submitButton: '#login--dialog-button-submit',\n },\n signup: {\n usernameInput: '#login--dialog-username',\n passwordInput: '#login--dialog-password',\n emailInput: 'input[type=\"email\"]',\n submitButton: 'button[type=\"submit\"]',\n },\n};\n\n/** Deep-partial helper — every field of a nested object becomes optional. */\nexport type DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\n/**\n * Merge user overrides into the default testIds map. Merging is\n * per-section (one level deep): `overrides.header` replaces individual\n * fields under `defaults.header` without touching `defaults.footer`.\n * The shape is fixed and small, so we enumerate sections by hand\n * rather than relying on a recursive generic merger.\n */\nexport function mergeTestIds(defaults: TestIds, overrides?: DeepPartial<TestIds>): TestIds {\n if (!overrides) return defaults;\n return {\n home: { ...defaults.home, ...overrides.home },\n header: { ...defaults.header, ...overrides.header },\n footer: { ...defaults.footer, ...overrides.footer },\n login: { ...defaults.login, ...overrides.login },\n package: { ...defaults.package, ...overrides.package },\n search: { ...defaults.search, ...overrides.search },\n errors: { ...defaults.errors, ...overrides.errors },\n };\n}\n\n/** Same idea as `mergeTestIds`, for the CSS-selector block. */\nexport function mergeSelectors(defaults: Selectors, overrides?: DeepPartial<Selectors>): Selectors {\n if (!overrides) return defaults;\n return {\n markdownBody: overrides.markdownBody ?? defaults.markdownBody,\n loginDialog: { ...defaults.loginDialog, ...overrides.loginDialog },\n signup: { ...defaults.signup, ...overrides.signup },\n };\n}\n"],"mappings":";;;;;AAuMA,IAAa,mB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Q;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,OAAO;GAAE,GAAG,SAAS;GAAO,GAAG,UAAU;EAAM;EAC/C,SAAS;GAAE,GAAG,SAAS;GAAS,GAAG,UAAU;EAAQ;EACrD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;EAClD,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;CACpD;AACF;;AAGA,SAAgB,eAAe,UAAqB,WAA+C;CACjG,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO;EACL,cAAc,UAAU,gBAAgB,SAAS;EACjD,aAAa;GAAE,GAAG,SAAS;GAAa,GAAG,UAAU;EAAY;EACjE,QAAQ;GAAE,GAAG,SAAS;GAAQ,GAAG,UAAU;EAAO;CACpD;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_features = require("../features.cjs");
|
|
2
|
-
|
|
2
|
+
// src/tests/change-password.ts
|
|
3
3
|
/**
|
|
4
4
|
* Tests for the Change Password page at /-/web/change-password.
|
|
5
5
|
*
|
|
@@ -140,7 +140,6 @@ function changePasswordTests(config) {
|
|
|
140
140
|
});
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
//#endregion
|
|
144
143
|
exports.changePasswordTests = changePasswordTests;
|
|
145
144
|
|
|
146
145
|
//# sourceMappingURL=change-password.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_features = require("../features.cjs");
|
|
2
|
-
|
|
2
|
+
// src/tests/detail.ts
|
|
3
3
|
/**
|
|
4
4
|
* Package detail page tests: version-pinned URLs and the wire format of
|
|
5
5
|
* the UI's data requests.
|
|
@@ -100,7 +100,6 @@ function detailTests(config) {
|
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
//#endregion
|
|
104
103
|
exports.detailTests = detailTests;
|
|
105
104
|
|
|
106
105
|
//# sourceMappingURL=detail.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_features = require("../features.cjs");
|
|
2
|
-
|
|
2
|
+
// src/tests/failure-modes.ts
|
|
3
3
|
/**
|
|
4
4
|
* Failure-mode tests: what the UI shows when the backend misbehaves.
|
|
5
5
|
*
|
|
@@ -91,7 +91,6 @@ function failureModeTests(config) {
|
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
//#endregion
|
|
95
94
|
exports.failureModeTests = failureModeTests;
|
|
96
95
|
|
|
97
96
|
//# sourceMappingURL=failure-modes.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_features = require("../features.cjs");
|
|
2
|
-
|
|
2
|
+
// src/tests/home-detail-ux.ts
|
|
3
3
|
/**
|
|
4
4
|
* Home and package page UX that ships with the 9.x web UI: the package
|
|
5
5
|
* list toolbar, the tab in the address, the welcome guide, the install
|
|
@@ -160,7 +160,6 @@ function homeDetailUxTests(config) {
|
|
|
160
160
|
});
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
//#endregion
|
|
164
163
|
exports.homeDetailUxTests = homeDetailUxTests;
|
|
165
164
|
|
|
166
165
|
//# sourceMappingURL=home-detail-ux.cjs.map
|
package/build/cjs/tests/home.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/tests/home.ts
|
|
2
2
|
function homeTests(config) {
|
|
3
3
|
const { home, header, package: pkg } = config.testIds;
|
|
4
4
|
const { features } = config;
|
|
@@ -84,7 +84,6 @@ function homeTests(config) {
|
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
//#endregion
|
|
88
87
|
exports.homeTests = homeTests;
|
|
89
88
|
|
|
90
89
|
//# sourceMappingURL=home.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_features = require("../features.cjs");
|
|
2
|
-
|
|
2
|
+
// src/tests/i18n-keys.ts
|
|
3
3
|
/**
|
|
4
4
|
* Raw-i18n-key detector: no page may render untranslated keys like
|
|
5
5
|
* `security.addUser.title` as visible text.
|
|
@@ -68,7 +68,6 @@ function i18nKeyTests(config) {
|
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
//#endregion
|
|
72
71
|
exports.i18nKeyTests = i18nKeyTests;
|
|
73
72
|
|
|
74
73
|
//# sourceMappingURL=i18n-keys.cjs.map
|
|
@@ -12,6 +12,8 @@ const require_signup = require("./signup.cjs");
|
|
|
12
12
|
const require_manifest_rendering = require("./manifest-rendering.cjs");
|
|
13
13
|
const require_session = require("./session.cjs");
|
|
14
14
|
const require_home_detail_ux = require("./home-detail-ux.cjs");
|
|
15
|
+
const require_provenance = require("./provenance.cjs");
|
|
16
|
+
const require_prefixed_routing = require("./prefixed-routing.cjs");
|
|
15
17
|
exports.changePasswordTests = require_change_password.changePasswordTests;
|
|
16
18
|
exports.detailTests = require_detail.detailTests;
|
|
17
19
|
exports.failureModeTests = require_failure_modes.failureModeTests;
|
|
@@ -20,6 +22,8 @@ exports.homeTests = require_home.homeTests;
|
|
|
20
22
|
exports.i18nKeyTests = require_i18n_keys.i18nKeyTests;
|
|
21
23
|
exports.layoutTests = require_layout.layoutTests;
|
|
22
24
|
exports.manifestRenderingTests = require_manifest_rendering.manifestRenderingTests;
|
|
25
|
+
exports.prefixedRoutingTests = require_prefixed_routing.prefixedRoutingTests;
|
|
26
|
+
exports.provenanceTests = require_provenance.provenanceTests;
|
|
23
27
|
exports.publishTests = require_publish.publishTests;
|
|
24
28
|
exports.searchTests = require_search.searchTests;
|
|
25
29
|
exports.sessionTests = require_session.sessionTests;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_features = require("../features.cjs");
|
|
2
|
-
|
|
2
|
+
// src/tests/layout.ts
|
|
3
3
|
/**
|
|
4
4
|
* Tests for the persistent page chrome: the header (nav bar, logo,
|
|
5
5
|
* search container, action buttons) and the footer (version marker).
|
|
@@ -75,7 +75,6 @@ function layoutTests(config) {
|
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
//#endregion
|
|
79
78
|
exports.layoutTests = layoutTests;
|
|
80
79
|
|
|
81
80
|
//# sourceMappingURL=layout.cjs.map
|