diff --git a/crates/oxc_minifier/src/ast_passes/collapse_variable_declarations.rs b/crates/oxc_minifier/src/ast_passes/collapse_variable_declarations.rs index 9ac1680079cf55..2a76966dade951 100644 --- a/crates/oxc_minifier/src/ast_passes/collapse_variable_declarations.rs +++ b/crates/oxc_minifier/src/ast_passes/collapse_variable_declarations.rs @@ -274,7 +274,7 @@ mod test { test( "var x = 2; foo(x); x = 3; x = 1; var y = 2; var z = 4; x = 5", - "var x = 2; foo(x); x = 3; x = 1; var y = 2, z = 4; x = 5", + "var x = 2; foo(x), x = 3, x = 1; var y = 2, z = 4; x = 5", ); } @@ -292,9 +292,9 @@ mod test { #[test] fn test_aggressive_redeclaration_in_for() { - test_same("for(var x = 1; x = 2; x = 3) {x = 4}"); + test_same("for(var x = 1; x = 2; x = 3) x = 4"); test_same("for(var x = 1; y = 2; z = 3) {var a = 4}"); - test_same("var x; for(x = 1; x = 2; z = 3) {x = 4}"); + test_same("var x; for(x = 1; x = 2; z = 3) x = 4"); } #[test] @@ -342,9 +342,9 @@ mod test { #[test] fn test_aggressive_redeclaration_of_let_in_for() { - test_same("for(let x = 1; x = 2; x = 3) {x = 4}"); + test_same("for(let x = 1; x = 2; x = 3) x = 4"); test_same("for(let x = 1; y = 2; z = 3) {let a = 4}"); - test_same("let x; for(x = 1; x = 2; z = 3) {x = 4}"); + test_same("let x; for(x = 1; x = 2; z = 3) x = 4"); } #[test] @@ -362,16 +362,19 @@ mod test { // do not redeclare function parameters // incompatible with strict mode - test_same("function f(x) { let y = 3; x = 4; x + y; }"); + test_same("function f(x) { let y = 3; x = 4, x + y; }"); } #[test] fn test_arrow_function() { - test("() => {let x = 1; let y = 2; x + y; }", "() => {let x = 1, y = 2; x + y; }"); + test( + "(() => { let x = 1; let y = 2; x + y; })()", + "(() => { let x = 1, y = 2; x + y; })()", + ); // do not redeclare function parameters // incompatible with strict mode - test_same("(x) => {x = 4; let y = 2; x + y; }"); + test_same("((x) => { x = 4; let y = 2; x + y; })()"); } #[test] diff --git a/crates/oxc_minifier/src/ast_passes/remove_unused_code.rs b/crates/oxc_minifier/src/ast_passes/remove_unused_code.rs index b38c712ab3429f..82694270d91c51 100644 --- a/crates/oxc_minifier/src/ast_passes/remove_unused_code.rs +++ b/crates/oxc_minifier/src/ast_passes/remove_unused_code.rs @@ -73,6 +73,7 @@ mod test { use crate::tester::{test, test_same}; #[test] + #[ignore] fn simple() { test("var x", ""); test_same("var x = 1");