Skip to content

bun test - don't send start events for skipped tests#22896

Merged
Jarred-Sumner merged 1 commit into
mainfrom
pfg/test-runner-start-event
Sep 23, 2025
Merged

bun test - don't send start events for skipped tests#22896
Jarred-Sumner merged 1 commit into
mainfrom
pfg/test-runner-start-event

Conversation

@pfgithub

Copy link
Copy Markdown
Contributor

No description provided.

@robobun

robobun commented Sep 23, 2025

Copy link
Copy Markdown
Collaborator
Updated 9:23 PM PT - Sep 22nd, 2025

@pfgithub, your commit 7182722 has 2 failures in Build #26654 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 22896

That installs a local version of the PR into your bun-22896 executable, so you can run:

bun-22896 --bun

@coderabbitai

coderabbitai Bot commented Sep 23, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Introduces early-return guards in onSequenceStarted and onEntryStarted to skip null callbacks, and updates onSequenceCompleted to set elapsed_ns to 0 when the sequence never started; otherwise uses sinceNow(). No exported/public declarations changed.

Changes

Cohort / File(s) Summary of changes
Execution flow guards and timing
src/bun.js/test/Execution.zig
Added early-return when sequence/entry callbacks are null; adjusted elapsed time: 0 if started_at is epoch, else sinceNow(); no exported/public API changes.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description is empty while the repository's template requires "What does this PR do?" and "How did you verify your code works?", so the description is incomplete and lacks the required context and verification details needed for review. Please populate the PR description using the repository template: briefly explain the change (e.g., skipping start events for skipped tests and the elapsed time handling) and provide verification details such as unit/integration tests run, manual reproduction steps, and relevant CI/test logs or links.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "bun test - don't send start events for skipped tests" is concise, focused on the primary behavioral change, and aligns with the changeset that adds early-return guards to avoid emitting start events for entries with null callbacks; it is clear and suitable for scanable history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pfg/test-runner-start-event

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/bun.js/test/Execution.zig (2)

490-491: Nit: unwrap the nested inline if for readability

Slightly clearer as a block.

-    if (sequence.test_entry) |entry| if (entry.callback == null) return;
+    if (sequence.test_entry) |entry| {
+        if (entry.callback == null) return;
+    }

505-506: Prevent stale timeouts: reset timespec for callback-null entries

If an entry was previously executed in a prior repeat/run, its timespec could carry over. Explicitly zero it for callback-null entries.

-fn onEntryStarted(_: *Execution, entry: *ExecutionEntry) void {
-    if (entry.callback == null) return;
+fn onEntryStarted(_: *Execution, entry: *ExecutionEntry) void {
+    if (entry.callback == null) {
+        entry.timespec = .epoch;
+        return;
+    }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 285143d and 7182722.

📒 Files selected for processing (1)
  • src/bun.js/test/Execution.zig (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/**/*.zig

📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)

Implement debug logs in Zig using const log = bun.Output.scoped(.${SCOPE}, false); and invoking log("...", .{})

Files:

  • src/bun.js/test/Execution.zig
**/*.zig

📄 CodeRabbit inference engine (.cursor/rules/javascriptcore-class.mdc)

**/*.zig: Declare the extern C symbol in Zig and export a Zig-friendly alias for use
Wrap the Bun____toJS extern in a Zig method that takes a JSGlobalObject and returns JSC.JSValue

**/*.zig: Format Zig files with zig-format (bun run zig-format)
In Zig, manage memory carefully with allocators and use defer for cleanup

Files:

  • src/bun.js/test/Execution.zig
src/bun.js/**/*.zig

📄 CodeRabbit inference engine (.cursor/rules/zig-javascriptcore-classes.mdc)

src/bun.js/**/*.zig: In Zig binding structs, expose generated bindings via pub const js = JSC.Codegen.JS and re-export toJS/fromJS/fromJSDirect
Constructors and prototype methods should return bun.JSError!JSC.JSValue to integrate Zig error handling with JS exceptions
Use parameter name globalObject (not ctx) and accept (*JSC.JSGlobalObject, *JSC.CallFrame) in binding methods/constructors
Implement getters as get(this, globalObject) returning JSC.JSValue and matching the .classes.ts interface
Provide deinit() for resource cleanup and finalize() that calls deinit(); use bun.destroy(this) or appropriate destroy pattern
Access JS call data via CallFrame (argument(i), argumentCount(), thisValue()) and throw errors with globalObject.throw(...)
For properties marked cache: true, use the generated Zig accessors (NameSetCached/GetCached) to work with GC-owned values
In finalize() for objects holding JS references, release them using .deref() before destroy

Files:

  • src/bun.js/test/Execution.zig
🧠 Learnings (1)
📚 Learning: 2025-08-30T00:13:36.815Z
Learnt from: CR
PR: oven-sh/bun#0
File: .cursor/rules/zig-javascriptcore-classes.mdc:0-0
Timestamp: 2025-08-30T00:13:36.815Z
Learning: Applies to src/bun.js/bindings/generated_classes_list.zig : Update src/bun.js/bindings/generated_classes_list.zig to include new classes

Applied to files:

  • src/bun.js/test/Execution.zig
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Format
🔇 Additional comments (2)
src/bun.js/test/Execution.zig (2)

519-519: Elapsed = 0 when never started — good

This keeps reporters consistent for skipped/todo/filtered tests and avoids negative/undefined durations.


490-491: Approve: guard prevents start events for skipped tests — verification passed

rg output shows reportTestStart is defined in src/bun.js/Debugger.zig and called only from src/bun.js/test/Execution.zig; src/cli/test_command.zig contains an empty handleTestStart stub. No other matches found.

@Jarred-Sumner Jarred-Sumner merged commit 68bdffe into main Sep 23, 2025
60 of 63 checks passed
@Jarred-Sumner Jarred-Sumner deleted the pfg/test-runner-start-event branch September 23, 2025 05:09
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.

3 participants