Skip to content

Commit

Permalink
remove
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Apr 16, 2024
1 parent ca85bb9 commit c55c25b
Showing 1 changed file with 0 additions and 91 deletions.
91 changes: 0 additions & 91 deletions crates/swc_plugin_runner/tests/ecma_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,96 +224,5 @@ fn internal() {
Ok(())
})
.expect("Should able to run single plugin transform with handler");

// Run multiple plugins.
testing::run_test(false, |cm, _handler| {
eprintln!("Multiple plugins start");

let fm = cm.new_source_file(FileName::Anon, "console.log(foo)".into());

let program = parse_file_as_program(
&fm,
Syntax::Es(Default::default()),
EsVersion::latest(),
None,
&mut vec![],
)
.unwrap();

let mut serialized_program =
PluginSerializedBytes::try_serialize(&VersionedSerializable::new(program))
.expect("Should serializable");

let experimental_metadata: AHashMap<String, String> = [
(
"TestExperimental".to_string(),
"ExperimentalValue".to_string(),
),
("OtherTest".to_string(), "OtherVal".to_string()),
]
.into_iter()
.collect();

let mut plugin_transform_executor = swc_plugin_runner::create_plugin_transform_executor(
&cm,
&Mark::new(),
&Arc::new(TransformPluginMetadataContext::new(
None,
"development".to_string(),
Some(experimental_metadata.clone()),
)),
Box::new(PLUGIN_BYTES.clone()),
Some(json!({ "pluginConfig": "testValue" })),
None,
);

serialized_program = plugin_transform_executor
.transform(&serialized_program, Some(false))
.expect("Plugin should apply transform");

let _program: Program = serialized_program
.deserialize()
.expect("Should able to deserialize")
.into_inner();

eprintln!("Multiple plugins - first plugin done");

// TODO: we'll need to apply 2 different plugins
let mut plugin_transform_executor = swc_plugin_runner::create_plugin_transform_executor(
&cm,
&Mark::new(),
&Arc::new(TransformPluginMetadataContext::new(
None,
"development".to_string(),
Some(experimental_metadata),
)),
Box::new(PLUGIN_BYTES.clone()),
Some(json!({ "pluginConfig": "testValue" })),
None,
);

eprintln!("Multiple plugins - second plugin start");

serialized_program = plugin_transform_executor
.transform(&serialized_program, Some(false))
.expect("Plugin should apply transform");

eprintln!("Multiple plugins - second plugin done");

let program: Program = serialized_program
.deserialize()
.expect("Should able to deserialize")
.into_inner();
let mut visitor = TestVisitor {
plugin_transform_found: false,
};
program.visit_with(&mut visitor);

visitor
.plugin_transform_found
.then_some(visitor.plugin_transform_found)
.ok_or(())
})
.expect("Should able to run multiple plugins transform");
});
}

0 comments on commit c55c25b

Please sign in to comment.