testivai init
Runs the interactive setup wizard that generates helper files and example tests for your framework.
Usageโ
npx testivai init [options]
Optionsโ
| Flag | Description |
|---|---|
-f, --force | Overwrite existing files |
-y, --yes | Skip prompts and auto-detect framework |
Interactive Wizardโ
Without flags, the wizard asks:
- Language โ JavaScript/TypeScript, Python, Java, or Ruby
- Framework โ framework choices based on language
- 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