Skip to content

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

Open
jkasprzyk17 wants to merge 1 commit into
mainfrom
chore/unify-test-runner-on-bun
Open

chore: run every test suite with bun test#60
jkasprzyk17 wants to merge 1 commit 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

Copy link
Copy Markdown

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

Errors

6 warnings

App.tsx

  • ⚠️ L729 Side effect inside a state updater function no-side-effect-in-state-updater-function
  • ⚠️ L734 Side effect inside a state updater function no-side-effect-in-state-updater-function
  • ⚠️ L735 Side effect inside a state updater function no-side-effect-in-state-updater-function

package.json

  • ⚠️ L0 unused-dev-dependency

src/hooks/index.ts

  • ⚠️ L0 unused-file

src/utils/enteringAnimation.ts

  • ⚠️ L33 unused-export

Reviewed by React Doctor for commit 19cbbc4. See inline comments for fixes.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b4635f43-55ea-4153-badd-57c0059cb405

📥 Commits

Reviewing files that changed from the base of the PR and between 1c38c93 and 19cbbc4.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • .github/workflows/ci.yml
  • .github/workflows/release.yml
  • package/jest.config.js
  • package/package.json
  • package/src/overlays/__tests__/normalizeMarkerDescriptors.test.ts
  • package/tsconfig.build.json
  • package/tsconfig.json
💤 Files with no reviewable changes (1)
  • package/jest.config.js

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.


📝 Walkthrough

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.
  • 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 for testing, updates TypeScript build 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.
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.

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

Merge Risk: ⚪ Minimal · up to 19cbb

The PR switches package testing and CI coverage to Bun, adds test typechecking, and keeps test declarations out of published output; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: piotr-graczyk-dev

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required PR type prefix, stays under 50 characters, and accurately summarizes the migration to Bun-based test execution.
Description check ✅ Passed The description is directly related to the changes. It explains the Jest-to-Bun migration, test typechecking, build configuration, CI updates, lockfile status, 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 high-confidence security vulnerability was introduced. The diff only changes test tooling, TypeScript build configuration, and adds static provider typechecks to CI and release workflows. The new w…
Full details: Docstring Coverage

Explanation

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 files. (5 skipped: 5 unsupported.)

Full details: Security Check

Explanation

No high-confidence security vulnerability was introduced. The diff only changes test tooling, TypeScript build configuration, and adds static provider typechecks to CI and release workflows. The new workflow commands use no attacker-controlled interpolation and do not access secrets. @types/bun is a devDependency; its lockfile entries resolve to bun-types and @types/node, with no production dependency or runtime sink. The modified test only changes type imports and assertions. No added code creates an injection, auth, secret-leakage, network, filesystem, or dynamic-code path.

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


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

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.

1 participant