Skip to main content

testivai init

Runs the interactive setup wizard that generates helper files and example tests for your framework.

Usageโ€‹

npx testivai init [options]

Optionsโ€‹

FlagDescription
-f, --forceOverwrite existing files
-y, --yesSkip prompts and auto-detect framework

Interactive Wizardโ€‹

Without flags, the wizard asks:

  1. Language โ€” JavaScript/TypeScript, Python, Java, or Ruby
  2. Framework โ€” framework choices based on language
  3. Test directory โ€” where to place generated example files
? Select your language:        โ€บ JavaScript / TypeScript
? Select your test framework: โ€บ Cypress
? Where are your test files? โ€บ cypress/e2e

Generated Filesโ€‹

After running init, the following files are created in your project:

  • A helper file (testivai-witness.js / testivai_witness.py / etc.) โ€” the capture function wrapper
  • An example test showing a complete working test with a witness() call
  • testivai.config.ts โ€” project configuration with your API key placeholder

For Cypress, the wizard also detects or creates cypress.config.js with the required plugin for remote debugging port injection.

Playwright Detectionโ€‹

If @playwright/test is detected in your package.json, testivai init exits early and directs you to the dedicated Playwright SDK:

npm install @testivai/witness-playwright