Commit 19cb3948967 for nodejs

commit 19cb3948967843d03b281dcb7b130d53b5d9d89d
Author: Moshe Atlow <moshe@atlow.co.il>
Date:   Mon Nov 16 11:26:47 2026 +0200

    test_runner: resolve entryFile against the cwd option

    The location of a test file run in a child process was resolved
    against `process.cwd()`, so `run()` reported a wrong `entryFile` for
    relative paths when called with a different `cwd`.

    Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
    PR-URL: https://github.com/nodejs/node/pull/67512
    Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
    Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>

diff --git a/lib/internal/test_runner/runner.js b/lib/internal/test_runner/runner.js
index b37198df6d7..6edb25fcc7a 100644
--- a/lib/internal/test_runner/runner.js
+++ b/lib/internal/test_runner/runner.js
@@ -305,7 +305,7 @@ class FileTest extends Test {
       __proto__: null,
       line: 1,
       column: 1,
-      file: resolve(this.name),
+      file: resolve(this.config.cwd, this.name),
     };
     this.timeout = null;
   }
diff --git a/test/parallel/test-runner-entry-file.mjs b/test/parallel/test-runner-entry-file.mjs
index 94750e6a745..9b630453825 100644
--- a/test/parallel/test-runner-entry-file.mjs
+++ b/test/parallel/test-runner-entry-file.mjs
@@ -48,6 +48,19 @@ describe('entryFile attribution in reporter events', { concurrency: false }, ()
     assert.strictEqual(backupB.data.entryFile, bPath);
   });

+  it('resolves entryFile against the cwd option', async () => {
+    const events = await collectEvents({
+      isolation: 'process',
+      cwd: fixtures.path('test-runner', 'entry-file'),
+      files: ['a.test.mjs', 'b.test.mjs'],
+    });
+    const pass = events.filter(({ type }) => type === 'test:pass');
+    const backupA = pass.find(({ data }) => data.name === 'backup A');
+    const backupB = pass.find(({ data }) => data.name === 'backup B');
+    assert.strictEqual(backupA.data.entryFile, aPath);
+    assert.strictEqual(backupB.data.entryFile, bPath);
+  });
+
   it('does not stamp entryFile with isolation none', async () => {
     const events = await collectEvents({ isolation: 'none' });
     for (const { data } of events) {
diff --git a/test/parallel/test-runner-v8-deserializer.mjs b/test/parallel/test-runner-v8-deserializer.mjs
index f376ca6edb8..b0ca5eb7d3f 100644
--- a/test/parallel/test-runner-v8-deserializer.mjs
+++ b/test/parallel/test-runner-v8-deserializer.mjs
@@ -91,7 +91,7 @@ describe('v8 deserializer', common.mustCall(() => {
     reported = [];
     fileTest = new runner.FileTest({
       name: 'filetest',
-      harness: { config: {} },
+      harness: { config: { cwd: process.cwd() } },
     });
     fileTest.reporter.on('data', (data) => reported.push(data));
     assert(fileTest.isClearToSend());