Your module type and your test script never made it into the chat.
What a pasted function can see
A chat window sees one pasted function
It does not know your module type, your test script, or where tests live. So it guesses.
Name a function. ML.ai reads your test setup, writes the tests, runs them, and tells you plainly what passed and what broke.
Write unit tests for formatPrice in src/utils/price.js and run them
Read price.js and package.jsonESM, test/
Wrote test/price.test.js7 tests
Ran npm testscript failed
All 7 tests pass when run directly.
npm test itself failed: its script, node --test test/, breaks on this Node version. The tests were not the problem.
Describe a task or ask a question

for testsDevelopers who know the code needs tests and have not had the hour to write them.
Utilities that shipped with no test beside them.
Tests that broke after a change and need a cause.
A test run you can read, not a promise.
Generated tests are cheap to write and easy to get wrong. Here is what keeps them worth merging.
You check the module type, copy an import, write the happy path, and run the suite last, if at all.
price.test.js, by hand
Check the module type
Write the happy-path caseDone
Think of edge casesSkipped
$npm test → not run yet
Zero and negative prices never get a test


You name the function. ML.ai reads your setup, writes the file, runs it, and reports back.
Write unit tests for formatPrice and run them
Wrote 7 tests and ran them7 passed
Build
Build · Read · Write tests · Run
Reads the function and project setup, writes the test file, runs it, and asks before changing anything else.
explore
explore · Read · Search · Write
Read-only. Ask which functions already have tests before anything is written.
ML.ai checks how your project runs tests before it writes a line, then runs what it wrote.
Explorer


general, the default agent, takes the whole task
Write unit tests for formatPrice in src/utils/price.js and run them
Three common failures, and what ML.ai did about each in a real run.
price.test.jsWith ML.ai
module typemodule, read
importsimport
locationtest/
A generated test uses require in an ESM project and fails before it tests anything.
How 
handles it
ML.ai read package.json first, saw "type": "module", and wrote import-style tests.
The runWith ML.ai
npm testfailed, cause named
price.test.js7 passed
npm test goes red, and you cannot tell if the tests or the setup broke.
How 
handles it
ML.ai traced it to the script, ran the file directly (7 passed), and asked before fixing package.json.
formatPrice casesWith ML.ai
formatPrice(0)recorded
formatPrice(null)recorded
formatPrice(-250)recorded
A test records what the code does now, so a bug can become the expected result.
How 
handles it
The run covered 0, null and a negative price, and flagged the negative case as current behavior. Read those before merging.
What to expect, so nothing surprises you.
Which should I do?
ML.ai can list the proposed work and wait for your pick. Name what to cover to skip the round trip.
Also changing package.json
Editing a file it did not mention needs your OK.
If a check has no clear result, ML.ai shows a Verification notice. Run /ml-ai:proof to see what was checked.
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.
It reads package.json first, so it knows the module type and where tests go. It uses the runner you name.
You get the reason. When npm test failed on a bad script, it said so and ran the test file directly.
Only with your OK. When a turn needs a file it did not declare, ML.ai asks.

today, or talk to us about what is nextInstall the editor agent on your own machine, or book a call to talk through your team’s workloads