Skip to content

Make bypassing capture context-aware#447

Open
alexhall wants to merge 2 commits into
lambdaisland:mainfrom
alexhall:bypass-use-previous-writers
Open

Make bypassing capture context-aware#447
alexhall wants to merge 2 commits into
lambdaisland:mainfrom
alexhall:bypass-use-previous-writers

Conversation

@alexhall

@alexhall alexhall commented Sep 13, 2024

Copy link
Copy Markdown

This change makes the capture/bypass macro aware of the capture context in which it's running, so that it can more intelligently restore previous out/err writers (or just pass through if no capturing is active).

Unsupported corner cases:

  • Nested capturing (will write to the next level up, not the original out/err)
  • Code running on other threads where bindings weren't conveyed (will still write to the redef'ed out/err)

If this approach looks sensible, I'm happy to clean up the code, add tests, etc.

Fixes #446

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 69.21%. Comparing base (15e553d) to head (1a7a7ad).
⚠️ Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
src/kaocha/plugin/capture_output.cljc 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #447      +/-   ##
==========================================
+ Coverage   69.17%   69.21%   +0.04%     
==========================================
  Files          52       52              
  Lines        2819     2823       +4     
  Branches      187      187              
==========================================
+ Hits         1950     1954       +4     
  Misses        689      689              
  Partials      180      180              
Flag Coverage Δ
unit 69.21% <85.71%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Bypassing capture-output has unexpected behavior when running in REPL

1 participant