diff options
Diffstat (limited to 'tests/specs/task')
82 files changed, 518 insertions, 0 deletions
diff --git a/tests/specs/task/additional_args/__test__.jsonc b/tests/specs/task/additional_args/__test__.jsonc new file mode 100644 index 000000000..b75c638ff --- /dev/null +++ b/tests/specs/task/additional_args/__test__.jsonc @@ -0,0 +1,7 @@ +{ + "args": "task -q --config deno.json echo 2", + "output": "task_additional_args.out", + "envs": { + "NO_COLOR": "1" + } +} diff --git a/tests/specs/task/additional_args/deno.json b/tests/specs/task/additional_args/deno.json new file mode 100644 index 000000000..c1a379c46 --- /dev/null +++ b/tests/specs/task/additional_args/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "echo": "echo 1" + } +} diff --git a/tests/specs/task/additional_args/task_additional_args.out b/tests/specs/task/additional_args/task_additional_args.out new file mode 100644 index 000000000..8d04f961a --- /dev/null +++ b/tests/specs/task/additional_args/task_additional_args.out @@ -0,0 +1 @@ +1 2 diff --git a/tests/specs/task/additional_args_nested_strings/__test__.jsonc b/tests/specs/task/additional_args_nested_strings/__test__.jsonc new file mode 100644 index 000000000..e543e31ac --- /dev/null +++ b/tests/specs/task/additional_args_nested_strings/__test__.jsonc @@ -0,0 +1,7 @@ +{ + "args": "task -q --config deno.json echo string \"quoted string\"", + "output": "task_additional_args_nested_strings.out", + "envs": { + "NO_COLOR": "1" + } +} diff --git a/tests/specs/task/additional_args_nested_strings/deno.json b/tests/specs/task/additional_args_nested_strings/deno.json new file mode 100644 index 000000000..c1a379c46 --- /dev/null +++ b/tests/specs/task/additional_args_nested_strings/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "echo": "echo 1" + } +} diff --git a/tests/specs/task/additional_args_nested_strings/task_additional_args_nested_strings.out b/tests/specs/task/additional_args_nested_strings/task_additional_args_nested_strings.out new file mode 100644 index 000000000..0e5f35c7f --- /dev/null +++ b/tests/specs/task/additional_args_nested_strings/task_additional_args_nested_strings.out @@ -0,0 +1 @@ +1 string "quoted string" diff --git a/tests/specs/task/additional_args_no_logic/__test__.jsonc b/tests/specs/task/additional_args_no_logic/__test__.jsonc new file mode 100644 index 000000000..849f8bf66 --- /dev/null +++ b/tests/specs/task/additional_args_no_logic/__test__.jsonc @@ -0,0 +1,7 @@ +{ + "args": "task -q --config deno.json echo || echo 5", + "output": "task_additional_args_no_logic.out", + "envs": { + "NO_COLOR": "1" + } +} diff --git a/tests/specs/task/additional_args_no_logic/deno.json b/tests/specs/task/additional_args_no_logic/deno.json new file mode 100644 index 000000000..c1a379c46 --- /dev/null +++ b/tests/specs/task/additional_args_no_logic/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "echo": "echo 1" + } +} diff --git a/tests/specs/task/additional_args_no_logic/task_additional_args_no_logic.out b/tests/specs/task/additional_args_no_logic/task_additional_args_no_logic.out new file mode 100644 index 000000000..a4886a60d --- /dev/null +++ b/tests/specs/task/additional_args_no_logic/task_additional_args_no_logic.out @@ -0,0 +1 @@ +1 || echo 5 diff --git a/tests/specs/task/additional_args_no_shell_expansion/__test__.jsonc b/tests/specs/task/additional_args_no_shell_expansion/__test__.jsonc new file mode 100644 index 000000000..202321e39 --- /dev/null +++ b/tests/specs/task/additional_args_no_shell_expansion/__test__.jsonc @@ -0,0 +1,7 @@ +{ + "args": "task -q --config deno.json echo $(echo 5)", + "output": "task_additional_args_no_shell_expansion.out", + "envs": { + "NO_COLOR": "1" + } +} diff --git a/tests/specs/task/additional_args_no_shell_expansion/deno.json b/tests/specs/task/additional_args_no_shell_expansion/deno.json new file mode 100644 index 000000000..c1a379c46 --- /dev/null +++ b/tests/specs/task/additional_args_no_shell_expansion/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "echo": "echo 1" + } +} diff --git a/tests/specs/task/additional_args_no_shell_expansion/task_additional_args_no_shell_expansion.out b/tests/specs/task/additional_args_no_shell_expansion/task_additional_args_no_shell_expansion.out new file mode 100644 index 000000000..826a3aaf1 --- /dev/null +++ b/tests/specs/task/additional_args_no_shell_expansion/task_additional_args_no_shell_expansion.out @@ -0,0 +1 @@ +1 $(echo 5) diff --git a/tests/specs/task/boolean_logic/__test__.jsonc b/tests/specs/task/boolean_logic/__test__.jsonc new file mode 100644 index 000000000..c96e2256c --- /dev/null +++ b/tests/specs/task/boolean_logic/__test__.jsonc @@ -0,0 +1,7 @@ +{ + "args": "task -q --config deno.json boolean_logic", + "output": "task_boolean_logic.out", + "envs": { + "NO_COLOR": "1" + } +} diff --git a/tests/specs/task/boolean_logic/deno.json b/tests/specs/task/boolean_logic/deno.json new file mode 100644 index 000000000..4d3aeb4ce --- /dev/null +++ b/tests/specs/task/boolean_logic/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "boolean_logic": "sleep 0.1 && echo 3 && echo 4 & echo 1 && echo 2 || echo NOPE" + } +} diff --git a/tests/specs/task/boolean_logic/task_boolean_logic.out b/tests/specs/task/boolean_logic/task_boolean_logic.out new file mode 100644 index 000000000..94ebaf900 --- /dev/null +++ b/tests/specs/task/boolean_logic/task_boolean_logic.out @@ -0,0 +1,4 @@ +1 +2 +3 +4 diff --git a/tests/specs/task/both_deno_json_selected/__test__.jsonc b/tests/specs/task/both_deno_json_selected/__test__.jsonc new file mode 100644 index 000000000..7b0d31cbc --- /dev/null +++ b/tests/specs/task/both_deno_json_selected/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "task --config deno.json other", + "output": "deno_selected.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 0 +} diff --git a/tests/specs/task/both_deno_json_selected/deno.json b/tests/specs/task/both_deno_json_selected/deno.json new file mode 100644 index 000000000..1038609a4 --- /dev/null +++ b/tests/specs/task/both_deno_json_selected/deno.json @@ -0,0 +1,6 @@ +{ + "tasks": { + "output": "deno eval 'console.log(1)'", + "other": "deno eval 'console.log(2)'" + } +} diff --git a/tests/specs/task/both_deno_json_selected/deno_selected.out b/tests/specs/task/both_deno_json_selected/deno_selected.out new file mode 100644 index 000000000..f5bbab26d --- /dev/null +++ b/tests/specs/task/both_deno_json_selected/deno_selected.out @@ -0,0 +1,2 @@ +Task other deno eval 'console.log(2)' +2 diff --git a/tests/specs/task/both_no_arg/__test__.jsonc b/tests/specs/task/both_no_arg/__test__.jsonc new file mode 100644 index 000000000..c80db130e --- /dev/null +++ b/tests/specs/task/both_no_arg/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task --config deno.json", + "output": "no_args.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 1 +} diff --git a/tests/specs/task/both_no_arg/deno.json b/tests/specs/task/both_no_arg/deno.json new file mode 100644 index 000000000..1038609a4 --- /dev/null +++ b/tests/specs/task/both_no_arg/deno.json @@ -0,0 +1,6 @@ +{ + "tasks": { + "output": "deno eval 'console.log(1)'", + "other": "deno eval 'console.log(2)'" + } +} diff --git a/tests/specs/task/both_no_arg/no_args.out b/tests/specs/task/both_no_arg/no_args.out new file mode 100644 index 000000000..fce690b70 --- /dev/null +++ b/tests/specs/task/both_no_arg/no_args.out @@ -0,0 +1,7 @@ +Available tasks: +- output + deno eval 'console.log(1)' +- other + deno eval 'console.log(2)' +- bin (package.json) + cli-esm testing this out diff --git a/tests/specs/task/both_no_arg/package.json b/tests/specs/task/both_no_arg/package.json new file mode 100644 index 000000000..708ccc6b1 --- /dev/null +++ b/tests/specs/task/both_no_arg/package.json @@ -0,0 +1,9 @@ +{ + "scripts": { + "bin": "cli-esm testing this out", + "output": "echo should never be called or shown" + }, + "dependencies": { + "other": "npm:@denotest/bin@1.0" + } +} diff --git a/tests/specs/task/both_prefers_deno/__test__.jsonc b/tests/specs/task/both_prefers_deno/__test__.jsonc new file mode 100644 index 000000000..74bfedf8c --- /dev/null +++ b/tests/specs/task/both_prefers_deno/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "task --config deno.json output some text", + "output": "prefers_deno.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 0 +} diff --git a/tests/specs/task/both_prefers_deno/deno.json b/tests/specs/task/both_prefers_deno/deno.json new file mode 100644 index 000000000..1038609a4 --- /dev/null +++ b/tests/specs/task/both_prefers_deno/deno.json @@ -0,0 +1,6 @@ +{ + "tasks": { + "output": "deno eval 'console.log(1)'", + "other": "deno eval 'console.log(2)'" + } +} diff --git a/tests/specs/task/both_prefers_deno/prefers_deno.out b/tests/specs/task/both_prefers_deno/prefers_deno.out new file mode 100644 index 000000000..391737272 --- /dev/null +++ b/tests/specs/task/both_prefers_deno/prefers_deno.out @@ -0,0 +1,2 @@ +Task output deno eval 'console.log(1)' "some" "text" +1 diff --git a/tests/specs/task/cwd/__test__.jsonc b/tests/specs/task/cwd/__test__.jsonc new file mode 100644 index 000000000..c291fe0c9 --- /dev/null +++ b/tests/specs/task/cwd/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task -q --config deno.json --cwd .. echo_cwd", + "output": "task_cwd.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 0 +} diff --git a/tests/specs/task/cwd/deno.json b/tests/specs/task/cwd/deno.json new file mode 100644 index 000000000..b7f513a3f --- /dev/null +++ b/tests/specs/task/cwd/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "echo_cwd": "echo $(pwd)" + } +} diff --git a/tests/specs/task/cwd/task_cwd.out b/tests/specs/task/cwd/task_cwd.out new file mode 100644 index 000000000..1a8bf6ad0 --- /dev/null +++ b/tests/specs/task/cwd/task_cwd.out @@ -0,0 +1 @@ +[WILDCARD]task diff --git a/tests/specs/task/cwd_resolves_config_from_specified_dir/__test__.jsonc b/tests/specs/task/cwd_resolves_config_from_specified_dir/__test__.jsonc new file mode 100644 index 000000000..97898e14f --- /dev/null +++ b/tests/specs/task/cwd_resolves_config_from_specified_dir/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task -q --cwd deno.json", + "output": "task_no_args.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 1 +} diff --git a/tests/specs/task/cwd_resolves_config_from_specified_dir/deno.json b/tests/specs/task/cwd_resolves_config_from_specified_dir/deno.json new file mode 100644 index 000000000..c57426d25 --- /dev/null +++ b/tests/specs/task/cwd_resolves_config_from_specified_dir/deno.json @@ -0,0 +1,13 @@ +{ + "tasks": { + "boolean_logic": "sleep 0.1 && echo 3 && echo 4 & echo 1 && echo 2 || echo NOPE", + "echo": "echo 1", + "deno_echo": "deno eval 'console.log(5)'", + "strings": "deno run main.ts && deno eval \"console.log(\\\"test\\\")\"", + "piped": "echo 12345 | (deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)' && deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)')", + "exit_code_5": "echo $(echo 10 ; exit 2) && exit 5", + "echo_cwd": "echo $(pwd)", + "echo_init_cwd": "echo $INIT_CWD", + "echo_emoji": "echo 🔥" + } +} diff --git a/tests/specs/task/cwd_resolves_config_from_specified_dir/task_no_args.out b/tests/specs/task/cwd_resolves_config_from_specified_dir/task_no_args.out new file mode 100644 index 000000000..18f86fce6 --- /dev/null +++ b/tests/specs/task/cwd_resolves_config_from_specified_dir/task_no_args.out @@ -0,0 +1,19 @@ +Available tasks: +- boolean_logic + sleep 0.1 && echo 3 && echo 4 & echo 1 && echo 2 || echo NOPE +- echo + echo 1 +- deno_echo + deno eval 'console.log(5)' +- strings + deno run main.ts && deno eval "console.log(\"test\")" +- piped + echo 12345 | (deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)' && deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)') +- exit_code_5 + echo $(echo 10 ; exit 2) && exit 5 +- echo_cwd + echo $(pwd) +- echo_init_cwd + echo $INIT_CWD +- echo_emoji + echo 🔥 diff --git a/tests/specs/task/deno_exe_no_env/__test__.jsonc b/tests/specs/task/deno_exe_no_env/__test__.jsonc new file mode 100644 index 000000000..b021669e0 --- /dev/null +++ b/tests/specs/task/deno_exe_no_env/__test__.jsonc @@ -0,0 +1,7 @@ +{ + "args": "task -q --config deno.json deno_echo", + "output": "task_deno_exe_no_env.out", + "envs": { + "NO_COLOR": "1" + } +} diff --git a/tests/specs/task/deno_exe_no_env/deno.json b/tests/specs/task/deno_exe_no_env/deno.json new file mode 100644 index 000000000..d519e2139 --- /dev/null +++ b/tests/specs/task/deno_exe_no_env/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "deno_echo": "deno eval 'console.log(5)'" + } +} diff --git a/tests/specs/task/deno_exe_no_env/task_deno_exe_no_env.out b/tests/specs/task/deno_exe_no_env/task_deno_exe_no_env.out new file mode 100644 index 000000000..7ed6ff82d --- /dev/null +++ b/tests/specs/task/deno_exe_no_env/task_deno_exe_no_env.out @@ -0,0 +1 @@ +5 diff --git a/tests/specs/task/deno_no_pre_post/__test__.jsonc b/tests/specs/task/deno_no_pre_post/__test__.jsonc new file mode 100644 index 000000000..17bdc9ace --- /dev/null +++ b/tests/specs/task/deno_no_pre_post/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task --config deno.json test", + "output": "bin.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 0 +} diff --git a/tests/specs/task/deno_no_pre_post/bin.out b/tests/specs/task/deno_no_pre_post/bin.out new file mode 100644 index 000000000..ad66595f1 --- /dev/null +++ b/tests/specs/task/deno_no_pre_post/bin.out @@ -0,0 +1,2 @@ +Task test echo 'test' +test diff --git a/tests/specs/task/deno_no_pre_post/deno.json b/tests/specs/task/deno_no_pre_post/deno.json new file mode 100644 index 000000000..165b92e3a --- /dev/null +++ b/tests/specs/task/deno_no_pre_post/deno.json @@ -0,0 +1,7 @@ +{ + "tasks": { + "pretest": "echo 'pretest'", + "posttest": "echo 'posttest'", + "test": "echo 'test'" + } +} diff --git a/tests/specs/task/emoji/__test__.jsonc b/tests/specs/task/emoji/__test__.jsonc new file mode 100644 index 000000000..fde5b1545 --- /dev/null +++ b/tests/specs/task/emoji/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "task -q --cwd deno.json echo_emoji", + "output": "main.out" +} diff --git a/tests/specs/task/emoji/deno.json b/tests/specs/task/emoji/deno.json new file mode 100644 index 000000000..5ef0d014a --- /dev/null +++ b/tests/specs/task/emoji/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "echo_emoji": "echo 🔥" + } +} diff --git a/tests/specs/task/emoji/main.out b/tests/specs/task/emoji/main.out new file mode 100644 index 000000000..6ece63dc1 --- /dev/null +++ b/tests/specs/task/emoji/main.out @@ -0,0 +1 @@ +🔥 diff --git a/tests/specs/task/exit_code_5/__test__.jsonc b/tests/specs/task/exit_code_5/__test__.jsonc new file mode 100644 index 000000000..123710b78 --- /dev/null +++ b/tests/specs/task/exit_code_5/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task --config deno.json exit_code_5", + "output": "task_exit_code_5.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 5 +} diff --git a/tests/specs/task/exit_code_5/deno.json b/tests/specs/task/exit_code_5/deno.json new file mode 100644 index 000000000..a6e19c031 --- /dev/null +++ b/tests/specs/task/exit_code_5/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "exit_code_5": "echo $(echo 10 ; exit 2) && exit 5" + } +} diff --git a/tests/specs/task/exit_code_5/task_exit_code_5.out b/tests/specs/task/exit_code_5/task_exit_code_5.out new file mode 100644 index 000000000..12d171939 --- /dev/null +++ b/tests/specs/task/exit_code_5/task_exit_code_5.out @@ -0,0 +1,2 @@ +Task exit_code_5 echo $(echo 10 ; exit 2) && exit 5 +10 diff --git a/tests/specs/task/init_cwd/__test__.jsonc b/tests/specs/task/init_cwd/__test__.jsonc new file mode 100644 index 000000000..e40d7fef3 --- /dev/null +++ b/tests/specs/task/init_cwd/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task -q --config deno.json --cwd .. echo_init_cwd", + "output": "task_init_cwd.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 0 +} diff --git a/tests/specs/task/init_cwd/deno.json b/tests/specs/task/init_cwd/deno.json new file mode 100644 index 000000000..93abead1d --- /dev/null +++ b/tests/specs/task/init_cwd/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "echo_init_cwd": "echo $INIT_CWD" + } +} diff --git a/tests/specs/task/init_cwd/task_init_cwd.out b/tests/specs/task/init_cwd/task_init_cwd.out new file mode 100644 index 000000000..fee54862e --- /dev/null +++ b/tests/specs/task/init_cwd/task_init_cwd.out @@ -0,0 +1 @@ +[WILDCARD]init_cwd diff --git a/tests/specs/task/init_cwd_already_set/__test__.jsonc b/tests/specs/task/init_cwd_already_set/__test__.jsonc new file mode 100644 index 000000000..30e2091ea --- /dev/null +++ b/tests/specs/task/init_cwd_already_set/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "task -q --config deno.json echo_init_cwd", + "output": "task_init_cwd_already_set.out", + "envs": { + "NO_COLOR": "1", + "INIT_CWD": "HELLO" + }, + "exitCode": 0 +} diff --git a/tests/specs/task/init_cwd_already_set/deno.json b/tests/specs/task/init_cwd_already_set/deno.json new file mode 100644 index 000000000..93abead1d --- /dev/null +++ b/tests/specs/task/init_cwd_already_set/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "echo_init_cwd": "echo $INIT_CWD" + } +} diff --git a/tests/specs/task/init_cwd_already_set/task_init_cwd_already_set.out b/tests/specs/task/init_cwd_already_set/task_init_cwd_already_set.out new file mode 100644 index 000000000..e427984d4 --- /dev/null +++ b/tests/specs/task/init_cwd_already_set/task_init_cwd_already_set.out @@ -0,0 +1 @@ +HELLO diff --git a/tests/specs/task/no_args/__test__.jsonc b/tests/specs/task/no_args/__test__.jsonc new file mode 100644 index 000000000..9ec24d1d2 --- /dev/null +++ b/tests/specs/task/no_args/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task -q --config deno.json", + "output": "task_no_args.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 1 +} diff --git a/tests/specs/task/no_args/deno.json b/tests/specs/task/no_args/deno.json new file mode 100644 index 000000000..c57426d25 --- /dev/null +++ b/tests/specs/task/no_args/deno.json @@ -0,0 +1,13 @@ +{ + "tasks": { + "boolean_logic": "sleep 0.1 && echo 3 && echo 4 & echo 1 && echo 2 || echo NOPE", + "echo": "echo 1", + "deno_echo": "deno eval 'console.log(5)'", + "strings": "deno run main.ts && deno eval \"console.log(\\\"test\\\")\"", + "piped": "echo 12345 | (deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)' && deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)')", + "exit_code_5": "echo $(echo 10 ; exit 2) && exit 5", + "echo_cwd": "echo $(pwd)", + "echo_init_cwd": "echo $INIT_CWD", + "echo_emoji": "echo 🔥" + } +} diff --git a/tests/specs/task/no_args/task_no_args.out b/tests/specs/task/no_args/task_no_args.out new file mode 100644 index 000000000..18f86fce6 --- /dev/null +++ b/tests/specs/task/no_args/task_no_args.out @@ -0,0 +1,19 @@ +Available tasks: +- boolean_logic + sleep 0.1 && echo 3 && echo 4 & echo 1 && echo 2 || echo NOPE +- echo + echo 1 +- deno_echo + deno eval 'console.log(5)' +- strings + deno run main.ts && deno eval "console.log(\"test\")" +- piped + echo 12345 | (deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)' && deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)') +- exit_code_5 + echo $(echo 10 ; exit 2) && exit 5 +- echo_cwd + echo $(pwd) +- echo_init_cwd + echo $INIT_CWD +- echo_emoji + echo 🔥 diff --git a/tests/specs/task/non_existent/__test__.jsonc b/tests/specs/task/non_existent/__test__.jsonc new file mode 100644 index 000000000..e34674bee --- /dev/null +++ b/tests/specs/task/non_existent/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task --config deno.json non_existent", + "output": "task_non_existent.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 1 +} diff --git a/tests/specs/task/non_existent/deno.json b/tests/specs/task/non_existent/deno.json new file mode 100644 index 000000000..c57426d25 --- /dev/null +++ b/tests/specs/task/non_existent/deno.json @@ -0,0 +1,13 @@ +{ + "tasks": { + "boolean_logic": "sleep 0.1 && echo 3 && echo 4 & echo 1 && echo 2 || echo NOPE", + "echo": "echo 1", + "deno_echo": "deno eval 'console.log(5)'", + "strings": "deno run main.ts && deno eval \"console.log(\\\"test\\\")\"", + "piped": "echo 12345 | (deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)' && deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)')", + "exit_code_5": "echo $(echo 10 ; exit 2) && exit 5", + "echo_cwd": "echo $(pwd)", + "echo_init_cwd": "echo $INIT_CWD", + "echo_emoji": "echo 🔥" + } +} diff --git a/tests/specs/task/non_existent/task_non_existent.out b/tests/specs/task/non_existent/task_non_existent.out new file mode 100644 index 000000000..efe3805f6 --- /dev/null +++ b/tests/specs/task/non_existent/task_non_existent.out @@ -0,0 +1,20 @@ +Task not found: non_existent +Available tasks: +- boolean_logic + sleep 0.1 && echo 3 && echo 4 & echo 1 && echo 2 || echo NOPE +- echo + echo 1 +- deno_echo + deno eval 'console.log(5)' +- strings + deno run main.ts && deno eval "console.log(\"test\")" +- piped + echo 12345 | (deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)' && deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)') +- exit_code_5 + echo $(echo 10 ; exit 2) && exit 5 +- echo_cwd + echo $(pwd) +- echo_init_cwd + echo $INIT_CWD +- echo_emoji + echo 🔥 diff --git a/tests/specs/task/npx_non_existent/__test__.jsonc b/tests/specs/task/npx_non_existent/__test__.jsonc new file mode 100644 index 000000000..8678a37bd --- /dev/null +++ b/tests/specs/task/npx_non_existent/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "task non-existent", + "output": "non_existent.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/specs/task/npx_non_existent/non_existent.out b/tests/specs/task/npx_non_existent/non_existent.out new file mode 100644 index 000000000..c079aec4e --- /dev/null +++ b/tests/specs/task/npx_non_existent/non_existent.out @@ -0,0 +1,4 @@ +Task non-existent npx this-command-should-not-exist-for-you +npm [WILDCARD] code E404 +npm [WILDCARD] 404 Not Found - GET http://localhost:4260/this-command-should-not-exist-for-you +[WILDCARD] diff --git a/tests/specs/task/npx_non_existent/package.json b/tests/specs/task/npx_non_existent/package.json new file mode 100644 index 000000000..59602b96f --- /dev/null +++ b/tests/specs/task/npx_non_existent/package.json @@ -0,0 +1,6 @@ +{ + "scripts": { + "non-existent": "npx this-command-should-not-exist-for-you", + "on-own": "npx" + } +} diff --git a/tests/specs/task/package_json_echo/__test__.jsonc b/tests/specs/task/package_json_echo/__test__.jsonc new file mode 100644 index 000000000..616f72f78 --- /dev/null +++ b/tests/specs/task/package_json_echo/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "task --quiet echo", + "output": "echo.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 0 +} diff --git a/tests/specs/task/package_json_echo/echo.out b/tests/specs/task/package_json_echo/echo.out new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/specs/task/package_json_echo/echo.out @@ -0,0 +1 @@ +1 diff --git a/tests/specs/task/package_json_echo/package.json b/tests/specs/task/package_json_echo/package.json new file mode 100644 index 000000000..cedbe2d5b --- /dev/null +++ b/tests/specs/task/package_json_echo/package.json @@ -0,0 +1,10 @@ +{ + "scripts": { + "echo": "deno eval 'console.log(1)'", + "bin": "@denotest/bin hi && cli-esm testing this out && npx cli-cjs test" + }, + "dependencies": { + "@denotest/bin": "0.5", + "other": "npm:@denotest/bin@1.0" + } +} diff --git a/tests/specs/task/package_json_no_arg/__test__.jsonc b/tests/specs/task/package_json_no_arg/__test__.jsonc new file mode 100644 index 000000000..2d7b75a2f --- /dev/null +++ b/tests/specs/task/package_json_no_arg/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task", + "output": "no_args.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 1 +} diff --git a/tests/specs/task/package_json_no_arg/no_args.out b/tests/specs/task/package_json_no_arg/no_args.out new file mode 100644 index 000000000..de149ccf9 --- /dev/null +++ b/tests/specs/task/package_json_no_arg/no_args.out @@ -0,0 +1,5 @@ +Available tasks: +- echo (package.json) + deno eval 'console.log(1)' +- bin (package.json) + @denotest/bin hi && cli-esm testing this out && npx cli-cjs test diff --git a/tests/specs/task/package_json_no_arg/package.json b/tests/specs/task/package_json_no_arg/package.json new file mode 100644 index 000000000..cedbe2d5b --- /dev/null +++ b/tests/specs/task/package_json_no_arg/package.json @@ -0,0 +1,10 @@ +{ + "scripts": { + "echo": "deno eval 'console.log(1)'", + "bin": "@denotest/bin hi && cli-esm testing this out && npx cli-cjs test" + }, + "dependencies": { + "@denotest/bin": "0.5", + "other": "npm:@denotest/bin@1.0" + } +} diff --git a/tests/specs/task/piped_stdin/__test__.jsonc b/tests/specs/task/piped_stdin/__test__.jsonc new file mode 100644 index 000000000..73220430a --- /dev/null +++ b/tests/specs/task/piped_stdin/__test__.jsonc @@ -0,0 +1,7 @@ +{ + "args": "task -q --config deno.json piped", + "output": "task_piped_stdin.out", + "envs": { + "NO_COLOR": "1" + } +} diff --git a/tests/specs/task/piped_stdin/deno.json b/tests/specs/task/piped_stdin/deno.json new file mode 100644 index 000000000..bb3d1cd29 --- /dev/null +++ b/tests/specs/task/piped_stdin/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "piped": "echo 12345 | (deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)' && deno eval 'const b = new Uint8Array(1);Deno.stdin.readSync(b);console.log(b)')" + } +} diff --git a/tests/specs/task/piped_stdin/task_piped_stdin.out b/tests/specs/task/piped_stdin/task_piped_stdin.out new file mode 100644 index 000000000..a0d636f15 --- /dev/null +++ b/tests/specs/task/piped_stdin/task_piped_stdin.out @@ -0,0 +1,2 @@ +Uint8Array(1) [ 49 ] +Uint8Array(1) [ 50 ] diff --git a/tests/specs/task/post/__test__.jsonc b/tests/specs/task/post/__test__.jsonc new file mode 100644 index 000000000..3ea55d456 --- /dev/null +++ b/tests/specs/task/post/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task test", + "output": "bin.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 0 +} diff --git a/tests/specs/task/post/bin.out b/tests/specs/task/post/bin.out new file mode 100644 index 000000000..96e5ca910 --- /dev/null +++ b/tests/specs/task/post/bin.out @@ -0,0 +1,4 @@ +Task test echo 'test' +test +Task posttest echo 'posttest' +posttest diff --git a/tests/specs/task/post/package.json b/tests/specs/task/post/package.json new file mode 100644 index 000000000..82689f7d4 --- /dev/null +++ b/tests/specs/task/post/package.json @@ -0,0 +1,6 @@ +{ + "scripts": { + "posttest": "echo 'posttest'", + "test": "echo 'test'" + } +} diff --git a/tests/specs/task/post_only/__test__.jsonc b/tests/specs/task/post_only/__test__.jsonc new file mode 100644 index 000000000..4c37e3e63 --- /dev/null +++ b/tests/specs/task/post_only/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task test", + "output": "bin.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 1 +} diff --git a/tests/specs/task/post_only/bin.out b/tests/specs/task/post_only/bin.out new file mode 100644 index 000000000..9e7cea091 --- /dev/null +++ b/tests/specs/task/post_only/bin.out @@ -0,0 +1,4 @@ +Task not found: test +Available tasks: +- posttest (package.json) + echo 'posttest' diff --git a/tests/specs/task/post_only/package.json b/tests/specs/task/post_only/package.json new file mode 100644 index 000000000..ce8a6bbd5 --- /dev/null +++ b/tests/specs/task/post_only/package.json @@ -0,0 +1,5 @@ +{ + "scripts": { + "posttest": "echo 'posttest'" + } +} diff --git a/tests/specs/task/pre/__test__.jsonc b/tests/specs/task/pre/__test__.jsonc new file mode 100644 index 000000000..3ea55d456 --- /dev/null +++ b/tests/specs/task/pre/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task test", + "output": "bin.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 0 +} diff --git a/tests/specs/task/pre/bin.out b/tests/specs/task/pre/bin.out new file mode 100644 index 000000000..f22961832 --- /dev/null +++ b/tests/specs/task/pre/bin.out @@ -0,0 +1,4 @@ +Task pretest echo 'pretest' +pretest +Task test echo 'test' +test diff --git a/tests/specs/task/pre/package.json b/tests/specs/task/pre/package.json new file mode 100644 index 000000000..d3eba02a1 --- /dev/null +++ b/tests/specs/task/pre/package.json @@ -0,0 +1,6 @@ +{ + "scripts": { + "test": "echo 'test'", + "pretest": "echo 'pretest'" + } +} diff --git a/tests/specs/task/pre_only/__test__.jsonc b/tests/specs/task/pre_only/__test__.jsonc new file mode 100644 index 000000000..4c37e3e63 --- /dev/null +++ b/tests/specs/task/pre_only/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task test", + "output": "bin.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 1 +} diff --git a/tests/specs/task/pre_only/bin.out b/tests/specs/task/pre_only/bin.out new file mode 100644 index 000000000..e96e8e341 --- /dev/null +++ b/tests/specs/task/pre_only/bin.out @@ -0,0 +1,4 @@ +Task not found: test +Available tasks: +- pretest (package.json) + echo 'pretest' diff --git a/tests/specs/task/pre_only/package.json b/tests/specs/task/pre_only/package.json new file mode 100644 index 000000000..032a5d4ea --- /dev/null +++ b/tests/specs/task/pre_only/package.json @@ -0,0 +1,5 @@ +{ + "scripts": { + "pretest": "echo 'pretest'" + } +} diff --git a/tests/specs/task/pre_post/__test__.jsonc b/tests/specs/task/pre_post/__test__.jsonc new file mode 100644 index 000000000..3ea55d456 --- /dev/null +++ b/tests/specs/task/pre_post/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "task test", + "output": "bin.out", + "envs": { + "NO_COLOR": "1" + }, + "exitCode": 0 +} diff --git a/tests/specs/task/pre_post/bin.out b/tests/specs/task/pre_post/bin.out new file mode 100644 index 000000000..8c4abc6be --- /dev/null +++ b/tests/specs/task/pre_post/bin.out @@ -0,0 +1,6 @@ +Task pretest echo 'pretest' +pretest +Task test echo 'test' +test +Task posttest echo 'posttest' +posttest diff --git a/tests/specs/task/pre_post/package.json b/tests/specs/task/pre_post/package.json new file mode 100644 index 000000000..24a3ff1ed --- /dev/null +++ b/tests/specs/task/pre_post/package.json @@ -0,0 +1,7 @@ +{ + "scripts": { + "pretest": "echo 'pretest'", + "posttest": "echo 'posttest'", + "test": "echo 'test'" + } +} |