@@ -25,7 +25,11 @@ mod tests {
2525 use super :: private_in_object;
2626 use serde:: Deserialize ;
2727 use std:: path:: PathBuf ;
28+ use swc_common:: chain;
29+ use swc_ecma_transforms_base:: pass:: noop;
30+ use swc_ecma_transforms_compat:: { es2015:: classes, es2020:: class_properties} ;
2831 use swc_ecma_transforms_testing:: { parse_options, test_fixture} ;
32+ use swc_ecma_visit:: Fold ;
2933
3034 #[ derive( Debug , Clone , Deserialize ) ]
3135 #[ serde( deny_unknown_fields) ]
@@ -49,7 +53,38 @@ mod tests {
4953 let output = parent. join ( "output.js" ) ;
5054 test_fixture (
5155 Default :: default ( ) ,
52- & |_| private_in_object ( ) ,
56+ & |t| {
57+ let mut pass: Box < dyn Fold > = Box :: new ( noop ( ) ) ;
58+
59+ for plugin in & options. plugins {
60+ let ( name, _option) = match plugin {
61+ PluginConfig :: WithOption ( name, config) => ( name, config. clone ( ) ) ,
62+ PluginConfig :: Name ( name) => ( name, serde_json:: Value :: Null ) ,
63+ } ;
64+
65+ match & * * name {
66+ "proposal-private-property-in-object" => {
67+ pass = Box :: new ( chain ! ( pass, private_in_object( ) ) ) ;
68+ }
69+
70+ "proposal-class-properties" => {
71+ pass = Box :: new ( chain ! ( pass, class_properties( ) ) ) ;
72+ }
73+
74+ "proposal-private-methods" => { }
75+
76+ "transform-classes" => {
77+ pass = Box :: new ( chain ! ( pass, classes( Some ( t. comments. clone( ) ) ) ) ) ;
78+ }
79+
80+ _ => {
81+ panic ! ( "unknown pass: {}" , name)
82+ }
83+ }
84+ }
85+
86+ pass
87+ } ,
5388 & input,
5489 & output,
5590 )
0 commit comments