diff options
67 files changed, 309 insertions, 106 deletions
diff --git a/tests/integration/check_tests.rs b/tests/integration/check_tests.rs index d3111727c..1ccec41eb 100644 --- a/tests/integration/check_tests.rs +++ b/tests/integration/check_tests.rs @@ -246,39 +246,6 @@ itest!(check_dts { exit_code: 1, }); -// TODO(2.0): this should be rewritten to a spec test and first run `deno install` -// itest!(package_json_basic { -// args: "check main.ts", -// output: "package_json/basic/main.check.out", -// envs: env_vars_for_npm_tests(), -// http_server: true, -// cwd: Some("package_json/basic"), -// copy_temp_dir: Some("package_json/basic"), -// exit_code: 0, -// }); - -// TODO(2.0): this should be rewritten to a spec test and first run `deno install` -// itest!(package_json_fail_check { -// args: "check --quiet fail_check.ts", -// output: "package_json/basic/fail_check.check.out", -// envs: env_vars_for_npm_tests(), -// http_server: true, -// cwd: Some("package_json/basic"), -// copy_temp_dir: Some("package_json/basic"), -// exit_code: 1, -// }); - -// TODO(2.0): this should be rewritten to a spec test and first run `deno install` -// itest!(package_json_with_deno_json { -// args: "check --quiet main.ts", -// output: "package_json/deno_json/main.check.out", -// cwd: Some("package_json/deno_json/"), -// copy_temp_dir: Some("package_json/deno_json/"), -// envs: env_vars_for_npm_tests(), -// http_server: true, -// exit_code: 1, -// }); - #[test] fn check_error_in_dep_then_fix() { let test_context = TestContextBuilder::new().use_temp_cwd().build(); diff --git a/tests/integration/info_tests.rs b/tests/integration/info_tests.rs index 38dd9448f..7699baba8 100644 --- a/tests/integration/info_tests.rs +++ b/tests/integration/info_tests.rs @@ -2,7 +2,6 @@ use test_util as util; use test_util::itest; -// use util::env_vars_for_npm_tests; use util::TestContextBuilder; #[test] @@ -110,17 +109,6 @@ itest!(with_config_override { output: "info/with_config/with_config.out", }); -// TODO(2.0): this test should be a spec test and first run `deno install` -// itest!(package_json_basic { -// args: "info --quiet main.ts", -// output: "package_json/basic/main.info.out", -// envs: env_vars_for_npm_tests(), -// http_server: true, -// cwd: Some("package_json/basic"), -// copy_temp_dir: Some("package_json/basic"), -// exit_code: 0, -// }); - itest!(info_import_map { args: "info preact/debug", output: "info/with_import_map/with_import_map.out", diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index c10f0d1ea..95b6e5a01 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -3359,42 +3359,6 @@ itest!( } ); -// TODO(2.0): this should be rewritten to a spec test and first run `deno install` -// itest!(package_json_auto_discovered_for_npm_binary { -// args: "run -L debug -A npm:@denotest/bin/cli-esm this is a test", -// output: "run/with_package_json/npm_binary/main.out", -// cwd: Some("run/with_package_json/npm_binary/"), -// copy_temp_dir: Some("run/with_package_json/"), -// envs: env_vars_for_npm_tests(), -// http_server: true, -// }); - -// TODO(2.0): this should be rewritten to a spec test and first run `deno install` -#[test] -#[ignore] -fn package_json_with_deno_json() { - let context = TestContextBuilder::for_npm() - .use_copy_temp_dir("package_json/deno_json/") - .cwd("package_json/deno_json/") - .build(); - let output = context.new_command().args("run --quiet -A main.ts").run(); - output.assert_matches_file("package_json/deno_json/main.out"); - - assert!(context - .temp_dir() - .path() - .join("package_json/deno_json/deno.lock") - .exists()); - - // run again and ensure the top level install doesn't happen twice - let output = context - .new_command() - .args("run --log-level=debug -A main.ts") - .run(); - let output = output.combined_output(); - assert_contains!(output, "Skipping top level install."); -} - #[test] fn package_json_no_node_modules_dir_created() { // it should not create a node_modules directory diff --git a/tests/integration/test_tests.rs b/tests/integration/test_tests.rs index f6c48654d..207e0f260 100644 --- a/tests/integration/test_tests.rs +++ b/tests/integration/test_tests.rs @@ -6,7 +6,6 @@ use test_util as util; use test_util::itest; use util::assert_contains; use util::assert_not_contains; -// use util::env_vars_for_npm_tests; use util::wildcard_match; use util::TestContext; use util::TestContextBuilder; @@ -599,17 +598,6 @@ fn sigint_with_hanging_test() { ); } -// TODO(2.0): this should be rewritten to a spec test and first run `deno install` -// itest!(package_json_basic { -// args: "test", -// output: "package_json/basic/lib.test.out", -// envs: env_vars_for_npm_tests(), -// http_server: true, -// cwd: Some("package_json/basic"), -// copy_temp_dir: Some("package_json/basic"), -// exit_code: 0, -// }); - itest!(test_replace_timers { args: "test test/replace_timers.js", output: "test/replace_timers.js.out", diff --git a/tests/specs/check/package_json/__test__.jsonc b/tests/specs/check/package_json/__test__.jsonc new file mode 100644 index 000000000..29a964b9f --- /dev/null +++ b/tests/specs/check/package_json/__test__.jsonc @@ -0,0 +1,13 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "install", + "output": "install.out" + }, + { + "args": "check main.ts", + "output": "check.out" + } + ] +} diff --git a/tests/specs/check/package_json/check.out b/tests/specs/check/package_json/check.out new file mode 100644 index 000000000..bb9406725 --- /dev/null +++ b/tests/specs/check/package_json/check.out @@ -0,0 +1 @@ +Check file://[WILDCARD]/main.ts diff --git a/tests/specs/check/package_json/install.out b/tests/specs/check/package_json/install.out new file mode 100644 index 000000000..b8114c12a --- /dev/null +++ b/tests/specs/check/package_json/install.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/esm-basic +Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz +Initialize @denotest/esm-basic@1.0.0 diff --git a/tests/testdata/package_json/basic/lib.ts b/tests/specs/check/package_json/lib.ts index 1deed81f7..1deed81f7 100644 --- a/tests/testdata/package_json/basic/lib.ts +++ b/tests/specs/check/package_json/lib.ts diff --git a/tests/testdata/package_json/basic/main.ts b/tests/specs/check/package_json/main.ts index e241f3002..e241f3002 100644 --- a/tests/testdata/package_json/basic/main.ts +++ b/tests/specs/check/package_json/main.ts diff --git a/tests/testdata/package_json/basic/package.json b/tests/specs/check/package_json/package.json index 54ca824d6..54ca824d6 100644 --- a/tests/testdata/package_json/basic/package.json +++ b/tests/specs/check/package_json/package.json diff --git a/tests/specs/check/package_json_auto_install/__test__.jsonc b/tests/specs/check/package_json_auto_install/__test__.jsonc new file mode 100644 index 000000000..3fa33cdb7 --- /dev/null +++ b/tests/specs/check/package_json_auto_install/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "check main.ts", + "output": "check.out" + } + ] +} diff --git a/tests/testdata/package_json/basic/main.check.out b/tests/specs/check/package_json_auto_install/check.out index db9bd198c..db9bd198c 100644 --- a/tests/testdata/package_json/basic/main.check.out +++ b/tests/specs/check/package_json_auto_install/check.out diff --git a/tests/specs/check/package_json_auto_install/deno.json b/tests/specs/check/package_json_auto_install/deno.json new file mode 100644 index 000000000..fbd70ec48 --- /dev/null +++ b/tests/specs/check/package_json_auto_install/deno.json @@ -0,0 +1,3 @@ +{ + "nodeModulesDir": "auto" +} diff --git a/tests/specs/check/package_json_auto_install/lib.ts b/tests/specs/check/package_json_auto_install/lib.ts new file mode 100644 index 000000000..1deed81f7 --- /dev/null +++ b/tests/specs/check/package_json_auto_install/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/specs/check/package_json_auto_install/main.ts b/tests/specs/check/package_json_auto_install/main.ts new file mode 100644 index 000000000..e241f3002 --- /dev/null +++ b/tests/specs/check/package_json_auto_install/main.ts @@ -0,0 +1,3 @@ +import { getValue } from "./lib.ts"; + +console.log(getValue()); diff --git a/tests/testdata/package_json/deno_json/package.json b/tests/specs/check/package_json_auto_install/package.json index 54ca824d6..54ca824d6 100644 --- a/tests/testdata/package_json/deno_json/package.json +++ b/tests/specs/check/package_json_auto_install/package.json diff --git a/tests/specs/check/package_json_fail_check/__test__.jsonc b/tests/specs/check/package_json_fail_check/__test__.jsonc new file mode 100644 index 000000000..e5b4a4db0 --- /dev/null +++ b/tests/specs/check/package_json_fail_check/__test__.jsonc @@ -0,0 +1,14 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "install", + "output": "install.out" + }, + { + "args": "check --quiet fail_check.ts", + "output": "fail_check.out", + "exitCode": 1 + } + ] +} diff --git a/tests/testdata/package_json/basic/fail_check.check.out b/tests/specs/check/package_json_fail_check/fail_check.out index 03997a051..03997a051 100644 --- a/tests/testdata/package_json/basic/fail_check.check.out +++ b/tests/specs/check/package_json_fail_check/fail_check.out diff --git a/tests/testdata/package_json/basic/fail_check.ts b/tests/specs/check/package_json_fail_check/fail_check.ts index cef10763d..cef10763d 100644 --- a/tests/testdata/package_json/basic/fail_check.ts +++ b/tests/specs/check/package_json_fail_check/fail_check.ts diff --git a/tests/specs/check/package_json_fail_check/install.out b/tests/specs/check/package_json_fail_check/install.out new file mode 100644 index 000000000..b8114c12a --- /dev/null +++ b/tests/specs/check/package_json_fail_check/install.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/esm-basic +Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz +Initialize @denotest/esm-basic@1.0.0 diff --git a/tests/specs/check/package_json_fail_check/lib.ts b/tests/specs/check/package_json_fail_check/lib.ts new file mode 100644 index 000000000..1deed81f7 --- /dev/null +++ b/tests/specs/check/package_json_fail_check/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/specs/check/package_json_fail_check/package.json b/tests/specs/check/package_json_fail_check/package.json new file mode 100644 index 000000000..54ca824d6 --- /dev/null +++ b/tests/specs/check/package_json_fail_check/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} diff --git a/tests/specs/check/package_json_with_deno_json/__test__.jsonc b/tests/specs/check/package_json_with_deno_json/__test__.jsonc new file mode 100644 index 000000000..13752ebee --- /dev/null +++ b/tests/specs/check/package_json_with_deno_json/__test__.jsonc @@ -0,0 +1,14 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "install", + "output": "install.out" + }, + { + "args": "check --quiet main.ts", + "output": "check.out", + "exitCode": 1 + } + ] +} diff --git a/tests/testdata/package_json/deno_json/main.check.out b/tests/specs/check/package_json_with_deno_json/check.out index 53b6869c0..53b6869c0 100644 --- a/tests/testdata/package_json/deno_json/main.check.out +++ b/tests/specs/check/package_json_with_deno_json/check.out diff --git a/tests/testdata/package_json/deno_json/deno.json b/tests/specs/check/package_json_with_deno_json/deno.json index 8a89da280..8a89da280 100644 --- a/tests/testdata/package_json/deno_json/deno.json +++ b/tests/specs/check/package_json_with_deno_json/deno.json diff --git a/tests/specs/check/package_json_with_deno_json/install.out b/tests/specs/check/package_json_with_deno_json/install.out new file mode 100644 index 000000000..b8114c12a --- /dev/null +++ b/tests/specs/check/package_json_with_deno_json/install.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/esm-basic +Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz +Initialize @denotest/esm-basic@1.0.0 diff --git a/tests/testdata/package_json/deno_json/main.ts b/tests/specs/check/package_json_with_deno_json/main.ts index 7768ff3fc..7768ff3fc 100644 --- a/tests/testdata/package_json/deno_json/main.ts +++ b/tests/specs/check/package_json_with_deno_json/main.ts diff --git a/tests/testdata/package_json/deno_json/other.ts b/tests/specs/check/package_json_with_deno_json/other.ts index 997d84adf..997d84adf 100644 --- a/tests/testdata/package_json/deno_json/other.ts +++ b/tests/specs/check/package_json_with_deno_json/other.ts diff --git a/tests/specs/check/package_json_with_deno_json/package.json b/tests/specs/check/package_json_with_deno_json/package.json new file mode 100644 index 000000000..54ca824d6 --- /dev/null +++ b/tests/specs/check/package_json_with_deno_json/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} diff --git a/tests/specs/info/package_json_basic/__test__.jsonc b/tests/specs/info/package_json_basic/__test__.jsonc new file mode 100644 index 000000000..c5672615c --- /dev/null +++ b/tests/specs/info/package_json_basic/__test__.jsonc @@ -0,0 +1,13 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "install", + "output": "install.out" + }, + { + "args": "info --quiet main.ts", + "output": "info.out" + } + ] +} diff --git a/tests/specs/info/package_json_basic/info.out b/tests/specs/info/package_json_basic/info.out new file mode 100644 index 000000000..243010131 --- /dev/null +++ b/tests/specs/info/package_json_basic/info.out @@ -0,0 +1,9 @@ +local: [WILDCARD]main.ts +type: TypeScript +dependencies: 3 unique +size: [WILDCARD] + +file:///[WILDCARD]/main.ts (63B) +└─┬ file:///[WILDCARD]/lib.ts (166B) + ├── file:///[WILDCARD]@denotest/esm-basic/main.mjs (unknown) + └── file:///[WILDCARD]@denotest/esm-basic/main.d.mts (unknown) diff --git a/tests/specs/info/package_json_basic/install.out b/tests/specs/info/package_json_basic/install.out new file mode 100644 index 000000000..b8114c12a --- /dev/null +++ b/tests/specs/info/package_json_basic/install.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/esm-basic +Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz +Initialize @denotest/esm-basic@1.0.0 diff --git a/tests/specs/info/package_json_basic/lib.ts b/tests/specs/info/package_json_basic/lib.ts new file mode 100644 index 000000000..1deed81f7 --- /dev/null +++ b/tests/specs/info/package_json_basic/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/specs/info/package_json_basic/main.ts b/tests/specs/info/package_json_basic/main.ts new file mode 100644 index 000000000..e241f3002 --- /dev/null +++ b/tests/specs/info/package_json_basic/main.ts @@ -0,0 +1,3 @@ +import { getValue } from "./lib.ts"; + +console.log(getValue()); diff --git a/tests/specs/info/package_json_basic/package.json b/tests/specs/info/package_json_basic/package.json new file mode 100644 index 000000000..54ca824d6 --- /dev/null +++ b/tests/specs/info/package_json_basic/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} diff --git a/tests/specs/info/package_json_basic_auto_install/__test__.jsonc b/tests/specs/info/package_json_basic_auto_install/__test__.jsonc new file mode 100644 index 000000000..a98f89e91 --- /dev/null +++ b/tests/specs/info/package_json_basic_auto_install/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "info --quiet main.ts", + "output": "info.out" + } + ] +} diff --git a/tests/specs/info/package_json_basic_auto_install/deno.json b/tests/specs/info/package_json_basic_auto_install/deno.json new file mode 100644 index 000000000..fbd70ec48 --- /dev/null +++ b/tests/specs/info/package_json_basic_auto_install/deno.json @@ -0,0 +1,3 @@ +{ + "nodeModulesDir": "auto" +} diff --git a/tests/testdata/package_json/basic/main.info.out b/tests/specs/info/package_json_basic_auto_install/info.out index 892c0612a..892c0612a 100644 --- a/tests/testdata/package_json/basic/main.info.out +++ b/tests/specs/info/package_json_basic_auto_install/info.out diff --git a/tests/specs/info/package_json_basic_auto_install/lib.ts b/tests/specs/info/package_json_basic_auto_install/lib.ts new file mode 100644 index 000000000..1deed81f7 --- /dev/null +++ b/tests/specs/info/package_json_basic_auto_install/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/specs/info/package_json_basic_auto_install/main.ts b/tests/specs/info/package_json_basic_auto_install/main.ts new file mode 100644 index 000000000..e241f3002 --- /dev/null +++ b/tests/specs/info/package_json_basic_auto_install/main.ts @@ -0,0 +1,3 @@ +import { getValue } from "./lib.ts"; + +console.log(getValue()); diff --git a/tests/specs/info/package_json_basic_auto_install/package.json b/tests/specs/info/package_json_basic_auto_install/package.json new file mode 100644 index 000000000..54ca824d6 --- /dev/null +++ b/tests/specs/info/package_json_basic_auto_install/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} diff --git a/tests/specs/run/package_json/with_deno_json/__test__.jsonc b/tests/specs/run/package_json/with_deno_json/__test__.jsonc new file mode 100644 index 000000000..13b6b6de1 --- /dev/null +++ b/tests/specs/run/package_json/with_deno_json/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "run --quiet -A main.ts", + "output": "main.out" + }, + { + "args": [ + "eval", + "console.log(Deno.readTextFileSync('deno.lock').trim())" + ], + "output": "lock.out" + } + ] +} diff --git a/tests/specs/run/package_json/with_deno_json/deno.json b/tests/specs/run/package_json/with_deno_json/deno.json new file mode 100644 index 000000000..fbd70ec48 --- /dev/null +++ b/tests/specs/run/package_json/with_deno_json/deno.json @@ -0,0 +1,3 @@ +{ + "nodeModulesDir": "auto" +} diff --git a/tests/specs/run/package_json/with_deno_json/lib.ts b/tests/specs/run/package_json/with_deno_json/lib.ts new file mode 100644 index 000000000..1deed81f7 --- /dev/null +++ b/tests/specs/run/package_json/with_deno_json/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/specs/run/package_json/with_deno_json/lock.out b/tests/specs/run/package_json/with_deno_json/lock.out new file mode 100644 index 000000000..92aa561b8 --- /dev/null +++ b/tests/specs/run/package_json/with_deno_json/lock.out @@ -0,0 +1,18 @@ +{ + "version": "4", + "specifiers": { + "npm:@denotest/esm-basic@*": "1.0.0" + }, + "npm": { + "@denotest/esm-basic@1.0.0": { + "integrity": "sha512-[WILDCARD]" + } + }, + "workspace": { + "packageJson": { + "dependencies": [ + "npm:@denotest/esm-basic@*" + ] + } + } +} diff --git a/tests/specs/run/package_json/with_deno_json/main.out b/tests/specs/run/package_json/with_deno_json/main.out new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/tests/specs/run/package_json/with_deno_json/main.out @@ -0,0 +1 @@ +0 diff --git a/tests/specs/run/package_json/with_deno_json/main.ts b/tests/specs/run/package_json/with_deno_json/main.ts new file mode 100644 index 000000000..e241f3002 --- /dev/null +++ b/tests/specs/run/package_json/with_deno_json/main.ts @@ -0,0 +1,3 @@ +import { getValue } from "./lib.ts"; + +console.log(getValue()); diff --git a/tests/specs/run/package_json/with_deno_json/package.json b/tests/specs/run/package_json/with_deno_json/package.json new file mode 100644 index 000000000..54ca824d6 --- /dev/null +++ b/tests/specs/run/package_json/with_deno_json/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} diff --git a/tests/specs/run/package_json_auto_discovered_for_npm_binary/__test__.jsonc b/tests/specs/run/package_json_auto_discovered_for_npm_binary/__test__.jsonc new file mode 100644 index 000000000..dab6ad8d5 --- /dev/null +++ b/tests/specs/run/package_json_auto_discovered_for_npm_binary/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "tempDir": true, + "args": "run -L debug npm:@denotest/bin/cli-esm this is a test", + "output": "main.out" +} diff --git a/tests/specs/run/package_json_auto_discovered_for_npm_binary/deno.json b/tests/specs/run/package_json_auto_discovered_for_npm_binary/deno.json new file mode 100644 index 000000000..fbd70ec48 --- /dev/null +++ b/tests/specs/run/package_json_auto_discovered_for_npm_binary/deno.json @@ -0,0 +1,3 @@ +{ + "nodeModulesDir": "auto" +} diff --git a/tests/specs/run/package_json_auto_discovered_for_npm_binary/main.out b/tests/specs/run/package_json_auto_discovered_for_npm_binary/main.out new file mode 100644 index 000000000..5f687a098 --- /dev/null +++ b/tests/specs/run/package_json_auto_discovered_for_npm_binary/main.out @@ -0,0 +1,8 @@ +[WILDCARD] +[WILDCARD]package.json file found at '[WILDCARD]package.json' +[WILDCARD] +this +is +a +test +[WILDCARD] diff --git a/tests/testdata/run/with_package_json/npm_binary/package.json b/tests/specs/run/package_json_auto_discovered_for_npm_binary/package.json index 9ee3f39a8..9ee3f39a8 100644 --- a/tests/testdata/run/with_package_json/npm_binary/package.json +++ b/tests/specs/run/package_json_auto_discovered_for_npm_binary/package.json diff --git a/tests/specs/test/package_json_basic/__test__.jsonc b/tests/specs/test/package_json_basic/__test__.jsonc new file mode 100644 index 000000000..64e43afa5 --- /dev/null +++ b/tests/specs/test/package_json_basic/__test__.jsonc @@ -0,0 +1,13 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "install", + "output": "install.out" + }, + { + "args": "test", + "output": "test.out" + } + ] +} diff --git a/tests/specs/test/package_json_basic/install.out b/tests/specs/test/package_json_basic/install.out new file mode 100644 index 000000000..b8114c12a --- /dev/null +++ b/tests/specs/test/package_json_basic/install.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/esm-basic +Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz +Initialize @denotest/esm-basic@1.0.0 diff --git a/tests/testdata/package_json/basic/lib.test.ts b/tests/specs/test/package_json_basic/lib.test.ts index 4e833e1f3..4e833e1f3 100644 --- a/tests/testdata/package_json/basic/lib.test.ts +++ b/tests/specs/test/package_json_basic/lib.test.ts diff --git a/tests/specs/test/package_json_basic/lib.ts b/tests/specs/test/package_json_basic/lib.ts new file mode 100644 index 000000000..1deed81f7 --- /dev/null +++ b/tests/specs/test/package_json_basic/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/specs/test/package_json_basic/package.json b/tests/specs/test/package_json_basic/package.json new file mode 100644 index 000000000..54ca824d6 --- /dev/null +++ b/tests/specs/test/package_json_basic/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} diff --git a/tests/specs/test/package_json_basic/test.out b/tests/specs/test/package_json_basic/test.out new file mode 100644 index 000000000..1ff57c150 --- /dev/null +++ b/tests/specs/test/package_json_basic/test.out @@ -0,0 +1,6 @@ +Check file://[WILDCARD]/lib.test.ts +running 1 test from [WILDCARD]lib.test.ts +should add ... ok ([WILDCARD]) + +ok | 1 passed | 0 failed ([WILDCARD]) + diff --git a/tests/specs/test/package_json_basic_auto_install/__test__.jsonc b/tests/specs/test/package_json_basic_auto_install/__test__.jsonc new file mode 100644 index 000000000..d80f3222a --- /dev/null +++ b/tests/specs/test/package_json_basic_auto_install/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "test", + "output": "test.out" + } + ] +} diff --git a/tests/specs/test/package_json_basic_auto_install/deno.json b/tests/specs/test/package_json_basic_auto_install/deno.json new file mode 100644 index 000000000..fbd70ec48 --- /dev/null +++ b/tests/specs/test/package_json_basic_auto_install/deno.json @@ -0,0 +1,3 @@ +{ + "nodeModulesDir": "auto" +} diff --git a/tests/specs/test/package_json_basic_auto_install/lib.test.ts b/tests/specs/test/package_json_basic_auto_install/lib.test.ts new file mode 100644 index 000000000..4e833e1f3 --- /dev/null +++ b/tests/specs/test/package_json_basic_auto_install/lib.test.ts @@ -0,0 +1,7 @@ +import { add } from "./lib.ts"; + +Deno.test("should add", () => { + if (add(1, 2) !== 3) { + throw new Error("Fail"); + } +}); diff --git a/tests/specs/test/package_json_basic_auto_install/lib.ts b/tests/specs/test/package_json_basic_auto_install/lib.ts new file mode 100644 index 000000000..1deed81f7 --- /dev/null +++ b/tests/specs/test/package_json_basic_auto_install/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/specs/test/package_json_basic_auto_install/package.json b/tests/specs/test/package_json_basic_auto_install/package.json new file mode 100644 index 000000000..54ca824d6 --- /dev/null +++ b/tests/specs/test/package_json_basic_auto_install/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} diff --git a/tests/testdata/package_json/basic/lib.test.out b/tests/specs/test/package_json_basic_auto_install/test.out index 2f109ef38..2f109ef38 100644 --- a/tests/testdata/package_json/basic/lib.test.out +++ b/tests/specs/test/package_json_basic_auto_install/test.out diff --git a/tests/testdata/package_json/deno_json/main.out b/tests/testdata/package_json/deno_json/main.out deleted file mode 100644 index 1191247b6..000000000 --- a/tests/testdata/package_json/deno_json/main.out +++ /dev/null @@ -1,2 +0,0 @@ -1 -2 diff --git a/tests/testdata/run/with_package_json/npm_binary/main.out b/tests/testdata/run/with_package_json/npm_binary/main.out deleted file mode 100644 index 13d196a5e..000000000 --- a/tests/testdata/run/with_package_json/npm_binary/main.out +++ /dev/null @@ -1,7 +0,0 @@ -[WILDCARD]package.json file found at '[WILDCARD]with_package_json[WILDCARD]npm_binary[WILDCARD]package.json' -[WILDCARD] -this -is -a -test -[WILDCARD] diff --git a/tools/lint.js b/tools/lint.js index bb4781e27..013bd4930 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -198,13 +198,13 @@ async function ensureNoNewITests() { "bench_tests.rs": 0, "cache_tests.rs": 0, "cert_tests.rs": 0, - "check_tests.rs": 21, + "check_tests.rs": 18, "compile_tests.rs": 0, "coverage_tests.rs": 0, "eval_tests.rs": 0, "flags_tests.rs": 0, "fmt_tests.rs": 16, - "info_tests.rs": 18, + "info_tests.rs": 17, "init_tests.rs": 0, "inspector_tests.rs": 0, "install_tests.rs": 0, @@ -220,10 +220,10 @@ async function ensureNoNewITests() { "pm_tests.rs": 0, "publish_tests.rs": 0, "repl_tests.rs": 0, - "run_tests.rs": 335, + "run_tests.rs": 334, "shared_library_tests.rs": 0, "task_tests.rs": 4, - "test_tests.rs": 74, + "test_tests.rs": 73, "upgrade_tests.rs": 0, "vendor_tests.rs": 1, "watcher_tests.rs": 0, |