Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Sep 13, 2021
1 parent ab12f15 commit ea229b0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/next/build/swc/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub enum Input {
#[serde(rename_all = "camelCase")]
pub struct TransformOptions {
#[serde(flatten)]
swc: swc::config::Options,
pub swc: swc::config::Options,

#[serde(default)]
pub disable_next_ssg: bool,
Expand Down Expand Up @@ -178,3 +178,12 @@ pub fn transform_sync(cx: CallContext) -> napi::Result<JsObject> {
))
})
}

#[test]
fn test_deser() {
const JSON_STR: &str = r#"{"jsc":{"parser":{"syntax":"ecmascript","dynamicImport":true,"jsx":true},"transform":{"react":{"runtime":"automatic","pragma":"React.createElement","pragmaFrag":"React.Fragment","throwIfNamespace":true,"development":false,"useBuiltins":true}},"target":"es5"},"filename":"/Users/timneutkens/projects/next.js/packages/next/dist/client/next.js","sourceMaps":false,"sourceFileName":"/Users/timneutkens/projects/next.js/packages/next/dist/client/next.js"}"#;

let tr: TransformOptions = serde_json::from_str(&JSON_STR).unwrap();

println!("{:#?}", tr);
}

0 comments on commit ea229b0

Please sign in to comment.