Skip to content

Commit 9aae4f2

Browse files
silverwindalexlamsl
authored andcommitted
make tests compatible with Node.js 12 (#3304)
In Node.js 12, the formatting of console arguments will change slightly. Previously, a string other than the first argument was formatted using single quotes if the first argument was non-string. Now, quotes are never added regardless of position of a string argument. To make test compatible in all Node.js versions, I work around by ensuring the first argument to console.log is a string which prevents the quotes from being added on older versions of Node.js. Ref: nodejs/node#23162
1 parent 008c236 commit 9aae4f2

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

test/compress/evaluate.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,12 +1245,12 @@ self_comparison_1: {
12451245
}
12461246
input: {
12471247
var o = { n: NaN };
1248-
console.log(o.n == o.n, o.n === o.n, o.n != o.n, o.n !== o.n, typeof o.n);
1248+
console.log(typeof o.n, o.n == o.n, o.n === o.n, o.n != o.n, o.n !== o.n);
12491249
}
12501250
expect: {
1251-
console.log(false, false, true, true, "number");
1251+
console.log("number", false, false, true, true);
12521252
}
1253-
expect_stdout: "false false true true 'number'"
1253+
expect_stdout: "number false false true true"
12541254
}
12551255

12561256
self_comparison_2: {
@@ -1265,12 +1265,12 @@ self_comparison_2: {
12651265
}
12661266
input: {
12671267
var o = { n: NaN };
1268-
console.log(o.n == o.n, o.n === o.n, o.n != o.n, o.n !== o.n, typeof o.n);
1268+
console.log(typeof o.n, o.n == o.n, o.n === o.n, o.n != o.n, o.n !== o.n);
12691269
}
12701270
expect: {
1271-
console.log(false, false, true, true, "number");
1271+
console.log("number", false, false, true, true);
12721272
}
1273-
expect_stdout: "false false true true 'number'"
1273+
expect_stdout: "number false false true true"
12741274
}
12751275

12761276
issue_2535_1: {

test/compress/reduce_vars.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,18 +2740,18 @@ issue_1814_2: {
27402740
!function() {
27412741
var b = a + 1;
27422742
!function(a) {
2743-
console.log(a++, b);
2743+
console.log(b, a++);
27442744
}(0);
27452745
}();
27462746
}
27472747
expect: {
27482748
!function() {
27492749
!function(a) {
2750-
console.log(a++, "321");
2750+
console.log("321", a++);
27512751
}(0);
27522752
}();
27532753
}
2754-
expect_stdout: "0 '321'"
2754+
expect_stdout: "321 0"
27552755
}
27562756

27572757
try_abort: {

0 commit comments

Comments
 (0)