Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4268517

Browse filesBrowse files
geeksilva97marco-ippolito
authored andcommitted
test_runner: assert entry is a valid object
PR-URL: #55231 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 27564b7 commit 4268517
Copy full SHA for 4268517

File tree

Expand file treeCollapse file tree

2 files changed

+17
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+17
-1
lines changed
Open diff view settings
Collapse file

‎lib/internal/test_runner/test.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/test.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ class Test extends AsyncResource {
493493
const map = lazyFindSourceMap(this.loc.file);
494494
const entry = map?.findEntry(this.loc.line - 1, this.loc.column - 1);
495495

496-
if (entry !== undefined) {
496+
if (entry?.originalSource !== undefined) {
497497
this.loc.line = entry.originalLine + 1;
498498
this.loc.column = entry.originalColumn + 1;
499499
this.loc.file = entry.originalSource;
Collapse file
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
require('../common');
3+
const assert = require('node:assert');
4+
const { spawnSync } = require('node:child_process');
5+
const { test } = require('node:test');
6+
const fixtures = require('../common/fixtures');
7+
8+
test('ensures --enable-source-maps does not throw an error', () => {
9+
const fixture = fixtures.path('test-runner', 'coverage', 'stdin.test.js');
10+
const args = ['--enable-source-maps', fixture];
11+
12+
const result = spawnSync(process.execPath, args);
13+
14+
assert.strictEqual(result.stderr.toString(), '');
15+
assert.strictEqual(result.status, 0);
16+
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.