Skip to content

v8.0.0-rc.18-dev.15

@StevenMcClankerton StevenMcClankerton tagged this 16 Oct 15:36
## Linked issue

n/a. This continues the test-suite audit from #30729.

## At a glance

This is a typical removal, from
`packages/1-framework/3-tooling/migration/test/find-path-with-invariants.test.ts`:

```ts
-  it('unreachable target → null', () => {
-    const graph = reconstructGraph([pkg('A', 'B', 'm1')]);
-    expect(findPathWithInvariants(graph, 'A', 'Z', new Set(['X']))).toBeNull();
-  });
```

The same file keeps a test with an identical body, at line 145:

```ts
  it('returns null when target is structurally unreachable', () => {
    const graph = reconstructGraph([pkg('A', 'B', 'm1')]);
    expect(findPathWithInvariants(graph, 'A', 'Z', new Set(['X']))).toBeNull();
  });
```

## Summary

This is the second batch from the test audit. It removes 945 `it`/`test`
declarations from package, example, app and script tests. It changes
only test files: no production code, no `src/`, and nothing in the
integration suite.

## Decision

The batch takes only the audit entries that are both rated
high-confidence and marked "remove". It includes two kinds of test:

- **Redundant:** another test makes the same assertion through the same
code path.
- **Trivial:** a type test that restates a declared type; a test that
compares an id, kind, capability flag or constant with its own literal;
a getter test that reads back a constructor argument; a "hook is a
function" or `toBeDefined` check; or a test of a test-only helper.

It does not include:

- unreachable-input entries, because each one needs a judgement about
whether the input can actually happen;
- integration tests;
- anything that would need a test rewritten or production code changed.

The audit was written against an older `main`, so every entry was
checked again against current code. A test was removed only when the
test it duplicates still asserts the same thing or more. About 90
entries were skipped in whole or in part: the test had already gone, the
kept test turned out to check less, or the removed test was the only
check of some behaviour.

## Reviewer notes

- There is one commit per package area: sql, tooling, adapters and
drivers, cli, targets, framework and mongo, and extensions and examples.
Each commit can be reviewed or reverted on its own.
- Some removals are partial. In a few tests, one duplicated assertion
was dropped and the rest of the test stays:
  - the second "reprint stability" `verify` in `check-lifecycle-e2e`;
- redundant `.not.toEqualTypeOf<number | string>()` lines in the example
type tests.

Three tests were renamed after an assertion was dropped, so that the
name matches what the test still checks.
- 18 files are deleted outright. In each of them, every test was either
a duplicate or a restatement. Examples:
  - `default-functions.test.ts`;
  - the `codec-factory*` tests of the test-only `defineTestCodec`;
  - `is-ci.test.ts`;
  - the mongo and sqlite `create-*-control-client` tests;
  - several `*.test-d.ts` files that restate declared types.
- Test-only helpers and fixtures that became unused were removed with
the tests that used them, for example
`test/fixtures/exact-prefix-import.ts` in the CLI.

## Testing performed

All on the final HEAD:

- `pnpm build`, `pnpm lint` and `pnpm lint:deps` pass.
- `pnpm typecheck` passes, except `prisma7-adoption#typecheck`, which
cannot download the Prisma 7 schema-engine binary for `linux-nixos`
(404) in this environment.
- `pnpm coverage:packages` ran 24,844 passed, 40 failed and 36 skipped.
Then `pnpm coverage:report` gave 0 threshold failures; the 6 warnings
are all packages already on the warning-only list. The 40 failures are
in files this PR does not change:
- 39 are environment-specific: CLI `init-prisma7*` tests (`EACCES`
copying fixtures), and the tarball and `module-identity` tests (pnpm
trust policy on `@vercel/detect-agent`).
- 1 is `no-parallel-ci-detection`, which hit its 500 ms timeout under
load and passes when run alone.
- The language-server, cli-telemetry and postgres-adapter round-trip
suites also timed out during the parallel run. Each passes in full when
run alone.
- The example tests in mongo-demo, prisma-8-demo and retail-store pass,
and so does `pnpm test:scripts`.
- `apps/telemetry-backend` `handler.test.ts` fails here because
`ingestedAt` comes back as a `Temporal.Instant` where the test expects a
`Date`. This PR does not change that test or that app's source; the only
file it touches in the app is `rate-limit.test.ts`.

## Skill update

n/a — internal only.

## Alternatives considered

- **Include the unreachable-input and medium-confidence entries.** Left
for a later batch. They need a judgement call on each test, while this
batch is limited to deletions that can be checked directly against the
code.
- **Rewrite per-value test groups as table-driven tests.** Not done
here, for example the 36 `1-core/errors` factory tests. A rewrite
changes what each test asserts and needs its own review.

## Checklist

- [x] All commits are signed off (`git commit -s`) per the
[DCO](../CONTRIBUTING.md#developer-certificate-of-origin-dco).
- [x] I read [CONTRIBUTING.md](../CONTRIBUTING.md) and the change is
scoped to one logical concern.
- [x] Tests are updated.
- [ ] The PR title is in `TML-NNNN: <sentence-case title>` form. No
Linear ticket exists for this work.
- [x] The **Skill update** section above is filled in.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Steven McClankerton <tatarintsev@prisma.io>
Co-authored-by: Steven McClankerton <tatarintsev@prisma.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Assets 2
Loading