summaryrefslogtreecommitdiff
path: root/cli/tests/integration/task_tests.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-12-06 16:36:06 -0500
committerGitHub <noreply@github.com>2023-12-06 16:36:06 -0500
commite372fc73e806faeeb3c67df2d5b10a63fe5e8213 (patch)
tree8231a04ab1ea19dc4aa9d8e6be502cbf6c136ede /cli/tests/integration/task_tests.rs
parent7fdc3c8f1fc27be2ca7d4ff62b9fd8ecb3d24e61 (diff)
fix(task): handle node_modules/.bin directory with byonm (#21386)
A bit hacky, but it works. Essentially, this will check for all the scripts in the node_modules/.bin directory then force them to run with Deno via deno_task_shell.
Diffstat (limited to 'cli/tests/integration/task_tests.rs')
-rw-r--r--cli/tests/integration/task_tests.rs56
1 files changed, 56 insertions, 0 deletions
diff --git a/cli/tests/integration/task_tests.rs b/cli/tests/integration/task_tests.rs
index 47be2acdf..0eb77803b 100644
--- a/cli/tests/integration/task_tests.rs
+++ b/cli/tests/integration/task_tests.rs
@@ -3,8 +3,10 @@
// Most of the tests for this are in deno_task_shell.
// These tests are intended to only test integration.
+use deno_core::serde_json::json;
use test_util::env_vars_for_npm_tests;
use test_util::TestContext;
+use test_util::TestContextBuilder;
itest!(task_no_args {
args: "task -q --config task/deno_json/deno.json",
@@ -287,3 +289,57 @@ itest!(task_deno_no_pre_post {
exit_code: 0,
envs: vec![("NO_COLOR".to_string(), "1".to_string())],
});
+
+#[test]
+fn task_byonm() {
+ let context = TestContextBuilder::for_npm().use_temp_cwd().build();
+ let temp_dir = context.temp_dir().path();
+ temp_dir.join("package.json").write_json(&json!({
+ "name": "example",
+ "scripts": {
+ "say": "cowsay 'do make say'",
+ "think": "cowthink think"
+ },
+ "dependencies": {
+ "cowsay": "*"
+ }
+ }));
+ temp_dir.join("deno.json").write_json(&json!({
+ "unstable": ["byonm"],
+ }));
+ context.run_npm("install");
+
+ context
+ .new_command()
+ .args_vec(["task", "say"])
+ .run()
+ .assert_matches_text(
+ r#"Task say cowsay 'do make say'
+ _____________
+< do make say >
+ -------------
+ \ ^__^
+ \ (oo)\_______
+ (__)\ )\/\
+ ||----w |
+ || ||
+"#,
+ );
+
+ context
+ .new_command()
+ .args_vec(["task", "think"])
+ .run()
+ .assert_matches_text(
+ r#"Task think cowthink think
+ _______
+( think )
+ -------
+ o ^__^
+ o (oo)\_______
+ (__)\ )\/\
+ ||----w |
+ || ||
+"#,
+ );
+}