Skip to content

test(boy): mock the audio worklet in the element test - #6935

Merged
kixelated merged 1 commit into
mainfrom
fix/boy-element-worklet-mock
Oct 27, 2026
Merged

kixelated merged 1 commit into
mainfrom
fix/boy-element-worklet-mock

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Problem

js/moq-boy/src/element.test.ts (added in moq-dev/moq#6648) imports @moq/watch without mocking the audio decoder's render-worklet.ts?worklet import, which Bun cannot load. It passed only when game.test.ts ran first, since Bun's mock.module is process-wide. Bun orders files by directory scan, so the order depends on the checkout: when element.test.ts comes first, both files fail with Missing 'default' export in module '.../render-worklet.ts?worklet'.

This dequeued moq-dev/moq#6903 (merge group run 40579958993), and it fails any merge group whose diff selects @moq/boy on such a checkout. It reproduces on main with cd js/moq-boy && bun test; bun test ./src/game.test.ts ./src/element.test.ts passes.

Approach

Register the same worklet mock in element.test.ts, so each file stands alone. Running every JS test file in isolation found no other file with this dependency.

Impact

None (test only).

Alternatives

  • A bunfig.toml preload for @moq/boy, like demo/carla/web. It needs a test/ directory outside the package's rootDir: ./src, so it costs more than the one mock for two test files.

Follow-ups

None.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

The element test imported @moq/watch without mocking the `?worklet`
import, so it passed only when game.test.ts registered that mock first.
Bun orders test files by directory scan, so the merge queue fails
whenever a checkout lists element.test.ts first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T20:49:49.435548Z a08c6c5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated review by review (OpenAI)

Reviewed commit: a08c6c5

No actionable bugs found. Registering the same narrow worklet mock before the dynamic element import removes the dependency on game.test.ts running first while preserving the existing invalid-prefix assertions. This is a proportionate test-only fix; a shared preload would add unnecessary setup for these two files.

Verification: Static inspection of the changed test, companion game test, element import path and audio decoder's worklet interface. I did not run tests or independently reproduce the file-order failure.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4a516fab-4e26-466f-ba8e-cd45e988ec43
Commits

Reviewing files that changed from the base of the PR and between 9af4141 and a08c6c5.

Files selected for processing: 1
  • js/moq-boy/src/element.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

Walkthrough

The test setup adds a mock for the audio render-worklet import. The mock asynchronously resolves to "blob:fake-render".

Priority: Normal

Merge Risk: Minimal · up to a08c6

The test setup removes the file-order dependency without introducing a known merge risk.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: adding an audio worklet mock to the element test.
Description check Passed The description directly explains the test failure, the worklet mock solution, and the test-only impact.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
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.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@kixelated

Copy link
Copy Markdown
Collaborator Author

Landing a08c6c5: a test-only fix that registers the audio worklet mock in element.test.ts before the element import, so it no longer depends on game.test.ts running first. Codex reviewed this head with no findings. The maintainer approved jumping it to the front of the merge queue, since the order-dependent failure knocked other PRs out of the queue.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit db1d8d6 Oct 27, 2026
10 checks passed
@kixelated
kixelated deleted the fix/boy-element-worklet-mock branch October 27, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant