ML.ai

Unit tests written, run, and explained

Name a function. ML.ai reads your test setup, writes the tests, runs them, and tells you plainly what passed and what broke.

Who uses ML.ai for tests

Developers who know the code needs tests and have not had the hour to write them.

  • Teams with thin coverage

    Utilities that shipped with no test beside them.

  • Developers with a failing suite

    Tests that broke after a change and need a cause.

  • Reviewers who want proof

    A test run you can read, not a promise.

A test only counts if it ran

Generated tests are cheap to write and easy to get wrong. Here is what keeps them worth merging.

A chat window sees one pasted function

It does not know your module type, your test script, or where tests live. So it guesses.

It reads your setup first

ML.ai opened the function and package.json, saw an ESM project with tests in test/, and wrote the file there.

A failed run gets an explanation

npm test failed because of the project’s own script. ML.ai said so, ran the file directly, and reported 7 passing.

It asks before touching other files

It said the turn would change the test file. Before editing package.json, it stopped and asked.

Writing tests by hand versus handing it off

By hand

You check the module type, copy an import, write the happy path, and run the suite last, if at all.

With ML.ai

You name the function. ML.ai reads your setup, writes the file, runs it, and reports back.

Which agent actually does this

Build · Read · Write tests · Run

Writes the tests and runs them

Reads the function and project setup, writes the test file, runs it, and asks before changing anything else.

explore · Read · Search · Write

Optional: see what is covered first

Read-only. Ask which functions already have tests before anything is written.

From one sentence to a test run

ML.ai checks how your project runs tests before it writes a line, then runs what it wrote.

1Name the function and the runnerOne sentence is enough. ML.ai may list the proposed work and ask which parts to do.
2It reads your setupIt opens the function and package.json to learn the module type and where tests go.
3It writes and runs the testsIf the run fails, you get the reason, and a broken setup is told apart from broken tests.
4You approve anything extraIf the turn needs a file it did not declare, ML.ai asks first. Continue, or keep to the plan.

Where test writing goes wrong

Three common failures, and what ML.ai did about each in a real run.

Tests for the wrong module system

A generated test uses require in an ESM project and fails before it tests anything.

How ML.ai handles it

ML.ai read package.json first, saw "type": "module", and wrote import-style tests.

A run that fails for the wrong reason

npm test goes red, and you cannot tell if the tests or the setup broke.

How ML.ai handles it

ML.ai traced it to the script, ran the file directly (7 passed), and asked before fixing package.json.

Tests that lock in today’s behavior

A test records what the code does now, so a bug can become the expected result.

How ML.ai handles it

The run covered 0, null and a negative price, and flagged the negative case as current behavior. Read those before merging.

Where this stops

What to expect, so nothing surprises you.

01
01

It may ask first

ML.ai can list the proposed work and wait for your pick. Name what to cover to skip the round trip.

02
02

It stops at undeclared files

Editing a file it did not mention needs your OK.

03
03

Inconclusive is not a pass

If a check has no clear result, ML.ai shows a Verification notice. Run /ml-ai:proof to see what was checked.

Root cause in session.ts

The store returns null before the session write finishes, so the middleware rejects a valid token.

session.ts+2 −1
40export async function getSession(id) {
41- const s = store.get(id)
41+ const s = await store.get(id)
42+ if (!s) throw new SessionNotFound(id)
AllowAlwaysDeny

Debug

Give ML.ai a failing test or a stack trace. It finds the actual cause and proposes a fix you approve.

Apply edits to 3 files?

One diff across the schema, the API route and the task card.

route.tsschema.prismaTaskCard.tsx+2 −1
20export async function POST(req) {
21- const { title } = await req.json()
21+ const { title, dueDate } = await req.json()
22+ return createTask({ title, dueDate })
AllowAlwaysDeny

Build

Describe a feature in a sentence. ML.ai writes it across every file it touches, as one diff.

FAQs

Does it run the tests it writes?

Yes. It runs them and reports the result. After a turn that changes files, ML.ai also checks the work and can make up to 2 repairs.

Will it match my test setup?

It reads package.json first, so it knows the module type and where tests go. It uses the runner you name.

What if the run fails?

You get the reason. When npm test failed on a bad script, it said so and ran the test file directly.

Can it change other files?

Only with your OK. When a turn needs a file it did not declare, ML.ai asks.

Try ML.ai today, or talk to us about what is next

Install the editor agent on your own machine, or book a call to talk through your team’s workloads