@@ -61,7 +61,7 @@ function findTest(locations, declaration) {
61
61
const range = ( start , end ) => Array . from ( { length : end - start + 1 } ) . fill ( start ) . map ( ( element , index ) => element + index ) ;
62
62
63
63
const translate = ( sourceMap , pos ) => {
64
- if ( sourceMap === undefined ) {
64
+ if ( sourceMap === null ) {
65
65
return pos ;
66
66
}
67
67
@@ -88,7 +88,7 @@ export default function lineNumberSelection({file, lineNumbers = []}) {
88
88
89
89
let locations = parse ( file ) ;
90
90
let lookedForSourceMap = false ;
91
- let sourceMap ;
91
+ let sourceMap = null ;
92
92
93
93
return ( ) => {
94
94
if ( ! lookedForSourceMap ) {
@@ -98,7 +98,13 @@ export default function lineNumberSelection({file, lineNumbers = []}) {
98
98
// Source maps are not available before then.
99
99
sourceMap = findSourceMap ( file ) ;
100
100
101
- if ( sourceMap !== undefined ) {
101
+ if ( sourceMap === undefined ) {
102
+ // Prior to Node.js 18.8.0, the value when a source map could not be found was `undefined`.
103
+ // This changed to `null` in <https://github.com/nodejs/node/pull/43875>.
104
+ sourceMap = null ;
105
+ }
106
+
107
+ if ( sourceMap !== null ) {
102
108
locations = locations . map ( ( { start, end} ) => ( {
103
109
start : translate ( sourceMap , start ) ,
104
110
end : translate ( sourceMap , end ) ,
0 commit comments