What the agent does
The agent clones the repository into its own cloud sandbox and reads the Jest setup. In a TypeScript library like sports-alliance/sports-lib, jest.config.js maps ^.+\\.(ts|tsx)$ to 'ts-jest' and ^.+\\.(js|jsx)$ to 'babel-jest' under transform, keeps fit-file-parser out of transformIgnorePatterns, maps node:buffer to the buffer package, sets testEnvironment to node, a 960000 ms testTimeout for the integration tests, and setupFilesAfterEnv to jest.setup.ts, which turns off unit stream generation for speed. The option the warning is about sits at the bottom: globals: { 'ts-jest': { babelConfig: true } }, which tells ts-jest to run its output through the babel.config.js beside it (@babel/preset-env targeting the current Node). package.json has jest at ^30.5.2, ts-jest at ^29.4.15, babel-jest at ^30.5.2 and typescript at ^6.0.3; the lock file resolves ts-jest to 29.4.15 and Jest to 30.5.2. The test script is NODE_OPTIONS=--experimental-vm-modules jest --forceExit, there are 204 .spec.ts files under src, and .github/workflows/test.yml runs npm ci, npm run test and npm run build on Node 24.
It installs with npm ci (521 packages) and runs one small spec rather than the whole suite to see the warning: the first lines of output are ts-jest[ts-jest-transformer] (WARN) Define ts-jestconfig underglobals is deprecated. Please do transform: { <transform_regex>: ['ts-jest', { /* ts-jest config goes here in Jest */ }], }, with a link to the ts-jest presets page, before the Jest Setup: line from jest.setup.ts and the passing test. The warning names its own fix, and it is printed at the top of the run before the first test's output, which on a 204-file suite is easy to miss in CI logs.
The change is the one the warning spells out. The TypeScript line of transform becomes the tuple ['ts-jest', { babelConfig: true }], and the globals block is deleted; every other key in the file stays as it is. The agent runs the same spec and a second one to confirm: no (WARN) line, 2 suites, 14 tests passing. It then runs the full npm run test as CI does, so the pull request carries the whole suite's summary and not only the two files used to prove the point.
It also checks that nothing else read the old location. globals is a Jest option that any test can read at runtime, so the agent greps src and jest.setup.ts for globals and ts-jest to be sure the block was configuration only, and reports the empty result. The pull request is a few lines in jest.config.js, with the warning quoted from before and the clean run after.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Jest in this repository prints \"ts-jest[ts-jest-transformer] (WARN) Define `ts-jest` config under `globals` is deprecated\". Read jest.config.js (or the jest key in package.json), package.json, the lock file and any Babel config first, and run one spec file to quote the warning. Move the ts-jest options from globals into the transform entry as the tuple ['ts-jest', { ...options }], keeping every option and every other Jest setting unchanged, and delete the globals block if nothing else is in it. Grep the source and setup files to confirm nothing reads those globals at runtime. Run the same spec to show the warning is gone, then the full test script as CI runs it, and open a pull request that quotes the warning before and the suite summary after.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is a pull request that changes jest.config.js only: the TypeScript transform entry carries { babelConfig: true } and the globals block is gone. The description quotes the (WARN) lines from the first run, the clean output of the same spec after the change, the full suite's summary, and the empty grep showing no test read globals['ts-jest'].
A reviewer compares the two option objects, sees that babelConfig: true moved and nothing was dropped, and merges. The run's record has the before and after test sessions, so the quoted output can be opened rather than trusted.
Run it on every terminal hand-off
You see the warning at the top of a test run and do not want to stop what you are doing. In the console, open the Project that has the repository, paste this prompt into the composer and start it; or send this body to POST /o/{org}/sessions with curl from your terminal, with a request_id that is a UUID v5 of the branch name so a repeated command returns the run already started, and follow it on GET /o/{org}/sessions/{id}/events.
The key's webhook_url receives run.completed or run.failed with the session URL when the run ends, and the pull request link is on the session.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
The fix is small; the proof is the full suite. On a 204-file suite with a 16-minute timeout for integration tests, nobody runs the whole thing on a laptop to confirm a config change, so the warning stays. The agent runs the suite in its own sandbox the way CI does, with npm ci and the exact test script, and the pull request carries the summary with the run's record behind it.
It is also a one-prompt job that fits between two other things. Hand it off from the terminal, keep working, and review a diff of a few lines with the before and after output attached, instead of switching branches to chase a warning that has been in the logs for weeks.
Frequently asked questions
Why did ts-jest move its options?
Jest's transform entries accept a tuple of transformer and options, and ts-jest reads its options from there so that each transform pattern can carry its own settings. The globals location was the older way and still works in ts-jest 29, which is why the suite passes with the warning. The agent keeps every option and changes only where it lives.
Will the babelConfig option still apply?
Yes. babelConfig: true moves into the tuple unchanged, and ts-jest still runs its output through the repository's babel.config.js. The agent runs specs after the change to show they still pass under the same transform.
I use the ts-jest preset instead of a transform entry. Does this apply?
A preset sets the transform for you, so the options go into an explicit transform entry that overrides the preset's, in the same tuple form. The agent reads whichever form the config uses and writes the tuple in the right place.
Does anything else read globals?
It can, since Jest exposes globals to tests at runtime, which is why the agent greps the source and setup files before deleting the block. In this repository nothing does; if a test did read it, the agent would keep that key and move only the ts-jest options.
More jobs like this: Hand off a long task
- Keep Supabase TypeScript Types in Sync With Your Migrations (Supabase)
- Harden Docker Compose Services with Read-Only Filesystems and Dropped Capabilities (Docker Compose)
- Turn a Jira Issue into a Pull Request for an ASP.NET Core App (ASP.NET Core)
- Turn a Jira Issue into a Pull Request for a Spring Boot App (Spring Boot)
- Run a Large Refactor on an Elixir Codebase (Elixir)
- Run a Large Refactor on a Go Codebase (Go)