Skip to content

Commit 10ec419

Browse files
1 parent fccd126 commit 10ec419

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,26 @@ const OPTION_SETS = {
9494
* @returns {Promise<{ code: string | undefined, map: import("../../lib/javascript/syntax-printer").MinifyOutput["map"], printedFromTree: number }>} the code, its source map, and how often the tree printer printed
9595
*/
9696
const minifyCounted = async (input, options, fromTree) => {
97-
const { minify, modules } = await load();
97+
const { minify, modules, improvements } = await load();
9898
const { printTree, treePrinting } = modules;
99+
const choosesBySize = /** @type {NonNullable<typeof improvements>} */ (
100+
improvements
101+
).choosesBySize;
99102
let printedFromTree = 0;
100103
modules.printTree = (/** @type {EXPECTED_ANY[]} */ ...args) => {
101104
printedFromTree++;
102105
return printTree(...args);
103106
};
104107
treePrinting.enabled = fromTree;
108+
// One run, as choosing a spelling by size prints the program again.
109+
choosesBySize.enabled = false;
105110
try {
106111
const { code, map } = await minify(input, options);
107112
return { code, map, printedFromTree };
108113
} finally {
109114
modules.printTree = printTree;
110115
treePrinting.enabled = true;
116+
choosesBySize.enabled = true;
111117
}
112118
};
113119

0 commit comments

Comments
 (0)