Skip to content

test: add E2E test infrastructure with sync, login, logout, whoami, and init tests#47

Merged
angeloashmore merged 7 commits intomainfrom
aa/tests
Mar 12, 2026
Merged

test: add E2E test infrastructure with sync, login, logout, whoami, and init tests#47
angeloashmore merged 7 commits intomainfrom
aa/tests

Conversation

@angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Mar 12, 2026

Resolves:

Description

Adds a comprehensive E2E test infrastructure that runs against real Prismic APIs and exercises the CLI binary directly. Each test run authenticates with a dedicated test account, creates a temporary repository, and cleans it up afterward.

E2E tests added for: login, logout, whoami, init, and sync (including watch mode).

CLI changes to support testing:

  • --no-browser flag on login and init for headless test flows
  • MODE=test build mode that disables telemetry during test runs

Test infrastructure improvements:

  • Shared Prismic fixture with automatic repo lifecycle management (create/teardown)
  • Common project setup (package.json, prismic.config.json) moved into shared fixtures
  • Concurrent test execution with watch mode support (unit / unit:watch scripts)
  • cross-env added for cross-platform env var support
  • Coverage reporting removed
  • CI workflows updated to pass PRISMIC_E2E_* secrets to the test runner

Build config fixes:

  • Disable bundling and minification only in test mode

Checklist

  • A comprehensive Linear ticket, providing sufficient context and details to facilitate the review of the PR, is linked to the PR.
  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

How to QA 1


Note

Medium Risk
Adds real-network E2E tests that create/delete Prismic repositories and adjusts build/env/telemetry behavior in MODE=test, which can affect CI stability and release packaging if misconfigured.

Overview
Adds an end-to-end test harness that runs the built CLI (dist/index.mjs) against real Prismic APIs, including global setup that authenticates with a dedicated account, creates a temporary repository, and cleans it up after the run.

Expands test coverage with new E2E specs for init, login, logout, whoami, and sync (including --watch), plus shared fixtures for per-test HOME/project isolation and process output capture.

Updates the CLI and build/test pipeline to support headless testing: introduces --no-browser for login and init, disables telemetry in test mode, adjusts tsdown to avoid bundling/minification in MODE=test, simplifies Vitest config (drops coverage), and tweaks GitHub workflows to force MODE=production for release/publish and run tests on Node 20/22/24 with E2E credentials.

Written by Cursor Bugbot for commit 1d601b6. This will update automatically on new commits. Configure here.

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

angeloashmore and others added 7 commits March 11, 2026 14:56
Introduces a real E2E test infrastructure that authenticates against
Prismic, creates a temporary repository per test run, and exercises
the CLI binary directly. Adds --no-browser flag for headless login
flows and a MODE=test build mode to disable telemetry during tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mode

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move common project setup (package.json, prismic.config.json) into the
shared prismic fixture so individual tests don't repeat boilerplate.
Add cross-env for cross-platform env var support. Add E2E tests for
the sync command covering both one-shot and watch modes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@angeloashmore angeloashmore changed the title test: add E2E tests for core CLI commands test: add E2E test infrastructure with sync, login, logout, whoami, and init tests Mar 12, 2026
@angeloashmore angeloashmore marked this pull request as ready for review March 12, 2026 02:22
@angeloashmore angeloashmore merged commit f616c8f into main Mar 12, 2026
12 checks passed
@angeloashmore angeloashmore deleted the aa/tests branch March 12, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant