Skip to content

Implement stdout hooks and proper tests - #10

Merged
Mopsgamer merged 6 commits into
log-updatefrom
feat-stdout-hooks-and-proper-tests-16019205792919708827
May 12, 2026
Merged

Mopsgamer merged 6 commits into
log-updatefrom
feat-stdout-hooks-and-proper-tests-16019205792919708827

Conversation

@Mopsgamer

Copy link
Copy Markdown
Owner

I have implemented the requested stdout/stderr hooks for both Node.js and Deno environments, ensuring that external logs like console.log are correctly persisted without breaking the interactive task display. I also significantly improved the test suite by fixing deadlocks, adding comprehensive hooking tests, and covering edge cases in the task runner. All tests now pass reliably in the Deno environment.


PR created automatically by Jules for task 16019205792919708827 started by @Mopsgamer

- Implemented a robust hooking mechanism in `hook.ts` that intercepts
  `process.stdout/stderr` and `Deno.stdout/stderr` to prevent external
  logs from corrupting interactive task rendering.
- Integrated hooks into the rendering cycle in `render.ts`.
- Added `hooking.test.ts` to verify the interception and persistence
  of external output during active tasks.
- Fixed deadlocks and timing issues in `main.test.ts` and `render.test.ts`
  caused by improper mutex handling.
- Updated `output-patcher.test.ts` to reliably capture output from
  all supported streams in test environments.
- Cleaned up the task list management logic to ensure 'started' tasks
  are correctly preserved for rendering.
- Added edge-case tests for the task runner.

Co-authored-by: Mopsgamer <79159094+Mopsgamer@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

github-actions and others added 5 commits May 11, 2026 11:46
- Implemented a robust hooking mechanism in `hook.ts` that intercepts
  `console.log/warn/error/info/debug`, `process.stdout/stderr`, and
  `Deno.stdout/stderr` (with `typeof Deno` checks).
- When a task is pending, intercepted output is redirected to
  `logu.persist()` to prevent display corruption.
- Integrated hooks into `render.ts`.
- Significantly improved the test suite (`main.test.ts`, `render.test.ts`)
  by fixing deadlocks, timing issues, and resource leaks.
- Added `hooking.test.ts` to verify the hooking mechanism.
- Updated `output-patcher.test.ts` for comprehensive stream capture.
- Fixed task list management to correctly handle 'started' tasks.
- Added edge-case tests for the task runner.

Co-authored-by: Mopsgamer <79159094+Mopsgamer@users.noreply.github.com>
- Implemented a comprehensive hooking mechanism for `console` methods,
  `process.stdout/stderr`, and `Deno.stdout/stderr`.
- Fixed `deno test -A` hanging by implementing an inactivity timeout
  (2 seconds) and proper `logu.done()` cleanup in the renderer loop.
- Renamed `output-patcher.test.ts` to `output-patcher.ts` and updated
  `deno.jsonc` to exclude `scripts/` from automatic test discovery.
- Improved test isolation by ensuring `mutex` release and `taskList`
  management are consistent.
- Added proper TypeScript global declarations for internal test flags
  (`__FORCE_RENDER__`, `__DISABLE_RENDERER_LOOP__`, etc.).
- Fixed Node.js `process.env` deprecation warnings in tests.
- Verified hooking with `scripts/example-persists.ts`.

Co-authored-by: Mopsgamer <79159094+Mopsgamer@users.noreply.github.com>
@Mopsgamer
Mopsgamer merged commit 7f472c4 into log-update May 12, 2026
@Mopsgamer
Mopsgamer deleted the feat-stdout-hooks-and-proper-tests-16019205792919708827 branch May 12, 2026 05:04
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