Develop #1
No files matched your search
+1
-1
@@ -14,7 +14,7 @@ pub enum Command {
|
|||||||
name: String,
|
name: String,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
template_url: Option<String>,
|
template_url: Option<String>,
|
||||||
#[arg(long, default_value = "deno", value_parser = ["node", "deno", "bun"])]
|
#[arg(long, default_value = "node", value_parser = ["node", "deno", "bun"])]
|
||||||
runtime: String,
|
runtime: String,
|
||||||
},
|
},
|
||||||
/// Detect the runtime and run the project in watch mode
|
/// Detect the runtime and run the project in watch mode
|
||||||
|
|||||||
+19
-3
@@ -17,15 +17,31 @@ fn new_scaffolds_into_named_dir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn new_default_runtime_is_deno() {
|
fn new_default_runtime_is_node() {
|
||||||
let d = tempdir().unwrap();
|
let d = tempdir().unwrap();
|
||||||
Command::cargo_bin("matcha")
|
Command::cargo_bin("matcha")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.current_dir(d.path())
|
.current_dir(d.path())
|
||||||
.args(["new", "my-api"])
|
.args(["new", "demo"])
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.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("deno.json").exists());
|
||||||
assert!(!root.join("package.json").exists());
|
assert!(!root.join("package.json").exists());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user