From 685c51b7e06ab24ed79f5a77857320a704b76806 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 12 Jul 2026 13:13:02 -0500 Subject: [PATCH] fix(new): default runtime is node (framework is node-first) Signed-off-by: Diego Resendez --- src/cli.rs | 2 +- tests/new.rs | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 80b17e3..553806f 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -14,7 +14,7 @@ pub enum Command { name: String, #[arg(long)] template_url: Option, - #[arg(long, default_value = "deno", value_parser = ["node", "deno", "bun"])] + #[arg(long, default_value = "node", value_parser = ["node", "deno", "bun"])] runtime: String, }, /// Detect the runtime and run the project in watch mode diff --git a/tests/new.rs b/tests/new.rs index e5e2083..f5d1cb5 100644 --- a/tests/new.rs +++ b/tests/new.rs @@ -17,15 +17,31 @@ fn new_scaffolds_into_named_dir() { } #[test] -fn new_default_runtime_is_deno() { +fn new_default_runtime_is_node() { let d = tempdir().unwrap(); Command::cargo_bin("matcha") .unwrap() .current_dir(d.path()) - .args(["new", "my-api"]) + .args(["new", "demo"]) .assert() .success(); - let root = d.path().join("my-api"); + let root = d.path().join("demo"); + let pkg = std::fs::read_to_string(root.join("package.json")).unwrap(); + assert!(pkg.contains("\"name\": \"demo\"")); + assert!(root.join("tsconfig.json").exists()); + assert!(!root.join("deno.json").exists()); +} + +#[test] +fn new_with_deno_runtime_produces_deno_json() { + let d = tempdir().unwrap(); + Command::cargo_bin("matcha") + .unwrap() + .current_dir(d.path()) + .args(["new", "demo-deno", "--runtime", "deno"]) + .assert() + .success(); + let root = d.path().join("demo-deno"); assert!(root.join("deno.json").exists()); assert!(!root.join("package.json").exists()); }