Commit c48b26c95d9 for nodejs

commit c48b26c95d965f996088df22807d3d60a667c061
Author: sangwook <rewq5991@gmail.com>
Date:   Mon Nov 16 18:47:39 2026 +0900

    test_runner: add tags and workerId to SuiteContext

    TestContext exposes tags and workerId, but SuiteContext does not, so a
    describe() callback cannot read the suite's tags, including the ones
    inherited from ancestor suites. Expose both on SuiteContext as well.

    Signed-off-by: sangwook <rewq5991@gmail.com>
    PR-URL: https://github.com/nodejs/node/pull/67312
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
    Reviewed-By: Moshe Atlow <moshe@atlow.co.il>

diff --git a/doc/api/test.md b/doc/api/test.md
index 01703227f8c..d3badba70bd 100644
--- a/doc/api/test.md
+++ b/doc/api/test.md
@@ -5139,6 +5139,32 @@ The attempt number of the suite. This value is zero-based, so the first attempt
 the second attempt is `1`, and so on. This property is useful in conjunction with the
 `--test-rerun-failures` option to determine the attempt number of the current run.

+### `context.tags`
+
+<!-- YAML
+added: REPLACEME
+-->
+
+> Stability: 1.0 - Early development
+
+* Type: {string\[]}
+
+A frozen array of the suite's flattened lowercased tags, in declaration
+order, including any tags inherited from ancestor suites. Empty when the
+suite has no tags. See [Test tags][].
+
+### `context.workerId`
+
+<!-- YAML
+added: REPLACEME
+-->
+
+* Type: {number|undefined}
+
+The unique identifier of the worker running the current test file. This value
+is derived from the `NODE_TEST_WORKER_ID` environment variable, and is
+`undefined` when not running in a test context.
+
 ### `context.diagnostic(message)`

 <!-- YAML
diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js
index 1b0956e4253..b0db6c3bc7e 100644
--- a/lib/internal/test_runner/test.js
+++ b/lib/internal/test_runner/test.js
@@ -536,6 +536,15 @@ class SuiteContext {
     return this.#suite.attempt ?? 0;
   }

+  get tags() {
+    return this.#suite.tags;
+  }
+
+  get workerId() {
+    const envWorkerId = process.env.NODE_TEST_WORKER_ID;
+    return Number(envWorkerId) || undefined;
+  }
+
   diagnostic(message) {
     this.#suite.diagnostic(message);
   }
diff --git a/test/fixtures/test-runner/worker-id/test-1.mjs b/test/fixtures/test-runner/worker-id/test-1.mjs
index 7e6f40f2b18..1458e2f45ea 100644
--- a/test/fixtures/test-runner/worker-id/test-1.mjs
+++ b/test/fixtures/test-runner/worker-id/test-1.mjs
@@ -1,4 +1,4 @@
-import { test } from 'node:test';
+import { describe, test } from 'node:test';

 test('worker ID is available as environment variable', (t) => {
 	const workerId = process.env.NODE_TEST_WORKER_ID;
@@ -24,3 +24,9 @@ test('worker ID is available via context', (t) => {
 		throw new Error(`context.workerId (${workerId}) should match NODE_TEST_WORKER_ID (${envWorkerId})`);
 	}
 });
+
+describe('worker ID is available via suite context', (s) => {
+	if (s.workerId !== Number(process.env.NODE_TEST_WORKER_ID)) {
+		throw new Error(`suite context.workerId (${s.workerId}) should match NODE_TEST_WORKER_ID (${process.env.NODE_TEST_WORKER_ID})`);
+	}
+});
diff --git a/test/parallel/test-runner-tags-inheritance.mjs b/test/parallel/test-runner-tags-inheritance.mjs
index 0285ad97b67..703e4021606 100644
--- a/test/parallel/test-runner-tags-inheritance.mjs
+++ b/test/parallel/test-runner-tags-inheritance.mjs
@@ -46,6 +46,23 @@ test('multi-level nesting flattens by union', () => {
   });
 });

+test('suite context exposes inherited tags', () => {
+  describe('outer', { tags: ['a'] }, () => {
+    describe('mid', { tags: ['b'] }, (s) => {
+      assert.deepStrictEqual(s.tags, ['a', 'b']);
+    });
+  });
+});
+
+test('child tags do not leak into the suite context', () => {
+  describe('suite', { tags: ['a'] }, (s) => {
+    it('child', { tags: ['b'] }, (t) => {
+      assert.deepStrictEqual(t.tags, ['a', 'b']);
+      assert.deepStrictEqual(s.tags, ['a']);
+    });
+  });
+});
+
 test('child without own tags inherits parent set unchanged', () => {
   describe('outer', { tags: ['db', 'fast'] }, () => {
     it('child', (t) => {