Skip to content

Commit 04a8eb2

Browse files
test(javascript): list each minifier's test262 failures under its own cause
Both shards reported, and `printer` leaves fourteen entries it passes now, each a program terser miscompiles and the `correct` phase gets right: `let` after a newline in a `for-in`, `for-of` or `for-await-of` head, `async` with no line terminator before a function declaration or an arrow, an escaped `async` before one, `await` as the second argument of a dynamic import, and a line continuation inside a single- or double-quoted string. Each moves to the terser-only group its reason already has. Two entries keep the printer, under what actually fails them rather than terser's reason. `import/import-attributes/text-javascript.js` imports a fixture that is not parsable JavaScript, so neither minifier can read the asset. `expressions/await/await-in-nested-function.js` is a printer defect: compressing inlines a function naming `await` into the async function calling it, where the name is reserved, so the output does not parse — reached only now that the printer is held to this case.
1 parent 8dd6534 commit 04a8eb2

1 file changed

Lines changed: 49 additions & 26 deletions

File tree

‎test/specCases/test262.spectest.js‎

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ const renamedByMinifier = /(?:^|[/-])fn-name(?:[-.]|$)/;
371371
/** @type {{ reason: string, minifiers: ("terser" | "printer")[], tests: string[] }[]} */
372372
const MINIFIED_FAILURES = [
373373
{
374-
reason: "terser drops an evaluation that throws",
374+
reason:
375+
"terser drops an evaluation that throws",
375376
minifiers: ["terser", "printer"],
376377
tests: [
377378
"arguments-object/10.6-13-c-1-s.js (strict)",
@@ -439,10 +440,6 @@ const MINIFIED_FAILURES = [
439440
"expressions/assignment/dstr/obj-prop-elem-init-let.js (strict)",
440441
"expressions/assignment/dstr/obj-prop-put-let.js (sloppy)",
441442
"expressions/assignment/dstr/obj-prop-put-let.js (strict)",
442-
"expressions/async-arrow-function/async-lineterminator-identifier-throws.js (sloppy)",
443-
"expressions/async-arrow-function/async-lineterminator-identifier-throws.js (strict)",
444-
"expressions/async-arrow-function/escaped-async-line-terminator.js (sloppy)",
445-
"expressions/async-arrow-function/escaped-async-line-terminator.js (strict)",
446443
"expressions/bitwise-and/bigint-and-number.js (sloppy)",
447444
"expressions/bitwise-and/bigint-and-number.js (strict)",
448445
"expressions/bitwise-and/bigint-errors.js (sloppy)",
@@ -596,8 +593,6 @@ const MINIFIED_FAILURES = [
596593
"module-code/instn-local-bndng-export-const.js (module)",
597594
"module-code/instn-local-bndng-export-let.js (module)",
598595
"module-code/instn-local-bndng-let.js (module)",
599-
"statements/async-function/syntax-declaration-no-line-terminator.js (sloppy)",
600-
"statements/async-function/syntax-declaration-no-line-terminator.js (strict)",
601596
"statements/await-using/block-local-closure-get-before-initialization.js (sloppy)",
602597
"statements/await-using/block-local-closure-get-before-initialization.js (strict)",
603598
"statements/await-using/block-local-use-before-initialization-in-prior-statement.js (sloppy)",
@@ -1152,7 +1147,6 @@ const MINIFIED_FAILURES = [
11521147
"expressions/object/method-definition/yield-as-function-expression-binding-identifier.js (sloppy)",
11531148
"expressions/tagged-template/invalid-escape-sequences.js (sloppy)",
11541149
"expressions/tagged-template/invalid-escape-sequences.js (strict)",
1155-
"import/import-attributes/text-javascript.js (module)",
11561150
"module-code/top-level-await/await-expr-regexp.js (module)",
11571151
"module-code/top-level-await/new-await-script-code.js (strict)",
11581152
"module-code/top-level-await/syntax/block-await-expr-regexp.js (module)",
@@ -1284,7 +1278,8 @@ const MINIFIED_FAILURES = [
12841278
]
12851279
},
12861280
{
1287-
reason: "terser changes what the program does",
1281+
reason:
1282+
"terser changes what the program does",
12881283
minifiers: ["terser", "printer"],
12891284
tests: [
12901285
"expressions/addition/coerce-symbol-to-prim-invocation.js (sloppy)",
@@ -1340,10 +1335,6 @@ const MINIFIED_FAILURES = [
13401335
"import/import-defer/evaluation-triggers/trigger-exported-string-hasProperty.js (module)",
13411336
"import/import-defer/evaluation-triggers/trigger-not-exported-string-hasProperty-in-prototype.js (module)",
13421337
"import/import-defer/evaluation-triggers/trigger-not-exported-string-hasProperty.js (module)",
1343-
"literals/string/line-continuation-double.js (sloppy)",
1344-
"literals/string/line-continuation-double.js (strict)",
1345-
"literals/string/line-continuation-single.js (sloppy)",
1346-
"literals/string/line-continuation-single.js (strict)",
13471338
"statements/async-generator/return-undefined-implicit-and-explicit.js (sloppy)",
13481339
"statements/async-generator/return-undefined-implicit-and-explicit.js (strict)",
13491340
"statements/class/elements/private-async-generator-method-name.js (sloppy)",
@@ -1416,7 +1407,8 @@ const MINIFIED_FAILURES = [
14161407
]
14171408
},
14181409
{
1419-
reason: "terser writes a program that reads a binding outside its scope",
1410+
reason:
1411+
"terser writes a program that reads a binding outside its scope",
14201412
minifiers: ["terser", "printer"],
14211413
tests: [
14221414
"expressions/arrow-function/scope-paramsbody-var-open.js (sloppy)",
@@ -1511,11 +1503,10 @@ const MINIFIED_FAILURES = [
15111503
]
15121504
},
15131505
{
1514-
reason: "terser writes a program that no longer parses",
1506+
reason:
1507+
"terser writes a program that no longer parses",
15151508
minifiers: ["terser", "printer"],
15161509
tests: [
1517-
"expressions/await/await-in-nested-function.js (sloppy)",
1518-
"expressions/dynamic-import/import-attributes/2nd-param-await-ident.js (strict)",
15191510
"expressions/in/private-field-rhs-yield-present.js (sloppy)",
15201511
"expressions/in/private-field-rhs-yield-present.js (strict)",
15211512
"expressions/new.target/unary-expr.js (sloppy)",
@@ -1554,13 +1545,10 @@ const MINIFIED_FAILURES = [
15541545
"statements/class/elements/private-static-method-visible-to-direct-eval.js (strict)",
15551546
"statements/class/elements/private-static-setter-visible-to-direct-eval.js (sloppy)",
15561547
"statements/class/elements/private-static-setter-visible-to-direct-eval.js (strict)",
1557-
"statements/for-await-of/let-block-with-newline.js (sloppy)",
1558-
"statements/for-in/let-block-with-newline.js (sloppy)",
15591548
"statements/for-of/head-lhs-async-escaped.js (sloppy)",
15601549
"statements/for-of/head-lhs-async-escaped.js (strict)",
15611550
"statements/for-of/head-lhs-async-parens.js (sloppy)",
15621551
"statements/for-of/head-lhs-async-parens.js (strict)",
1563-
"statements/for-of/let-block-with-newline.js (sloppy)",
15641552
"statements/return/S12.9_A1_T1.js (sloppy)",
15651553
"statements/return/S12.9_A1_T1.js (strict)",
15661554
"statements/return/S12.9_A1_T10.js (sloppy)",
@@ -1584,9 +1572,14 @@ const MINIFIED_FAILURES = [
15841572
]
15851573
},
15861574
{
1587-
reason: "terser drops an evaluation that throws",
1575+
reason:
1576+
"terser drops an evaluation that throws",
15881577
minifiers: ["terser"],
15891578
tests: [
1579+
"expressions/async-arrow-function/async-lineterminator-identifier-throws.js (sloppy)",
1580+
"expressions/async-arrow-function/async-lineterminator-identifier-throws.js (strict)",
1581+
"expressions/async-arrow-function/escaped-async-line-terminator.js (sloppy)",
1582+
"expressions/async-arrow-function/escaped-async-line-terminator.js (strict)",
15901583
"expressions/call/spread-err-mult-err-expr-throws.js (sloppy)",
15911584
"expressions/call/spread-err-mult-err-expr-throws.js (strict)",
15921585
"expressions/call/spread-err-mult-err-iter-get-value.js (sloppy)",
@@ -1610,23 +1603,36 @@ const MINIFIED_FAILURES = [
16101603
"expressions/call/spread-err-sngl-err-itr-step.js (sloppy)",
16111604
"expressions/call/spread-err-sngl-err-itr-step.js (strict)",
16121605
"expressions/call/spread-err-sngl-err-itr-value.js (sloppy)",
1613-
"expressions/call/spread-err-sngl-err-itr-value.js (strict)"
1606+
"expressions/call/spread-err-sngl-err-itr-value.js (strict)",
1607+
"statements/async-function/syntax-declaration-no-line-terminator.js (sloppy)",
1608+
"statements/async-function/syntax-declaration-no-line-terminator.js (strict)"
16141609
]
16151610
},
16161611
{
1617-
reason: "terser writes a program that no longer parses",
1612+
reason:
1613+
"terser writes a program that no longer parses",
16181614
minifiers: ["terser"],
16191615
tests: [
1616+
"expressions/await/await-in-nested-function.js (sloppy)",
1617+
"expressions/dynamic-import/import-attributes/2nd-param-await-ident.js (strict)",
16201618
"expressions/function/static-init-await-reference.js (sloppy)",
1621-
"expressions/function/static-init-await-reference.js (strict)"
1619+
"expressions/function/static-init-await-reference.js (strict)",
1620+
"statements/for-await-of/let-block-with-newline.js (sloppy)",
1621+
"statements/for-in/let-block-with-newline.js (sloppy)",
1622+
"statements/for-of/let-block-with-newline.js (sloppy)"
16221623
]
16231624
},
16241625
{
1625-
reason: "terser changes what the program does",
1626+
reason:
1627+
"terser changes what the program does",
16261628
minifiers: ["terser"],
16271629
tests: [
16281630
"expressions/generators/static-init-await-reference.js (sloppy)",
1629-
"expressions/generators/static-init-await-reference.js (strict)"
1631+
"expressions/generators/static-init-await-reference.js (strict)",
1632+
"literals/string/line-continuation-double.js (sloppy)",
1633+
"literals/string/line-continuation-double.js (strict)",
1634+
"literals/string/line-continuation-single.js (sloppy)",
1635+
"literals/string/line-continuation-single.js (strict)"
16301636
]
16311637
},
16321638
{
@@ -1639,6 +1645,23 @@ const MINIFIED_FAILURES = [
16391645
"expressions/unary-plus/bigint-throws.js (sloppy)",
16401646
"expressions/unary-plus/bigint-throws.js (strict)"
16411647
]
1648+
},
1649+
{
1650+
reason:
1651+
"the fixture imported is not parsable JavaScript, so minifying it fails the build",
1652+
minifiers: ["terser", "printer"],
1653+
tests: [
1654+
"import/import-attributes/text-javascript.js (module)"
1655+
]
1656+
},
1657+
{
1658+
reason:
1659+
"the printer inlines a function naming `await` into an async function, so its output does not parse",
1660+
minifiers: ["printer"],
1661+
tests: [
1662+
"expressions/await/await-in-nested-function.js (sloppy)",
1663+
"expressions/await/await-in-nested-function.js (strict)"
1664+
]
16421665
}
16431666
];
16441667
/* cspell:enable */

0 commit comments

Comments
 (0)