Skip to content

Replace jest, eslint, and prettier for consistency w/ other projects#515

Open
jhump wants to merge 5 commits into
jh/dep-upgradesfrom
jh/replace-jest-and-eslint
Open

Replace jest, eslint, and prettier for consistency w/ other projects#515
jhump wants to merge 5 commits into
jh/dep-upgradesfrom
jh/replace-jest-and-eslint

Conversation

@jhump

@jhump jhump commented Jun 16, 2026

Copy link
Copy Markdown
Member

This changes the repo over to using Node's builtin test runner, biome, and bufbuild/licenseheader to replace functionality previously provided by jest, eslint, and prettier. This brings it into alignment with bufbuild/protobuf and connectrpc/connect packages.

jhump and others added 5 commits June 16, 2026 10:43
Run tests with node:test via the tsx loader (matching protobuf-es), replacing
jest + ts-jest. ts-jest ran transpile-only, so type errors in test files went
unnoticed; add a tsc --noEmit typecheck step that covers the tests to close that
gap.

- Replace jest/ts-jest/@jest/globals with tsx. Rewrite test imports to
  node:test + node:assert/strict and convert every expect() matcher to assert.
- Convert the 9 inline snapshots in gateway/service.test.ts to file-based
  node:test snapshots (committed service.test.ts.snapshot), and convert the
  toThrowErrorMatchingInlineSnapshot checks to assert.rejects.
- Add tsconfig.test.json and a typecheck task wired into turbo and CI, covering
  src/**/*.ts (including tests).
- Rename src/jest to src/testing now that jest is gone.
Now that test files are type-checked (tsc --noEmit), add a compile-time
assertion that the GatewayServiceOptions `methods` option rejects
client-streaming and bidi-streaming method names. The @ts-expect-error
directives fail the typecheck if the filter (DescMethodUnary |
DescMethodServerStreaming) is ever loosened, closing the gap left when
UnaryAndServerStreamMethods was removed.
Adopt Biome for both linting and formatting, matching bufbuild/protobuf-es and
connectrpc/connect-es, and use @bufbuild/license-header for the license header
that eslint-plugin-notice previously enforced.

- Add @biomejs/biome 2.x with a biome.json mirroring the sibling rule set, plus
  @bufbuild/license-header. Remove eslint, typescript-eslint, prettier,
  eslint-plugin-notice, and the eslint-config-custom workspace package.
- Root scripts: lint = biome lint --error-on-warnings, format = biome format
  --write, license-header; wire the license-header --check into CI.
- Apply Biome's safe lint fixes (import type, Array.isArray, Number.isNaN,
  parseInt radix, arrow functions, literal keys) and reformat. Suppress
  noExplicitAny in the type-machinery files (scope/client/utils) where the
  any usage is intentional.

Biome's linter is not type-aware, so the type-aware eslint rules
(strict-boolean-expressions, no-unnecessary-condition, etc.) are no longer
enforced; tsc --noEmit (the typecheck task) still catches type errors.
"test": "NODE_OPTIONS=--experimental-vm-modules ../../node_modules/.bin/jest",
"test:watch": "pnpm run build:esm+types --watch & pnpm run test --watchAll",
"typecheck": "tsc --noEmit -p tsconfig.test.json",
"test": "tsx --test $(find src -type f -path '*.test.ts')",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be "test": "tsx --test 'src/**/*.test.ts'",, letting tsx/node expand the glob. All actively versions of Node.js support it. But we should bump the engine min constraint along with this change, and I didn't want to do that. find works well enough here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants