Skip to content

test_runner: add getTestContext() public API - #62501

Merged
nodejs-github-bot merged 1 commit into
mainfrom
expose-global-get-test-context
Apr 1, 2026
Merged

test_runner: add getTestContext() public API#62501
nodejs-github-bot merged 1 commit into
mainfrom
expose-global-get-test-context

Conversation

@MoLow

@MoLow MoLow commented Mar 30, 2026

Copy link
Copy Markdown
Member

Exposes getTestContext() function to access test context information from within tests and async operations.

My use case was exposing a pino logger that writes to test diagnostics, but there can be many other usecases:

import { prettyFactory } from 'pino-pretty';

const pretty = prettyFactory({ colorize: true  });
const asyncId = executionAsyncId();
const t = testResources.get(asyncId);
t.diagnostic(pretty(obj).replace(/\n$/, ''));

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. backport-requested-v24.x PRs awaiting manual backport to the v24.x-staging branch. needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants