nyx-test
v0.0.9
Published
Nyx Test is a TypeScript toolkit for browser-flow testing with `agent-browser` and `vitest`, plus a small CLI to distribute reusable AI skills across projects.
Downloads
1,065
Readme
Nyx Test
Nyx Test is a TypeScript toolkit for browser-flow testing with agent-browser and vitest, plus a small CLI to distribute reusable AI skills across projects.
What it includes
- Test helpers for end-to-end style flows:
it()wrapper with per-test session/artifact lifecyclerun()helper to executeagent-browsercommandsscreenshot()helper for saved screenshotsmatchSnapshot()helper for normalized snapshot assertions
- Artifact generation under
e2e/artifacts(configurable) - CLI command to copy packaged skills into another project
Installation
yarn add nyx-testNyx Test uses:
agent-browservitest
They are declared as peer dependencies, so make sure they are available in your project.
Library usage
Import helpers from the package entrypoint:
import { it, run, screenshot, matchSnapshot } from "nyx";it keeps Nyx's artifact/session lifecycle and supports the same chainable API style as Vitest, like it.skip, it.only, it.each, it.skipIf, and it.runIf.
Example:
import { describe } from "vitest";
import { it, run, screenshot, matchSnapshot } from "nyx";
describe("checkout flow", () => {
it("completes purchase", async () => {
run("goto https://example.com");
run("click 'Buy now'");
screenshot("after-buy.png");
matchSnapshot();
});
});CLI usage
Nyx Test exposes a binary named nyx-test.
copy-skills
Copies skill folders from .ai/skills in the current working directory to a target path.
npx nyx-test copy-skills --skills-path ./skillsOptions:
--skills-path <skills-path>: destination path (default:./skills)
During copy, Nyx Test updates each copied SKILL.md by replacing <PATH> placeholders with the provided path.
Artifacts
By default, test artifacts are written to:
e2e/artifacts/<test-file>/<timestamp-uuid>/Inside each run directory:
screenshots/video/<test-file>.webm
You can override the root directory with:
E2E_ARTIFACTS_DIR=custom/pathDevelopment
Install dependencies:
yarn installAvailable scripts:
yarn build- compile TypeScript todistyarn test- run tests with Vitestyarn test:watch- run tests in watch mode
License
MIT
