diff --git a/crates/oxc_minifier/src/ast_passes/peephole_fold_constants.rs b/crates/oxc_minifier/src/ast_passes/peephole_fold_constants.rs index 0d84b82ce2754..b48b91fbc4afc 100644 --- a/crates/oxc_minifier/src/ast_passes/peephole_fold_constants.rs +++ b/crates/oxc_minifier/src/ast_passes/peephole_fold_constants.rs @@ -1057,7 +1057,6 @@ mod test { } #[test] - #[ignore] fn test_string_string_comparison() { test("'a' < 'b'", "true"); test("'a' <= 'b'", "true"); @@ -1123,7 +1122,6 @@ mod test { } #[test] - #[ignore] fn test_bigint_number_comparison() { test("1n < 2", "true"); test("1n > 2", "false"); @@ -1168,7 +1166,6 @@ mod test { } #[test] - #[ignore] fn test_bigint_string_comparison() { test("1n < '2'", "true"); test("2n > '1'", "true"); @@ -1181,7 +1178,6 @@ mod test { } #[test] - #[ignore] fn test_string_bigint_comparison() { test("'1' < 2n", "true"); test("'2' > 1n", "true"); @@ -1199,10 +1195,10 @@ mod test { test("NaN <= 1", "false"); test("NaN > 1", "false"); test("NaN >= 1", "false"); - // test("NaN < 1n", "false"); - // test("NaN <= 1n", "false"); - // test("NaN > 1n", "false"); - // test("NaN >= 1n", "false"); + test("NaN < 1n", "false"); + test("NaN <= 1n", "false"); + test("NaN > 1n", "false"); + test("NaN >= 1n", "false"); test("NaN < NaN", "false"); test("NaN >= NaN", "false"); diff --git a/crates/oxc_minifier/src/node_util/mod.rs b/crates/oxc_minifier/src/node_util/mod.rs index 8c682de72e00c..3f00c72aa10f8 100644 --- a/crates/oxc_minifier/src/node_util/mod.rs +++ b/crates/oxc_minifier/src/node_util/mod.rs @@ -272,9 +272,11 @@ pub trait NodeUtil { None } } - Expression::BigIntLiteral(_bigint_literal) => { - // TODO: evaluate the bigint value - None + Expression::BigIntLiteral(bigint_literal) => { + let value = + self.get_string_bigint_value(bigint_literal.raw.as_str().trim_end_matches('n')); + debug_assert!(value.is_some(), "Failed to parse {}", bigint_literal.raw); + value } Expression::BooleanLiteral(bool_literal) => { if bool_literal.value {