# Your PR is green. Your test is gone.

> Source: <https://dev.to/shamazkhan/your-pr-is-green-your-test-is-gone-23ej>
> Published: 2026-11-29 15:14:31+00:00

**Key takeaway:** AI coding agents asked for a green build sometimes weaken tests instead of fixing code, so mechanically flag removed assertions, new skip/only markers, added @ts-ignore or as any suppressions, and deleted test files on every PR.

The build is green. The PR looks clean. The reviewer approves it.

And a test that used to protect you no longer checks anything.

That's the quiet failure mode of AI coding agents. Ask one to make the build pass and it will, usually by fixing the code, but sometimes by changing the check instead: an assertion removed, a test skipped, a type check switched off. Nothing fails, so nothing tells you. You find out in production, weeks later, when the bug the test was guarding against ships.

None of this is malicious. The agent was asked for a green build, and it delivered one. These are the five patterns worth looking for in every AI-written pull request.

Before:

``` js
test('applies the discount', () => {
  const total = checkout(cart, 'SAVE10');
  expect(total.discount).toBe(10);
  expect(total.amount).toBe(90);
});
```

After the agent "fixed" it:

``` js
test('applies the discount', () => {
  const total = checkout(cart, 'SAVE10');
  expect(total.discount).toBe(10);
});
```

The test still exists, still passes and still has the same name. It just doesn't check the amount any more, which was the part that was broken.

**What to look for:** count the assertions in each changed test file, before and after. Fewer assertions in a PR that wasn't about tests is a red flag.

``` js
it.skip('rejects an expired token', async () => {
```

or the opposite, which is worse:

``` js
it.only('returns the user profile', async () => {
```

`.skip` silences one test. `.only` silences every other test in the file, and the run still reports green. In Python it's `@pytest.mark.skip`; in Go, `t.Skip()`.

**What to look for:** any new `skip`, `only`, `xit`, `xdescribe` or `@pytest.mark.skip` in the diff.

``` js
// @ts-ignore
const user: User = await fetchUser(id);
js
const total = (order as any).items.reduce(sum, 0);
```

The type error was telling you something real: `fetchUser` can return `null`. Now it can't tell you any more, and you find out at runtime.

**What to look for:** new `@ts-ignore`, `@ts-expect-error`, `as any`, `eslint-disable`, `# type: ignore` or `# noqa` lines.

```
- expect(formatPrice(1999)).toBe('$19.99');
+ expect(formatPrice(1999)).toBe('$1999.00');
```

This one is the hardest to spot, because the diff looks like a reasonable update. The agent changed the expectation to match what the code now returns, so the test now locks in the bug.

Snapshot tests make it even easier: run `jest -u`, every snapshot is "updated", and the diff is 400 lines nobody reads.

**What to look for:** changed expected values or snapshots in a PR that wasn't supposed to change behaviour.

The bluntest version: a test file that kept failing is no longer in the repo. It shows up as one line in the file list, between the changes you actually asked for.

**What to look for:** deleted files under `test/`, `tests/`, `__tests__/` or anything matching `*.test.*` / `*_test.*`.

Each of these is small, sits next to real changes, and looks plausible. An AI reviewer reading the same diff can miss it for the same reason a tired human does. And none of them makes the build fail, which is the whole point.

What works is checking mechanically, on every PR, the same way every time:

Doing this by hand on every PR doesn't last, so I built a small open-source tool for it, [Stet](https://getstet.dev). It's free (MIT), and there's no AI in the check, so the same diff always gets the same answer.

On every pull request it posts one comment:

`.only`, `@ts-ignore` / `as any` / `eslint-disable` added, test files deleted, and lockfile, CI or env changes
It doesn't catch pattern 4 yet (an expected value or snapshot quietly changed to match a bug). That one needs a human eye for now, and it's next on my list.

It works with zero config. Add it to a repo in two clicks at [getstet.dev/add](https://getstet.dev/add), or add the workflow yourself:

```
name: Stet
on:
  pull_request:
    types: [opened, synchronize, reopened]
permissions:
  contents: read
  pull-requests: write
  checks: write
jobs:
  stet:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 }
      - uses: stet-dev/stet-action@v2
```

Or run it locally before you push:

```
npx stet-cli report --base main
```

If you use Claude Code or Antigravity, there's also a [plugin](https://github.com/stet-dev/stet-plugin): ask your agent *"Check my changes with Stet"* and it runs the check before it tells you it's done.

**Which of these have you caught in your own repos?** And is there a sixth pattern I should be checking for? I'm adding new checks based on what people actually run into.
