om-prepare-test-env

Provisions ephemeral Open Mercato test environments via the mercato CLI runner.

1.7k|382|Updated Sep 10, 2025
One-click install
npx skills add https://github.com/open-mercato/open-mercato --skill om-prepare-test-env
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: om-prepare-test-env
Source: https://github.com/open-mercato/open-mercato/tree/main/packages/create-app/agentic/shared/ai/skills/om-prepare-test-env
Command: npx skills add https://github.com/open-mercato/open-mercato --skill om-prepare-test-env

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Running integration tests against an Open Mercato app requires a correctly provisioned app server, database, seeding, and readiness checks; doing this by hand risks hitting the developer's dev database or misconfiguring the environment. This Skill defines the repo-specific rules for booting, reusing, and tearing down an isolated ephemeral test environment through the mercato CLI.

Core Features & Use Cases

  • Ephemeral environment boot: Wraps yarn test:integration:ephemeral:start to provision an isolated app plus testcontainers-managed Postgres, with port and database URL recorded in .ai/qa/ephemeral-env.json.
  • Managed and reuse run modes: Supports fully managed per-run provisioning or boot-once-and-reuse for fast filtered test iteration, gated by the CLI's TTL and freshness checks.
  • Readiness probe contract: Defines shell (GET /login) and authenticated form-encoded login probes, plus seeded credentials, so agents verify the environment correctly.
  • Safe teardown: Stops CLI owner processes, clears state files and server locks, and leaves testcontainers cleanup to ryuk.
  • Use Case: An AI agent asked to run integration tests boots the ephemeral env with one CLI command, waits for the readiness marker, runs filtered Playwright specs, and tears everything down without touching dev data.

Quick Start

Ask the agent to prepare the test environment by running yarn test:integration:ephemeral:start and confirm readiness via the login probe before executing integration tests.

Frequently Asked Questions about om-prepare-test-env

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I start an ephemeral test environment for Open Mercato?

Run yarn test:integration:ephemeral:start, which invokes the mercato CLI to provision an isolated app and testcontainers-managed Postgres. The actual port and database URL are written to .ai/qa/ephemeral-env.json, and readiness is confirmed by the 'Application is ready at <baseUrl>' log marker.

How do I run Open Mercato integration tests with a managed environment?

Use yarn test:integration:ephemeral, optionally with a substring filter to batch matching specs. It reuses a healthy running ephemeral env from the state file or provisions a new one, injecting the full env block including DATABASE_URL and secrets.

Why does yarn test:integration fail or hit the dev database?

Running yarn test:integration with only BASE_URL exported lacks the CLI runner's injected env block, so fixtures silently use the dev database from .env. Always run suites via yarn test:integration:ephemeral instead.

How do I check the Open Mercato test app is ready?

Probe GET /login for a 200 response, then POST /api/auth/login with a form-encoded body such as [email protected]&password=secret. A JSON body returns 400 because the endpoint rejects JSON, indicating a malformed probe rather than a broken app.

Can I commit the generated test-env entrypoint scripts?

No. The compiled test-env-up.sh and test-env-down.sh scripts are machine-local, bound to the generating machine's shell, tools, and ports, and are gitignored under .ai/scripts/test-env-*. Regenerate them on each machine from the documented CLI commands.

How do I tear down the ephemeral test environment?

Stop the CLI owner process and the app on the recorded port, then delete .ai/qa/ephemeral-env.json. Clear .mercato/server-start.lock if a server wrapper survives, and let testcontainers' ryuk reap the Postgres containers rather than removing them manually.