Skip to content

Commit 2c25ca7

Browse files
committed
test_runner: add test location for FileTests
This commit adds the previously missing test location for FileTest tests. Fixes: nodejs/node#49926 Fixes: nodejs/node#49927 PR-URL: nodejs/node#49999 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent ad9cae4 commit 2c25ca7

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

graal-nodejs/lib/internal/test_runner/runner.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ class FileTest extends Test {
185185
#rawBufferSize = 0;
186186
#reportedChildren = 0;
187187
failedSubtests = false;
188+
189+
constructor(options) {
190+
super(options);
191+
this.loc ??= {
192+
__proto__: null,
193+
line: 1,
194+
column: 1,
195+
file: resolve(this.name),
196+
};
197+
}
198+
188199
#skipReporting() {
189200
return this.#reportedChildren > 0 && (!this.error || this.error.failureType === kSubtestsFailed);
190201
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
const common = require('../common');
3+
const fixtures = require('../common/fixtures');
4+
const { strictEqual } = require('node:assert');
5+
const { relative } = require('node:path');
6+
const { run } = require('node:test');
7+
const fixture = fixtures.path('test-runner', 'never_ending_sync.js');
8+
const relativePath = relative(process.cwd(), fixture);
9+
const stream = run({
10+
files: [relativePath],
11+
timeout: common.platformTimeout(100),
12+
});
13+
14+
stream.on('test:fail', common.mustCall((result) => {
15+
strictEqual(result.name, relativePath);
16+
strictEqual(result.details.error.failureType, 'testTimeoutFailure');
17+
strictEqual(result.line, 1);
18+
strictEqual(result.column, 1);
19+
strictEqual(result.file, fixture);
20+
}));

0 commit comments

Comments
 (0)