- Fastest: run
npx testdriverai initand let it create every file for you. - By hand: follow the steps below to see exactly what each file does.
Set up with init
Runinit in your project folder:
.env. It then adds:
- A
package.json, if you donβt have one vitest.config.jswith the TestDriver reporter- An example test in
tests/ - A GitHub Actions workflow
- The TestDriver agent and MCP server for your AI client
init keeps your existing package.json, Vitest config, tests, and workflow. It only adds to .gitignore and to MCP config files.
Then run the example:
Set up by hand
1
Add your API key
Create an API key at console.testdriver.ai/team/api-keys. The free plan includes 30 testing minutes and needs no credit card.Save the key in a Add
.env file at your project root. The SDK loads it automatically:.env
.env to .gitignore so the key isnβt committed.2
Install dependencies
Install Vitest and TestDriver as dev dependencies:TestDriver needs Node.js 20.19 or later. It only runs on Vitest, not Jest, Mocha, or other runners.
3
Configure Vitest
Create
vitest.config.js at your project root, or add these settings to your existing config:vitest.config.js
TestDriver()is the reporter. It records each run in the TestDriver console, with its recording.setupFileslinks your tests to the reporter, so each testβs recording attaches to the run.- The timeouts must be long. Vitestβs defaults (5 seconds for tests, 10 for hooks) are too short for a real machine.
4
Write a test
Create If your
tests/search.test.js:tests/search.test.js
package.json doesnβt set "type": "module", name the file search.test.mjs instead.5
Run the test
TESTDRIVER_RUN_URL link at the end of the output. It shows the recording and each step.Connect an AI assistant
To write tests with an AI assistant, add the TestDriver agent and MCP server to your project.--no-sample-test skips the example test files:
Next steps
Launch apps
Start Chrome, extensions, VS Code, or desktop apps.
Perform actions
Click, type, scroll, and wait for a changing UI.
Make assertions
Check whatβs on screen in plain language.
Run in CI/CD
Run your tests on every pull request.

