A tiny script that sends a source file to the Codex SDK and saves generated Jest tests.
- Install deps:
npm install - Add your OpenAI key to
.envasOPENAI_API_KEY=...
node index.js "Write Jest tests for the add function"- The script reads
./sample/calculator.jsand writes tests to./tests/calculator.test.js. - Output is minimal: it logs start, completion, and the path of the written test file.
- Update the prompt argument to change what you ask Codex to generate.
- If you want to silence the Node ESM warning, add
"type": "module"topackage.json.