Skip to content

chore: run every test suite with bun test - #60

Merged
jkasprzyk17 merged 2 commits into
mainfrom
chore/unify-test-runner-on-bun
Sep 11, 2026
Merged

chore: run every test suite with bun test#60
jkasprzyk17 merged 2 commits into
mainfrom
chore/unify-test-runner-on-bun

Conversation

@jkasprzyk17

@jkasprzyk17 jkasprzyk17 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Problem

package/jest.config.js pinned the runner to the config plugin:

roots: ['<rootDir>/plugin/src'],

So CI executed 2 of the 5 test files in the package. Everything under package/src/**/__tests__/ — the LRU cache, marker image resolution, descriptor normalisation — was silently skipped on every push, every PR and every release.

Pointing Jest at src is not an option: those suites import { … } from 'bun:test' and rely on mock.module(), which Jest has no equivalent for. The migration direction is forced toward Bun, and Bun runs the plugin suites unmodified — they only use the describe / expect / test globals, with no jest.* calls anywhere.

Two smaller gaps in the same area:

  • package/tsconfig.json excluded src/**/__tests__/**, so the test sources were never typechecked either. That exclude was hiding a real error (below).
  • typecheck:provider-types — the @ts-expect-error provider type tests in package/type-tests/ — had a script but no CI step, so it never ran either.

Fix

test and test:ci both become bun test; jest, ts-jest and @types/jest are dropped and jest.config.js deleted. @types/bun is added so bun:test resolves under tsc once the tests are in the compilation.

Removing the exclude surfaced exactly one pre-existing error, TS2345 in normalizeMarkerDescriptors.test.ts. The fixture was typed with the serialized descriptor from native/specs/overlays and then passed to a function that takes the public one from types/overlays; the two disagree on enteringAnimation (a { kind } descriptor object there, a false | 'system' | Config union here). Fixed on the test side by importing the public type and using satisfies, which keeps the literal checked without re-widening it. No production type was touched.

One consequence worth calling out, because it is not in the obvious blast radius: builder-bob resolves its own tsconfig, defaulting to tsconfig.json. With the exclude gone it happily emitted lib/typescript/overlays/__tests__/*.d.ts — test declarations, importing bun:test, into the published build. tsconfig.build.json already existed for exactly this purpose but nothing in the repo referenced it; it was dead config. It is now wired up via the target's project option and owns the exclude:

["typescript", { "project": "tsconfig.build.json" }]

Tests are therefore typechecked but never emitted. The resulting lib/typescript is file-for-file identical to main's (29 .d.ts, verified by diffing against a tsc run using main's config).

Finally, Typecheck provider types is added to both ci.yml and release.yml, and the lockfile is regenerated — CI runs bun install --frozen-lockfile, so a stale one breaks the build.

Verification

before after
test files executed 2 5
tests executed 32 50
test sources typechecked 0 5
provider type-tests in CI never ran runs
test .d.ts emitted into lib/ 0 0 (3 until the bob fix below)

All green on this branch:

command result
cd package && bun test 50 pass, 0 fail, 5 files, 77 assertions
bun run --filter react-native-better-maps test (the CI step, unchanged) 50 pass, 0 fail
bun run lint clean
bun run typecheck clean
bun run typecheck:provider-types clean
bun run build clean, output identical to main
bun install --frozen-lockfile no changes — lockfile is current
.release-it.json before:initbun run test:ci resolves, 50 pass
grep -rn jest package/ --include='*.json' --include='*.js' --include='*.ts' no matches

Remaining jest strings in bun.lock are transitive only (jest-worker, jest-validate, pretty-format via metro / react-native / @expo/metro-file-map).

Merge order matters — #58

I test-merged #58 into this branch. It conflicts in normalizeMarkerDescriptors.test.ts (that PR reworks the same file), and the resolution is straightforward — #58 deletes the round-trip assertion my cast was for, so the cast disappears and only the import/satisfies fix carries over.

The part that needs a decision: #58 keeps const baseDescriptor: MarkerDescriptor bound to the serialized type, and its new descriptorEquality.test.ts was written while the exclude was still hiding those files from tsc. On the merged tree, bun run typecheck reports 10 errors — 5 × TS2322: Type 'string' is not assignable to type 'OverlayEnteringAnimationKind' in descriptorEquality.test.ts, and 5 more in the reworked normalizeMarkerDescriptors.test.ts. None are caused by this PR; this PR is what makes CI see them. Whichever of the two lands second has to clear them.

The tests themselves are fine either way — the merged tree runs 129 pass / 0 fail across 7 files.

Not included

  • prettier --check in CI. 18 files fail on main today, including normalizeMarkerDescriptors.test.ts before I touched it — the lines Prettier still objects to there are ones this PR does not modify (the mock signature and the dynamic imports). It needs its own --write commit.
  • Native builds in CI (pod install / xcodebuild / gradlew).
  • Any assertion rewriting. The one test change is the type fix.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Jest was configured with `roots: ['<rootDir>/plugin/src']`, so CI only ever
executed the two Expo config-plugin suites. Everything under
`package/src/**/__tests__/` was silently skipped: those suites import from
`bun:test` and use `mock.module()`, which Jest has no equivalent for, so the
migration direction is forced toward Bun.

Point `test` and `test:ci` at `bun test`, drop jest/ts-jest/@types/jest and
the now-unused jest.config.js, and add @types/bun so `bun:test` resolves under
tsc.

Also stop hiding the test sources from the typechecker: `tsconfig.json` no
longer excludes `src/**/__tests__/**`, which surfaced a real pre-existing type
error in normalizeMarkerDescriptors.test.ts (it typed its fixture with the
serialized descriptor rather than the public one). The exclude moves to
`tsconfig.build.json` — which builder-bob now actually uses via the `project`
option — so test declarations stay out of lib/.

Finally, wire `typecheck:provider-types` into CI and release; those
`@ts-expect-error` type tests never ran either.
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

React Doctor found 6 issues in 3 files · 2 errors & 4 warnings · score 64 / 100 (Needs work) · full project

Errors

4 warnings

App.tsx

  • ⚠️ L727 Side effect inside a state updater function no-side-effect-in-state-updater-function
  • ⚠️ L732 Side effect inside a state updater function no-side-effect-in-state-updater-function
  • ⚠️ L733 Side effect inside a state updater function no-side-effect-in-state-updater-function

src/components/MapView.tsx

  • ⚠️ L31 React function has high control-flow complexity no-high-complexity-react-function

Reviewed by React Doctor for commit e00b95f. See inline comments for fixes.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 98ef08b7-f516-4320-9457-b2b66dbc9901

📥 Commits

Reviewing files that changed from the base of the PR and between 19cbbc4 and 95676ba.

📒 Files selected for processing (2)
  • package/package.json
  • package/src/overlays/__tests__/normalizeMarkerDescriptors.test.ts

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Summary

Summary by CodeRabbit

  • Tests

    • Migrated package testing from Jest to Bun.
    • Updated test configuration and type definitions for improved compatibility.
    • Ensured test files are included during validation while excluded from production builds.
    • Added additional provider-type checks to improve validation coverage.
  • Chores

    • Added provider-type checks to quality and release workflows.
    • Updated build configuration to produce cleaner package artifacts and improve release confidence.

Walkthrough

The package replaces Jest with Bun, updates TypeScript project inclusion, adjusts the Bob build target, and adds provider typechecking to CI and release workflows.

Changes

Bun and provider validation

Layer / File(s) Summary
Package testing and build configuration
package/package.json, package/tsconfig.json, package/tsconfig.build.json, package/src/overlays/__tests__/normalizeMarkerDescriptors.test.ts, package/jest.config.js
Test scripts now use Bun. Jest dependencies and configuration are removed. Build output excludes test directories, while the development TypeScript project includes them. The overlay test uses the public MarkerDescriptor type and updated test data.
Provider typecheck workflow gates
.github/workflows/ci.yml, .github/workflows/release.yml
CI quality checks and release checks now run bun run typecheck:provider-types after TypeScript typechecking.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 95676

The migration is ready to merge with normal checks.

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, uses the required chore: prefix, and accurately describes the main migration to Bun test execution.
Description check ✅ Passed The description directly explains the Bun test migration, TypeScript configuration changes, CI updates, and verification results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed No medium, high, or critical vulnerability is introduced. The reviewed diff changes CI commands, test configuration, TypeScript configuration, and dev-only dependencies. It does not add production dep…

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 25, 2026
@jkasprzyk17
jkasprzyk17 force-pushed the chore/unify-test-runner-on-bun branch from 95676ba to 956d2c6 Compare September 11, 2026 11:25
Resolve conflicts by keeping bun-only test scripts and carrying GeoJSON
markerColor/zIndex fixtures into the satisfies MarkerDescriptor fix.
@jkasprzyk17
jkasprzyk17 force-pushed the chore/unify-test-runner-on-bun branch from 956d2c6 to e00b95f Compare September 11, 2026 11:25
@jkasprzyk17
jkasprzyk17 merged commit 1602717 into main Sep 11, 2026
5 checks passed
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