swc/crates/swc_ecma_transforms/tests
Levi bfea322351
feat(es/testing): Parse test code as a Program instead of a Module (#9623)
**Description:**

This PR addresses the issue described in https://github.com/swc-project/swc/issues/8713

**BREAKING CHANGE:**
Will break unit tests that use `fold_module`/`visit_module`/`visit_mut_module` if the visitor is intended to work for both modules and scripts instead of using `fold_program`/`visit_program`/`visit_mut_program`.

When creating visitors, you should use `fold_program`/`visit_program`/`visit_mut_program` if you simply want to visit the top-level node.

When creating tests, the input source code will be parsed using `parse_program` by default. If you need to parse it as a `Module`, you can use `module: Some(true)` in `FixtureTestConfig` (or with `test!(module, ..)`), which will parse it as a `Program::Module`, or `Some(false)` for `Program::Script`. `None` will use `parse_program` (`parse_program` will auto-detect the underlying type).
2024-10-08 13:58:58 +09:00
..
__swc_snapshots__/tests perf(es/utils): Rewrite inject_after_super (#9496) 2024-09-03 03:11:02 +09:00
fixture fix(es/decorators): Fix metadata for accessors (#9444) 2024-08-18 13:27:20 +00:00
decorators.rs feat(es/testing): Parse test code as a Program instead of a Module (#9623) 2024-10-08 13:58:58 +09:00
deno.rs feat(es/typescript): Add native_class_properties to skip reordering of class properties inits (#9421) 2024-08-14 09:11:04 +09:00
es2015_function_name.rs fix(es/module): Rewrite import specifier in type declaration (#9577) 2024-09-23 11:32:52 +09:00