Skip to content

Commit 1620bf8

Browse files
alexander-akaitclaude
authored andcommitted
test(javascript): fit two minifier tests to #22473 and #22499 together
#22473 counts a conversion as code that may run, so the value #22499's improved case moved past `console` now has effects and stays put; it now moves a comparison, which converts nothing. And #22499 now shortens #22473's literal case, whose assertion holds the output to terser's, so that case runs with the improve phase off. With both in, `vercel/ms` is bigger than oxc's output again (787 against 781 gzip), so it goes back on OXC_SMALLER, where #22499 had retired it on its own. Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
1 parent ad1d016 commit 1620bf8

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎test/helpers/oxcSmaller.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ const OXC_SMALLER_BY_REASON = [
658658
"swc minifier: fixture/issues/firebase/dist/1/input.js",
659659
"swc minifier: fixture/issues/react-instancesearch/004/input.js",
660660
"swc minifier: fixture/issues/react/hooks/3/input.js",
661+
"swc minifier: fixture/issues/vercel/005/input.js",
661662
"swc minifier: fixture/next/31077/static/chunks/1606726a.10299989c08cb523/input.js",
662663
"swc minifier: fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/input.js",
663664
"swc minifier: fixture/next/36127/2/3/input.js",
@@ -689,6 +690,7 @@ const OXC_SMALLER_BY_REASON = [
689690
"swc minifier: fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/input.js",
690691
"swc minifier: fixture/projects/react/.6/input.js",
691692
"swc minifier: fixture/projects/wmr/archive-1/chunks/hoofd.module.6c5395cb/input.js",
693+
"swc minifier: full/vercel/ms/1/input.js",
692694
"swc minifier: projects/files/backbone-1.1.0.js",
693695
"swc minifier: projects/files/jquery-1.9.1.js",
694696
"swc minifier: projects/files/jquery.mobile-1.4.2.js",

‎test/unitCases/syntax-printer.unittest.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ const IMPROVED_CASES = [
607607
],
608608
[
609609
"a value moved past a read of `console`, a built-in or one of its methods",
610-
"function f(x) { var r = x + 1, a = r * r - r; console.log(a + 7); var v = g(); console.log(Math.max(v, 1)); var c; c = 2; console.log(c); } function g() { return 3; } f(1);"
610+
"function f(x) { var a = x === 1 ? 2 : 3; console.log(a + 7); var v = g(); console.log(Math.max(v, 1)); var c; c = 2; console.log(c); } function g() { return 3; } f(1);"
611611
],
612612
[
613613
"an array of empty strings",
@@ -5468,7 +5468,7 @@ describe("syntax-printer", () => {
54685468
const input =
54695469
"(function () { var array = []; var push = array.push, slice = array.slice; console.log(typeof push); })();";
54705470
const options = { compress: {}, mangle: false };
5471-
const { code } = await minify(input, options);
5471+
const { code } = await unimproved(() => minify(input, options));
54725472
const reference = await terserReference().minify(input, options);
54735473
expect(code).toBe(reference.code);
54745474
});

0 commit comments

Comments
 (0)