Skip to content

Commit 6539c64

Browse files
Trottrvagg
authored andcommitted
test: scope redeclared variable
`test-assert.js` redeclares a variable with `var`. This change converts it to a `const` declaration and wraps it in a standalone block to scope it to just the test that uses it. PR-URL: #4854 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]>
1 parent 62479e3 commit 6539c64

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

test/parallel/test-assert.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ assert.throws(makeBlock(a.deepEqual, /a/i, /a/));
7373
assert.throws(makeBlock(a.deepEqual, /a/m, /a/));
7474
assert.throws(makeBlock(a.deepEqual, /a/igm, /a/im));
7575

76-
var re1 = /a/;
77-
re1.lastIndex = 3;
78-
assert.throws(makeBlock(a.deepEqual, re1, /a/));
76+
{
77+
const re1 = /a/;
78+
re1.lastIndex = 3;
79+
assert.throws(makeBlock(a.deepEqual, re1, /a/));
80+
}
7981

8082

8183
// 7.4
@@ -172,10 +174,11 @@ assert.throws(makeBlock(a.deepStrictEqual, /a/i, /a/));
172174
assert.throws(makeBlock(a.deepStrictEqual, /a/m, /a/));
173175
assert.throws(makeBlock(a.deepStrictEqual, /a/igm, /a/im));
174176

175-
var re1 = /a/;
176-
re1.lastIndex = 3;
177-
assert.throws(makeBlock(a.deepStrictEqual, re1, /a/));
178-
177+
{
178+
const re1 = /a/;
179+
re1.lastIndex = 3;
180+
assert.throws(makeBlock(a.deepStrictEqual, re1, /a/));
181+
}
179182

180183
// 7.4 - strict
181184
assert.throws(makeBlock(a.deepStrictEqual, 4, '4'),

0 commit comments

Comments
 (0)