diff options
Diffstat (limited to 'tests/testdata/task')
49 files changed, 222 insertions, 0 deletions
diff --git a/tests/testdata/task/both/deno.json b/tests/testdata/task/both/deno.json new file mode 100644 index 000000000..1038609a4 --- /dev/null +++ b/tests/testdata/task/both/deno.json @@ -0,0 +1,6 @@ +{ + "tasks": { + "output": "deno eval 'console.log(1)'", + "other": "deno eval 'console.log(2)'" + } +} diff --git a/tests/testdata/task/both/deno_selected.out b/tests/testdata/task/both/deno_selected.out new file mode 100644 index 000000000..f5bbab26d --- /dev/null +++ b/tests/testdata/task/both/deno_selected.out @@ -0,0 +1,2 @@ +Task other deno eval 'console.log(2)' +2 diff --git a/tests/testdata/task/both/echo.out b/tests/testdata/task/both/echo.out new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/testdata/task/both/echo.out diff --git a/tests/testdata/task/both/no_args.out b/tests/testdata/task/both/no_args.out new file mode 100644 index 000000000..fce690b70 --- /dev/null +++ b/tests/testdata/task/both/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/testdata/task/both/package.json b/tests/testdata/task/both/package.json new file mode 100644 index 000000000..708ccc6b1 --- /dev/null +++ b/tests/testdata/task/both/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/testdata/task/both/package_json_selected.out b/tests/testdata/task/both/package_json_selected.out new file mode 100644 index 000000000..3dd1ecafa --- /dev/null +++ b/tests/testdata/task/both/package_json_selected.out @@ -0,0 +1,8 @@ +Download http://localhost:4545/npm/registry/@denotest/bin +Download http://localhost:4545/npm/registry/@denotest/bin/1.0.0.tgz +Initialize @denotest/bin@1.0.0 +Task bin cli-esm testing this out "asdf" +testing +this +out +asdf diff --git a/tests/testdata/task/both/prefers_deno.out b/tests/testdata/task/both/prefers_deno.out new file mode 100644 index 000000000..391737272 --- /dev/null +++ b/tests/testdata/task/both/prefers_deno.out @@ -0,0 +1,2 @@ +Task output deno eval 'console.log(1)' "some" "text" +1 diff --git a/tests/testdata/task/deno_json/deno.json b/tests/testdata/task/deno_json/deno.json new file mode 100644 index 000000000..c57426d25 --- /dev/null +++ b/tests/testdata/task/deno_json/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/testdata/task/deno_json/task_additional_args.out b/tests/testdata/task/deno_json/task_additional_args.out new file mode 100644 index 000000000..8d04f961a --- /dev/null +++ b/tests/testdata/task/deno_json/task_additional_args.out @@ -0,0 +1 @@ +1 2 diff --git a/tests/testdata/task/deno_json/task_additional_args_nested_strings.out b/tests/testdata/task/deno_json/task_additional_args_nested_strings.out new file mode 100644 index 000000000..0e5f35c7f --- /dev/null +++ b/tests/testdata/task/deno_json/task_additional_args_nested_strings.out @@ -0,0 +1 @@ +1 string "quoted string" diff --git a/tests/testdata/task/deno_json/task_additional_args_no_logic.out b/tests/testdata/task/deno_json/task_additional_args_no_logic.out new file mode 100644 index 000000000..a4886a60d --- /dev/null +++ b/tests/testdata/task/deno_json/task_additional_args_no_logic.out @@ -0,0 +1 @@ +1 || echo 5 diff --git a/tests/testdata/task/deno_json/task_additional_args_no_shell_expansion.out b/tests/testdata/task/deno_json/task_additional_args_no_shell_expansion.out new file mode 100644 index 000000000..826a3aaf1 --- /dev/null +++ b/tests/testdata/task/deno_json/task_additional_args_no_shell_expansion.out @@ -0,0 +1 @@ +1 $(echo 5) diff --git a/tests/testdata/task/deno_json/task_boolean_logic.out b/tests/testdata/task/deno_json/task_boolean_logic.out new file mode 100644 index 000000000..94ebaf900 --- /dev/null +++ b/tests/testdata/task/deno_json/task_boolean_logic.out @@ -0,0 +1,4 @@ +1 +2 +3 +4 diff --git a/tests/testdata/task/deno_json/task_cwd.out b/tests/testdata/task/deno_json/task_cwd.out new file mode 100644 index 000000000..bfe3e7b11 --- /dev/null +++ b/tests/testdata/task/deno_json/task_cwd.out @@ -0,0 +1 @@ +[WILDCARD]tests diff --git a/tests/testdata/task/deno_json/task_deno_exe_no_env.out b/tests/testdata/task/deno_json/task_deno_exe_no_env.out new file mode 100644 index 000000000..7ed6ff82d --- /dev/null +++ b/tests/testdata/task/deno_json/task_deno_exe_no_env.out @@ -0,0 +1 @@ +5 diff --git a/tests/testdata/task/deno_json/task_exit_code_5.out b/tests/testdata/task/deno_json/task_exit_code_5.out new file mode 100644 index 000000000..12d171939 --- /dev/null +++ b/tests/testdata/task/deno_json/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/testdata/task/deno_json/task_init_cwd.out b/tests/testdata/task/deno_json/task_init_cwd.out new file mode 100644 index 000000000..95ea8a545 --- /dev/null +++ b/tests/testdata/task/deno_json/task_init_cwd.out @@ -0,0 +1 @@ +[WILDCARD]testdata diff --git a/tests/testdata/task/deno_json/task_init_cwd_already_set.out b/tests/testdata/task/deno_json/task_init_cwd_already_set.out new file mode 100644 index 000000000..e427984d4 --- /dev/null +++ b/tests/testdata/task/deno_json/task_init_cwd_already_set.out @@ -0,0 +1 @@ +HELLO diff --git a/tests/testdata/task/deno_json/task_no_args.out b/tests/testdata/task/deno_json/task_no_args.out new file mode 100644 index 000000000..18f86fce6 --- /dev/null +++ b/tests/testdata/task/deno_json/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/testdata/task/deno_json/task_non_existent.out b/tests/testdata/task/deno_json/task_non_existent.out new file mode 100644 index 000000000..efe3805f6 --- /dev/null +++ b/tests/testdata/task/deno_json/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/testdata/task/deno_json/task_piped_stdin.out b/tests/testdata/task/deno_json/task_piped_stdin.out new file mode 100644 index 000000000..a0d636f15 --- /dev/null +++ b/tests/testdata/task/deno_json/task_piped_stdin.out @@ -0,0 +1,2 @@ +Uint8Array(1) [ 49 ] +Uint8Array(1) [ 50 ] diff --git a/tests/testdata/task/deno_json_pre_post/bin.out b/tests/testdata/task/deno_json_pre_post/bin.out new file mode 100644 index 000000000..ad66595f1 --- /dev/null +++ b/tests/testdata/task/deno_json_pre_post/bin.out @@ -0,0 +1,2 @@ +Task test echo 'test' +test diff --git a/tests/testdata/task/deno_json_pre_post/deno.json b/tests/testdata/task/deno_json_pre_post/deno.json new file mode 100644 index 000000000..165b92e3a --- /dev/null +++ b/tests/testdata/task/deno_json_pre_post/deno.json @@ -0,0 +1,7 @@ +{ + "tasks": { + "pretest": "echo 'pretest'", + "posttest": "echo 'posttest'", + "test": "echo 'test'" + } +} diff --git a/tests/testdata/task/deno_json_pre_post/echo.out b/tests/testdata/task/deno_json_pre_post/echo.out new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/testdata/task/deno_json_pre_post/echo.out @@ -0,0 +1 @@ +0 diff --git a/tests/testdata/task/npx/non_existent.out b/tests/testdata/task/npx/non_existent.out new file mode 100644 index 000000000..5df04917e --- /dev/null +++ b/tests/testdata/task/npx/non_existent.out @@ -0,0 +1,2 @@ +Task non-existent npx this-command-should-not-exist-for-you +npx: could not resolve command 'this-command-should-not-exist-for-you' diff --git a/tests/testdata/task/npx/on_own.out b/tests/testdata/task/npx/on_own.out new file mode 100644 index 000000000..67491f7b0 --- /dev/null +++ b/tests/testdata/task/npx/on_own.out @@ -0,0 +1,2 @@ +Task on-own npx +npx: missing command diff --git a/tests/testdata/task/npx/package.json b/tests/testdata/task/npx/package.json new file mode 100644 index 000000000..59602b96f --- /dev/null +++ b/tests/testdata/task/npx/package.json @@ -0,0 +1,6 @@ +{ + "scripts": { + "non-existent": "npx this-command-should-not-exist-for-you", + "on-own": "npx" + } +} diff --git a/tests/testdata/task/package_json/bin.out b/tests/testdata/task/package_json/bin.out new file mode 100644 index 000000000..bf4693afc --- /dev/null +++ b/tests/testdata/task/package_json/bin.out @@ -0,0 +1,14 @@ +Download http://localhost:4545/npm/registry/@denotest/bin +[UNORDERED_START] +Download http://localhost:4545/npm/registry/@denotest/bin/0.5.0.tgz +Initialize @denotest/bin@0.5.0 +Download http://localhost:4545/npm/registry/@denotest/bin/1.0.0.tgz +Initialize @denotest/bin@1.0.0 +[UNORDERED_END] +Task bin @denotest/bin hi && cli-esm testing this out && npx cli-cjs test "extra" +hi +testing +this +out +test +extra diff --git a/tests/testdata/task/package_json/echo.out b/tests/testdata/task/package_json/echo.out new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/testdata/task/package_json/echo.out @@ -0,0 +1 @@ +1 diff --git a/tests/testdata/task/package_json/no_args.out b/tests/testdata/task/package_json/no_args.out new file mode 100644 index 000000000..de149ccf9 --- /dev/null +++ b/tests/testdata/task/package_json/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/testdata/task/package_json/package.json b/tests/testdata/task/package_json/package.json new file mode 100644 index 000000000..cedbe2d5b --- /dev/null +++ b/tests/testdata/task/package_json/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/testdata/task/package_json_node_modules_dir_false/bin.out b/tests/testdata/task/package_json_node_modules_dir_false/bin.out new file mode 100644 index 000000000..d5d59d551 --- /dev/null +++ b/tests/testdata/task/package_json_node_modules_dir_false/bin.out @@ -0,0 +1,2 @@ +Task echo deno eval 'console.log(1)' +1 diff --git a/tests/testdata/task/package_json_node_modules_dir_false/deno.json b/tests/testdata/task/package_json_node_modules_dir_false/deno.json new file mode 100644 index 000000000..23a325cfc --- /dev/null +++ b/tests/testdata/task/package_json_node_modules_dir_false/deno.json @@ -0,0 +1,3 @@ +{ + "nodeModulesDir": false +} diff --git a/tests/testdata/task/package_json_node_modules_dir_false/package.json b/tests/testdata/task/package_json_node_modules_dir_false/package.json new file mode 100644 index 000000000..081e076b9 --- /dev/null +++ b/tests/testdata/task/package_json_node_modules_dir_false/package.json @@ -0,0 +1,9 @@ +{ + "scripts": { + "echo": "deno eval 'console.log(1)'" + }, + "dependencies": { + "@denotest/bin": "0.5", + "other": "npm:@denotest/bin@1.0" + } +} diff --git a/tests/testdata/task/package_json_post/bin.out b/tests/testdata/task/package_json_post/bin.out new file mode 100644 index 000000000..96e5ca910 --- /dev/null +++ b/tests/testdata/task/package_json_post/bin.out @@ -0,0 +1,4 @@ +Task test echo 'test' +test +Task posttest echo 'posttest' +posttest diff --git a/tests/testdata/task/package_json_post/echo.out b/tests/testdata/task/package_json_post/echo.out new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/testdata/task/package_json_post/echo.out @@ -0,0 +1 @@ +0 diff --git a/tests/testdata/task/package_json_post/package.json b/tests/testdata/task/package_json_post/package.json new file mode 100644 index 000000000..82689f7d4 --- /dev/null +++ b/tests/testdata/task/package_json_post/package.json @@ -0,0 +1,6 @@ +{ + "scripts": { + "posttest": "echo 'posttest'", + "test": "echo 'test'" + } +} diff --git a/tests/testdata/task/package_json_post_only/bin.out b/tests/testdata/task/package_json_post_only/bin.out new file mode 100644 index 000000000..9e7cea091 --- /dev/null +++ b/tests/testdata/task/package_json_post_only/bin.out @@ -0,0 +1,4 @@ +Task not found: test +Available tasks: +- posttest (package.json) + echo 'posttest' diff --git a/tests/testdata/task/package_json_post_only/echo.out b/tests/testdata/task/package_json_post_only/echo.out new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/testdata/task/package_json_post_only/echo.out @@ -0,0 +1 @@ +0 diff --git a/tests/testdata/task/package_json_post_only/package.json b/tests/testdata/task/package_json_post_only/package.json new file mode 100644 index 000000000..ce8a6bbd5 --- /dev/null +++ b/tests/testdata/task/package_json_post_only/package.json @@ -0,0 +1,5 @@ +{ + "scripts": { + "posttest": "echo 'posttest'" + } +} diff --git a/tests/testdata/task/package_json_pre/bin.out b/tests/testdata/task/package_json_pre/bin.out new file mode 100644 index 000000000..f22961832 --- /dev/null +++ b/tests/testdata/task/package_json_pre/bin.out @@ -0,0 +1,4 @@ +Task pretest echo 'pretest' +pretest +Task test echo 'test' +test diff --git a/tests/testdata/task/package_json_pre/echo.out b/tests/testdata/task/package_json_pre/echo.out new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/testdata/task/package_json_pre/echo.out @@ -0,0 +1 @@ +0 diff --git a/tests/testdata/task/package_json_pre/package.json b/tests/testdata/task/package_json_pre/package.json new file mode 100644 index 000000000..d3eba02a1 --- /dev/null +++ b/tests/testdata/task/package_json_pre/package.json @@ -0,0 +1,6 @@ +{ + "scripts": { + "test": "echo 'test'", + "pretest": "echo 'pretest'" + } +} diff --git a/tests/testdata/task/package_json_pre_only/bin.out b/tests/testdata/task/package_json_pre_only/bin.out new file mode 100644 index 000000000..e96e8e341 --- /dev/null +++ b/tests/testdata/task/package_json_pre_only/bin.out @@ -0,0 +1,4 @@ +Task not found: test +Available tasks: +- pretest (package.json) + echo 'pretest' diff --git a/tests/testdata/task/package_json_pre_only/echo.out b/tests/testdata/task/package_json_pre_only/echo.out new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/tests/testdata/task/package_json_pre_only/echo.out @@ -0,0 +1 @@ +1 diff --git a/tests/testdata/task/package_json_pre_only/package.json b/tests/testdata/task/package_json_pre_only/package.json new file mode 100644 index 000000000..032a5d4ea --- /dev/null +++ b/tests/testdata/task/package_json_pre_only/package.json @@ -0,0 +1,5 @@ +{ + "scripts": { + "pretest": "echo 'pretest'" + } +} diff --git a/tests/testdata/task/package_json_pre_post/bin.out b/tests/testdata/task/package_json_pre_post/bin.out new file mode 100644 index 000000000..8c4abc6be --- /dev/null +++ b/tests/testdata/task/package_json_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/testdata/task/package_json_pre_post/echo.out b/tests/testdata/task/package_json_pre_post/echo.out new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/testdata/task/package_json_pre_post/echo.out @@ -0,0 +1 @@ +0 diff --git a/tests/testdata/task/package_json_pre_post/package.json b/tests/testdata/task/package_json_pre_post/package.json new file mode 100644 index 000000000..24a3ff1ed --- /dev/null +++ b/tests/testdata/task/package_json_pre_post/package.json @@ -0,0 +1,7 @@ +{ + "scripts": { + "pretest": "echo 'pretest'", + "posttest": "echo 'posttest'", + "test": "echo 'test'" + } +} |