swc/crates/swc_ecma_transforms_module/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 feat(es/testing): Use __swc_snapshots__ for test! macro (#8191) 2023-10-30 10:38:59 +09:00
fixture fix(es/typescript): Correctly handle ESM context (#9490) 2024-08-23 22:40:28 +09:00
fixture-manual/issue-4730 fix(es/module): Fix resolving of dependencies (#8533) 2024-01-21 21:35:57 +09:00
paths fix(es/module): Resolve .jsx imports fully (#8936) 2024-05-08 15:57:50 +09:00
amd.rs feat(es/testing): Parse test code as a Program instead of a Module (#9623) 2024-10-08 13:58:58 +09:00
common_js.rs feat(es/testing): Parse test code as a Program instead of a Module (#9623) 2024-10-08 13:58:58 +09:00
path_node.rs feat(es/testing): Parse test code as a Program instead of a Module (#9623) 2024-10-08 13:58:58 +09:00
system_js.rs feat(es/testing): Parse test code as a Program instead of a Module (#9623) 2024-10-08 13:58:58 +09:00
umd.rs feat(es/testing): Parse test code as a Program instead of a Module (#9623) 2024-10-08 13:58:58 +09:00