Bumped @tryghost test-helper packages to v2.1.0#27514
Conversation
- @tryghost/express-test 0.15.5 -> 2.1.0 - @tryghost/email-mock-receiver 0.3.16 -> 2.1.0 - @tryghost/webhook-mock-receiver 0.2.22 -> 2.1.0 - first wave of a multi-step upgrade to catch ghost/core up with the TryGhost/Framework monorepo releases; test helpers first because the blast radius is limited to ghost/core's test suite - snapshot files touched only in the v1 header comment URL, a no-op rewrite by the transitive @tryghost/jest-snapshot bump - unit, integration, and e2e-api suites all pass locally
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughUpdated versions for three mock/test packages in 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ghost/core/package.json (1)
102-102: Move@tryghost/email-mock-receivertodevDependenciesto match usage scope.This package is referenced only in test utilities (
ghost/core/test/utils/e2e-framework-mock-manager.js) and has no usage in production code. Moving it fromdependenciestodevDependenciesaligns with the scope of related test helpers (@tryghost/express-test,@tryghost/webhook-mock-receiver) already in devDependencies and reduces production install surface.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ghost/core/package.json` at line 102, Remove "@tryghost/email-mock-receiver": "2.1.0" from the dependencies block in package.json and add the same entry under devDependencies (matching the version "2.1.0"); update lockfile by running the package manager (npm/yarn/pnpm) to regenerate the lockfile so installs reflect the move and run tests that use test/utils/e2e-framework-mock-manager.js to verify nothing breaks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@ghost/core/package.json`:
- Line 102: Remove "@tryghost/email-mock-receiver": "2.1.0" from the
dependencies block in package.json and add the same entry under devDependencies
(matching the version "2.1.0"); update lockfile by running the package manager
(npm/yarn/pnpm) to regenerate the lockfile so installs reflect the move and run
tests that use test/utils/e2e-framework-mock-manager.js to verify nothing
breaks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: eeab39bf-0397-4483-8d0d-05ea5977a2df
⛔ Files ignored due to path filters (82)
ghost/core/test/e2e-api/admin/__snapshots__/activity-feed.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/authentication.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/automated-email-design.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/automated-emails.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/backup.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/comments.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/config.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/custom-theme-settings.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/db.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/email-previews.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/emails.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/explore.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/images.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/integrations.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/labels.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/links.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/member-commenting.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/members-edit-subscriptions.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/members-exporter.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/members-newsletters.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/members-stripe-connect.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/members.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/mentions.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/newsletters.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/notifications.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/offers.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/pages-bulk.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/pages.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/post-analytics-export.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/posts-bulk.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/posts.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/rate-limiting.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/recommendations.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/roles.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/search-index.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/session.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/settings-files.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/site.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/slack.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/slugs.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/snippets.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/sso.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/stats.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/tiers.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/users.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/admin/__snapshots__/webhooks.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/content/__snapshots__/authors.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/content/__snapshots__/newsletters.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/content/__snapshots__/offers.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/content/__snapshots__/pages.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/content/__snapshots__/posts.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/content/__snapshots__/recommendations.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/content/__snapshots__/search-index.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/content/__snapshots__/settings.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/content/__snapshots__/tiers.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/members-comments/__snapshots__/comments.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/members/__snapshots__/announcement.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/members/__snapshots__/create-stripe-checkout-session.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/members/__snapshots__/donation-checkout-session.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/members/__snapshots__/feedback.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/members/__snapshots__/gift-subscriptions.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/members/__snapshots__/middleware.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/members/__snapshots__/recommendations.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/members/__snapshots__/send-magic-link.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/members/__snapshots__/site.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/members/__snapshots__/webhooks.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-api/members/__snapshots__/well-known.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-server/__snapshots__/1-options-requests.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-server/__snapshots__/click-tracking.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-server/__snapshots__/well-known.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-server/services/__snapshots__/recommendation-emails.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-webhooks/__snapshots__/members.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-webhooks/__snapshots__/pages.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-webhooks/__snapshots__/posts.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-webhooks/__snapshots__/site.test.js.snapis excluded by!**/*.snapghost/core/test/e2e-webhooks/__snapshots__/tags.test.js.snapis excluded by!**/*.snapghost/core/test/integration/services/__snapshots__/member-welcome-emails-snapshot.test.js.snapis excluded by!**/*.snapghost/core/test/integration/services/email-service/__snapshots__/cards.test.js.snapis excluded by!**/*.snapghost/core/test/unit/frontend/helpers/__snapshots__/ghost-head.test.js.snapis excluded by!**/*.snapghost/core/test/unit/server/services/settings/__snapshots__/settings-bread-service.test.js.snapis excluded by!**/*.snappnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (1)
ghost/core/package.json
- v2 of @tryghost/express-test swaps the reqresnext mock req/res for real http.IncomingMessage / http.ServerResponse objects, so Ghost's admin-session middleware now executes fully during the test and the ghost-admin-api-session cookie that Ghost has always set on a successful password reset actually reaches the response snapshot - matched the cookie with stringMatching(/^ghost-admin-api-session=/), the same pattern already used in test/e2e-api/admin/session.test.js, so dynamic cookie values and expiries don't make the snapshot brittle - test/legacy/ isn't part of ghost/core's pnpm test:e2e script, which is why this slipped past the local verification run
- follow-up to the ghost-admin-api-session cookie showing up in the ghost/core password-reset snapshot after the @tryghost/express-test v2 bump: verified the cookie is actually emitted by Ghost, not an artifact of the new mock req/res implementation - the existing "analyticsPage.header is visible" check proves the UI lands on the admin dashboard, but relies on the session middleware working to get there; asserting the cookie directly pins down the mechanism so a future regression in session emission fails here with a clear message instead of a generic navigation timeout - two lines, no new fixtures, no new waits - uses page.context() cookies which is already populated by the time the assertion runs
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #27514 +/- ##
==========================================
+ Coverage 72.94% 72.95% +0.01%
==========================================
Files 1556 1556
Lines 125792 125792
Branches 15215 15212 -3
==========================================
+ Hits 91757 91777 +20
+ Misses 33056 33036 -20
Partials 979 979
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|



Summary
Bumps the three
@tryghost/*test-helper packages from their pre-1.0 versions up to2.1.0, the current releases from the TryGhost/Framework monorepo.@tryghost/express-test@tryghost/email-mock-receiver@tryghost/webhook-mock-receiverScope is intentionally narrow — only
ghost/coredevDependencies (plusemail-mock-receiverwhich was a regular dep). The public API surface consumed inghost/core/test/utils/**(the defaultAgentexport,.snapshot.{snapshotManager,any,stringMatching},WebhookMockReceiver,EmailMockReceiver) is preserved in the new versions.Password-reset snapshot change — not a regression
The legacy suite's
Authentication API > Password reset > reset passwordtest produced a snapshot diff with a newset-cookie: ghost-admin-api-session=...entry. Root cause:@tryghost/express-test@0.15.5built fake req/res using thereqresnextpackage@tryghost/express-test@2.1.0builds realhttp.IncomingMessage/http.ServerResponseobjects wired to a mock socketThe old mock wasn't spec-compliant enough to drive Ghost's admin-session middleware, so any
Set-Cookieit produced never reached the response snapshot. The new real-http implementation runs the middleware pipeline fully, so the session cookie Ghost has always issued on a successful password reset (the reset logs the user in) now shows up where it always should have.Updated the snapshot to match, using the same
stringMatching(/^ghost-admin-api-session=/)pattern already in use intest/e2e-api/admin/session.test.jsso dynamic cookie values/expiries don't make the snapshot brittle.E2E validation of the cookie behavior
Added a one-line assertion to
e2e/tests/admin/reset-password.test.tsto independently confirm the cookie is emitted by the real server, not just by the new mock layer:Why this is the right level of validation:
analyticsPage.headeris visible) only implicitly proves session auth works — if the cookie were missing, the UI would redirect back to login and the check would fail with a generic navigation timeoutpage.context().cookies()after the UI transition directly pins down the mechanism, so a future regression in session emission fails here with a precise messagewaitForResponseplumbing — just reads cookies already populated by the browser by the time the test gets therepnpm dev: the test passes, meaning a real browser receives and stores the cookie after a real password reset through Ghost's real middleware stackThis matches the v2 behavior of
express-testto genuine server behavior, confirming the snapshot change is correct.Why the big snapshot churn
The 80-ish
.snapfiles in this diff have only a single-line change each — the@tryghost/jest-snapshotbanner comment URL was updated upstream:No snapshot content changed. The rewrite is a cosmetic artifact of running the snapshot serializer from the new
jest-snapshotversion (transitive viaexpress-test).pnpm installreports net+23 / -25packages — the Framework repo dropped several runtime deps (gotfromwebhook-mock-receiver's runtime,lodash.template, etc.).Test plan
pnpm install(clean)cd ghost/core && pnpm test:unit— 6121 passingcd ghost/core && pnpm test:integration— 242 passingcd ghost/core && pnpm test:e2e— 1569 passingcd ghost/core && pnpm test:legacy— 451 passing (the suite that initially caught the snapshot change)cd e2e && pnpm test tests/admin/reset-password.test.ts— passing againstpnpm dev