Skip to content

Commit

Permalink
[Tests] handle v8 6.9 changing an error message
Browse files Browse the repository at this point in the history
Fixes #562
  • Loading branch information
ljharb committed Sep 6, 2021
1 parent 5a5a574 commit bfeabe8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/async-await.js
Expand Up @@ -12,6 +12,13 @@ if (Number(majorVersion) < 8) {
process.exit(0); // eslint-disable-line no-process-exit
}

var lengthMessage = 'Cannot read property \'length\' of null';
try {
lengthMessage = null.length;
} catch (e) {
lengthMessage = e.message; // differs in v8 6.9+ (node 16.9+)
}

tap.test('async1', function (t) {
runProgram('async-await', 'async1.js', function (r) {
t.deepEqual(stripFullStack(r.stdout.toString('utf8')), [
Expand Down Expand Up @@ -267,11 +274,11 @@ tap.test('async-bug', function (t) {
'# async-error',
'ok 1 before throw',
'ok 2 should be strictly equal',
'not ok 3 TypeError: Cannot read property \'length\' of null',
'not ok 3 TypeError: ' + lengthMessage,
' ---',
' operator: error',
' stack: |-',
' TypeError: Cannot read property \'length\' of null',
' TypeError: ' + lengthMessage,
' at myCode ($TEST/async-await/async-bug.js:$LINE:$COL)',
' at Test.myTest ($TEST/async-await/async-bug.js:$LINE:$COL)',
' ...',
Expand Down

0 comments on commit bfeabe8

Please sign in to comment.