@@ -25,7 +25,11 @@ mod tests {
25
25
use super :: private_in_object;
26
26
use serde:: Deserialize ;
27
27
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} ;
28
31
use swc_ecma_transforms_testing:: { parse_options, test_fixture} ;
32
+ use swc_ecma_visit:: Fold ;
29
33
30
34
#[ derive( Debug , Clone , Deserialize ) ]
31
35
#[ serde( deny_unknown_fields) ]
@@ -49,7 +53,38 @@ mod tests {
49
53
let output = parent. join ( "output.js" ) ;
50
54
test_fixture (
51
55
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
+ } ,
53
88
& input,
54
89
& output,
55
90
)
0 commit comments