diff --git a/tests/integration/npm_tests.rs b/tests/integration/npm_tests.rs index 004136ae7f..f47b1bdd4a 100644 --- a/tests/integration/npm_tests.rs +++ b/tests/integration/npm_tests.rs @@ -15,136 +15,6 @@ use util::TestContextBuilder; // NOTE: See how to make test npm packages at ./testdata/npm/README.md -itest!(cjs_with_deps { - args: "run --allow-read --allow-env npm/cjs_with_deps/main.js", - output: "npm/cjs_with_deps/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(cjs_sub_path { - args: "run --allow-read npm/cjs_sub_path/main.js", - output: "npm/cjs_sub_path/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(cjs_local_global_decls { - args: "run --allow-read npm/cjs_local_global_decls/main.ts", - output: "npm/cjs_local_global_decls/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(cjs_reexport_collision { - args: "run -A --quiet npm/cjs_reexport_collision/main.ts", - output: "npm/cjs_reexport_collision/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(cjs_this_in_exports { - args: "run --allow-read --quiet npm/cjs_this_in_exports/main.js", - output: "npm/cjs_this_in_exports/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(cjs_invalid_name_exports { - args: "run --allow-read --quiet npm/cjs-invalid-name-exports/main.ts", - output: "npm/cjs-invalid-name-exports/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(cjs_require_esm { - args: "run --allow-read --quiet npm/cjs_require_esm/main.ts", - output: "npm/cjs_require_esm/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(cjs_require_esm_mjs { - args: "run --allow-read --quiet npm/cjs_require_esm_mjs/main.ts", - output: "npm/cjs_require_esm_mjs/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(require_esm { - args: "run --allow-read --quiet node/require_esm/main.ts", - output: "node/require_esm/main.out", -}); - -itest!(dynamic_import_deno_ts_from_npm { - args: "run --allow-read --quiet npm/dynamic_import_deno_ts_from_npm/main.ts", - output: "npm/dynamic_import_deno_ts_from_npm/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(translate_cjs_to_esm { - args: "run -A --quiet npm/translate_cjs_to_esm/main.js", - output: "npm/translate_cjs_to_esm/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(compare_globals { - args: "run --allow-read --check=all npm/compare_globals/main.ts", - output: "npm/compare_globals/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(dual_cjs_esm { - args: "run -A --quiet npm/dual_cjs_esm/main.ts", - output: "npm/dual_cjs_esm/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(child_process_fork_test { - args: "run -A --quiet npm/child_process_fork_test/main.ts", - output: "npm/child_process_fork_test/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(cjs_module_export_assignment { - args: "run -A --quiet --check=all npm/cjs_module_export_assignment/main.ts", - output: "npm/cjs_module_export_assignment/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(cjs_module_export_assignment_number { - args: - "run -A --quiet --check=all npm/cjs_module_export_assignment_number/main.ts", - output: "npm/cjs_module_export_assignment_number/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(mixed_case_package_name_global_dir { - args: "run npm/mixed_case_package_name/global.ts", - output: "npm/mixed_case_package_name/global.out", - exit_code: 0, - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(mixed_case_package_name_local_dir { - args: - "run --node-modules-dir=auto -A $TESTDATA/npm/mixed_case_package_name/local.ts", - output: "npm/mixed_case_package_name/local.out", - exit_code: 0, - envs: env_vars_for_npm_tests(), - http_server: true, - temp_cwd: true, -}); - // FIXME(bartlomieju): npm: specifiers are not handled in dynamic imports // at the moment // itest!(dynamic_import { @@ -154,211 +24,6 @@ itest!(mixed_case_package_name_local_dir { // http_server: true, // }); -itest!(dynamic_import_reload_same_package { - args: "run -A --reload npm/dynamic_import_reload_same_package/main.ts", - output: "npm/dynamic_import_reload_same_package/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(dynamic_import_invalid_package_name { - args: "run -A --reload npm/dynamic_import_invalid_package_name/main.ts", - output: "npm/dynamic_import_invalid_package_name/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(env_var_re_export_dev { - args: "run --allow-read --allow-env --quiet npm/env_var_re_export/main.js", - output_str: Some("dev\n"), - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(env_var_re_export_prod { - args: "run --allow-read --allow-env --quiet npm/env_var_re_export/main.js", - output_str: Some("prod\n"), - envs: { - let mut vars = env_vars_for_npm_tests(); - vars.push(("NODE_ENV".to_string(), "production".to_string())); - vars - }, - http_server: true, -}); - -itest!(cached_only { - args: "run --cached-only npm/cached_only/main.ts", - output: "npm/cached_only/main.out", - envs: env_vars_for_npm_tests(), - exit_code: 1, -}); - -itest!(import_map { - args: "run --allow-read --allow-env --import-map npm/import_map/import_map.json npm/import_map/main.js", - output: "npm/import_map/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(sub_paths { - args: "run -A --quiet npm/sub_paths/main.jsx", - output: "npm/sub_paths/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(remote_npm_specifier { - args: "run --quiet -A npm/remote_npm_specifier/main.ts", - output: "npm/remote_npm_specifier/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 0, -}); - -itest!(tarball_with_global_header { - args: "run -A --quiet npm/tarball_with_global_header/main.js", - output: "npm/tarball_with_global_header/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(node_modules_deno_node_modules { - args: "run --quiet npm/node_modules_deno_node_modules/main.ts", - output: "npm/node_modules_deno_node_modules/main.out", - copy_temp_dir: Some("npm/node_modules_deno_node_modules/"), - exit_code: 0, - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(node_modules_deno_node_modules_local { - args: - "run --quiet --node-modules-dir npm/node_modules_deno_node_modules/main.ts", - output: "npm/node_modules_deno_node_modules/main.out", - copy_temp_dir: Some("npm/node_modules_deno_node_modules/"), - exit_code: 0, - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(nonexistent_file { - args: "run -A --quiet npm/nonexistent_file/main.js", - output: "npm/nonexistent_file/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(nonexistent_file_node_modules_dir { - // there was a bug where the message was different when using a node_modules dir - args: "run -A --quiet --node-modules-dir npm/nonexistent_file/main.js", - output: "npm/nonexistent_file/main.out", - copy_temp_dir: Some("npm/nonexistent_file/"), - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(require_json { - args: "run -A --quiet npm/require_json/main.js", - output: "npm/require_json/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(error_version_after_subpath { - args: "run -A --quiet npm/error_version_after_subpath/main.js", - output: "npm/error_version_after_subpath/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(deno_cache { - args: "cache --reload npm:chalk npm:mkdirp", - output: "npm/deno_cache.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(check_all { - args: "check --all npm/check_errors/main.ts", - output: "npm/check_errors/main_all.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(check_local { - args: "check npm/check_errors/main.ts", - output: "npm/check_errors/main_local.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(types_ambient_module { - args: "check --quiet npm/types_ambient_module/main.ts", - output: "npm/types_ambient_module/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(types_ambient_module_import_map { - args: "check --quiet --import-map=npm/types_ambient_module/import_map.json npm/types_ambient_module/main_import_map.ts", - output: "npm/types_ambient_module/main_import_map.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(types_entry_value_not_exists { - args: "check --all npm/types_entry_value_not_exists/main.ts", - output: "npm/types_entry_value_not_exists/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(types_exports_import_types { - args: "check --all npm/types_exports_import_types/main.ts", - output: "npm/types_exports_import_types/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(types_no_types_entry { - args: "check --all npm/types_no_types_entry/main.ts", - output: "npm/types_no_types_entry/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(types_d_ext { - args: "check --all npm/d_ext/main.ts", - output: "npm/d_ext/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(typescript_file_in_package { - args: "run npm/typescript_file_in_package/main.ts", - output: "npm/typescript_file_in_package/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(permissions_outside_package { - args: "run --allow-read npm/permissions_outside_package/main.ts", - output: "npm/permissions_outside_package/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - itest!(run_existing_npm_package { args: "run --allow-read --node-modules-dir=auto npm:@denotest/bin", output: "npm/run_existing_npm_package/main.out", @@ -369,24 +34,15 @@ itest!(run_existing_npm_package { copy_temp_dir: Some("npm/run_existing_npm_package/"), }); -itest!(run_existing_npm_package_with_subpath { - args: - "run --allow-read --node-modules-dir=auto npm:@denotest/bin/cli-esm dev --help", - output: "npm/run_existing_npm_package_with_subpath/main.out", +itest!(require_resolve_url_paths { + args: "run -A --quiet --node-modules-dir=auto url_paths.ts", + output: "npm/require_resolve_url/url_paths.out", envs: env_vars_for_npm_tests(), http_server: true, - temp_cwd: true, - cwd: Some("npm/run_existing_npm_package_with_subpath/"), - copy_temp_dir: Some("npm/run_existing_npm_package_with_subpath/"), + exit_code: 0, + cwd: Some("npm/require_resolve_url/"), + copy_temp_dir: Some("npm/require_resolve_url/"), }); - -itest!(cjs_pkg_imports { - args: "run -A npm/cjs_pkg_imports/main.ts", - output: "npm/cjs_pkg_imports/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - #[test] fn parallel_downloading() { let (out, _err) = util::run_and_collect_output_with_args( @@ -666,77 +322,6 @@ fn deno_run_cjs_module() { assert!(deno_dir.path().join("test_dir").exists()); } -itest!(deno_run_cowsay { - args: "run -A --quiet npm:cowsay@1.5.0 Hello", - output: "npm/deno_run_cowsay.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(deno_run_cowsay_with_node_modules_dir { - args: "run -A --quiet --node-modules-dir npm:cowsay@1.5.0 Hello", - temp_cwd: true, - output: "npm/deno_run_cowsay.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(deno_run_cowsay_explicit { - args: "run -A --quiet npm:cowsay@1.5.0/cowsay Hello", - output: "npm/deno_run_cowsay.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(deno_run_cowthink { - args: "run -A --quiet npm:cowsay@1.5.0/cowthink Hello", - output: "npm/deno_run_cowthink.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(deno_run_bin_esm { - args: "run -A --quiet npm:@denotest/bin/cli-esm this is a test", - output: "npm/deno_run_esm.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(deno_run_bin_esm_no_bin_entrypoint { - args: "run -A --quiet npm:@denotest/bin@0.6.0/cli.mjs this is a test", - output: "npm/deno_run_esm.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(deno_run_bin_cjs_no_bin_entrypoint { - args: "run -A --quiet npm:@denotest/bin@0.6.0/cli-cjs.js this is a test", - output: "npm/deno_run_cjs.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(deno_run_bin_special_chars { - args: "run -A --quiet npm:@denotest/special-chars-in-bin-name/\\foo\" this is a test", - output: "npm/deno_run_special_chars_in_bin_name.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(deno_run_bin_no_ext { - args: "run -A --quiet npm:@denotest/bin/cli-no-ext this is a test", - output: "npm/deno_run_no_ext.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(deno_run_bin_cjs { - args: "run -A --quiet npm:@denotest/bin/cli-cjs this is a test", - output: "npm/deno_run_cjs.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - #[test] fn deno_run_bin_lockfile() { let context = TestContextBuilder::for_npm().use_temp_cwd().build(); @@ -750,88 +335,6 @@ fn deno_run_bin_lockfile() { assert!(temp_dir.path().join("deno.lock").exists()); } -itest!(deno_run_non_existent { - args: "run npm:mkdirp@0.5.125", - output: "npm/deno_run_non_existent.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(deno_run_no_bin_entrypoint { - args: "run -A --quiet npm:@denotest/esm-basic", - output: "npm/deno_run_no_bin_entrypoint.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(deno_run_no_bin_entrypoint_non_existent_subpath { - args: "run -A --quiet npm:@denotest/esm-basic/non-existent.js", - output: "npm/deno_run_no_bin_entrypoint_non_existent_subpath.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(directory_import_folder_index_js { - args: "run npm/directory_import/folder_index_js.ts", - output: "npm/directory_import/folder_index_js.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(directory_import_folder_no_index { - args: "run npm/directory_import/folder_no_index.ts", - output: "npm/directory_import/folder_no_index.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(builtin_module_module { - args: "run --allow-read --quiet npm/builtin_module_module/main.js", - output: "npm/builtin_module_module/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(node_modules_dir_require_added_node_modules_folder { - args: - "run --node-modules-dir=auto -A --quiet $TESTDATA/npm/require_added_nm_folder/main.js", - output: "npm/require_added_nm_folder/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 0, - temp_cwd: true, -}); - -itest!(node_modules_dir_require_main_entry { - args: "run --node-modules-dir -A --quiet $TESTDATA/npm/require_main/main.js", - output: "npm/require_main/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 0, - temp_cwd: true, -}); - -itest!(node_modules_dir_with_deps { - args: "run --allow-read --allow-env --node-modules-dir=auto $TESTDATA/npm/cjs_with_deps/main.js", - output: "npm/cjs_with_deps/main_node_modules.out", - envs: env_vars_for_npm_tests(), - http_server: true, - temp_cwd: true, -}); - -itest!(node_modules_dir_yargs { - args: "run --allow-read --allow-env --node-modules-dir=auto $TESTDATA/npm/cjs_yargs/main.js", - output: "npm/cjs_yargs/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - temp_cwd: true, -}); - #[test] fn node_modules_dir_cache() { let _server = http_server(); @@ -916,57 +419,6 @@ fn ensure_registry_files_local() { } } -itest!(info_chalk_display { - args: "info --quiet npm/cjs_with_deps/main.js", - output: "npm/cjs_with_deps/main_info.out", - exit_code: 0, - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(info_chalk_display_node_modules_dir { - args: "info --quiet --node-modules-dir $TESTDATA/npm/cjs_with_deps/main.js", - output: "npm/cjs_with_deps/main_info.out", - exit_code: 0, - envs: env_vars_for_npm_tests(), - http_server: true, - temp_cwd: true, -}); - -itest!(info_chalk_json { - args: "info --quiet --json npm/cjs_with_deps/main.js", - output: "npm/cjs_with_deps/main_info_json.out", - exit_code: 0, - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(info_chalk_json_node_modules_dir { - args: - "info --quiet --node-modules-dir --json $TESTDATA/npm/cjs_with_deps/main.js", - output: "npm/cjs_with_deps/main_info_json.out", - exit_code: 0, - envs: env_vars_for_npm_tests(), - http_server: true, - temp_cwd: true, -}); - -itest!(info_cli_chalk_display { - args: "info --quiet npm:chalk@4", - output: "npm/info/chalk.out", - exit_code: 0, - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(info_cli_chalk_json { - args: "info --quiet --json npm:chalk@4", - output: "npm/info/chalk_json.out", - exit_code: 0, - envs: env_vars_for_npm_tests(), - http_server: true, -}); - #[test] fn lock_file_missing_top_level_package() { let _server = http_server(); @@ -1526,57 +978,27 @@ fn peer_deps_with_copied_folders_and_lockfile() { ); } -itest!(info_peer_deps { - args: "info --quiet npm/peer_deps_with_copied_folders/main.ts", - output: "npm/peer_deps_with_copied_folders/main_info.out", - exit_code: 0, - 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` +// itest!(node_modules_import_run { +// args: "run --quiet main.ts", +// output: "npm/node_modules_import/main.out", +// http_server: true, +// copy_temp_dir: Some("npm/node_modules_import/"), +// cwd: Some("npm/node_modules_import/"), +// envs: env_vars_for_npm_tests(), +// exit_code: 0, +// }); -itest!(info_peer_deps_json { - args: "info --quiet --json npm/peer_deps_with_copied_folders/main.ts", - output: "npm/peer_deps_with_copied_folders/main_info_json.out", - exit_code: 0, - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(create_require { - args: "run --reload --allow-read npm/create_require/main.ts", - output: "npm/create_require/main.out", - exit_code: 0, - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(non_existent_dep { - args: "cache npm:@denotest/non-existent-dep", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, - output_str: Some(concat!( - "[UNORDERED_START]\n", - "Download http://localhost:4260/@denotest/non-existent-dep\n", - "Download http://localhost:4260/@denotest/non-existent\n", - "[UNORDERED_END]\n", - "error: npm package '@denotest/non-existent' does not exist.\n" - )), -}); - -itest!(non_existent_dep_version { - args: "cache npm:@denotest/non-existent-dep-version", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, - output_str: Some(concat!( - "[UNORDERED_START]\n", - "Download http://localhost:4260/@denotest/non-existent-dep-version\n", - "Download http://localhost:4260/@denotest/esm-basic\n", - "[UNORDERED_END]\n", - "error: Could not find npm package '@denotest/esm-basic' matching '=99.99.99'.\n" - )), -}); +// TODO(2.0): this should be rewritten to a spec test and first run `deno install` +// itest!(node_modules_import_check { +// args: "check --quiet main.ts", +// output: "npm/node_modules_import/main_check.out", +// envs: env_vars_for_npm_tests(), +// http_server: true, +// cwd: Some("npm/node_modules_import/"), +// copy_temp_dir: Some("npm/node_modules_import/"), +// exit_code: 1, +// }); // TODO(2.0): this should be rewritten to a spec test and first run `deno install` #[test] @@ -2047,45 +1469,6 @@ fn top_level_install_package_json_explicit_opt_in() { assert!(node_modules_dir.join("@denotest").exists()); } -itest!(reserved_word_exports { - args: "run npm/reserved_word_exports/main.ts", - output: "npm/reserved_word_exports/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(import_json { - args: "run -A --quiet npm/import_json/main.js", - output: "npm/import_json/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(dynamic_import_json { - args: "run -A --quiet npm/import_json/main.js", - output: "npm/import_json/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(check_package_file_dts_dmts_dcts { - args: "check npm/file_dts_dmts_dcts/main.ts", - output: "npm/file_dts_dmts_dcts/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 1, -}); - -itest!(require_resolve_url_paths { - args: "run -A --quiet --node-modules-dir=auto url_paths.ts", - output: "npm/require_resolve_url/url_paths.out", - envs: env_vars_for_npm_tests(), - http_server: true, - exit_code: 0, - cwd: Some("npm/require_resolve_url/"), - copy_temp_dir: Some("npm/require_resolve_url/"), -}); - #[test] fn byonm_cjs_esm_packages() { let test_context = TestContextBuilder::for_npm().use_temp_cwd().build(); @@ -2688,50 +2071,6 @@ fn cjs_export_analysis_import_cjs_directly_relative_import() { output.assert_matches_text("2\n"); } -itest!(imports_package_json { - args: - "run --no-lock --node-modules-dir=none npm/imports_package_json/main.js", - output: "npm/imports_package_json/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, -}); - -itest!(imports_package_json_import_not_defined { - args: - "run --no-lock --node-modules-dir=none npm/imports_package_json/import_not_defined.js", - output: "npm/imports_package_json/import_not_defined.out", - envs: env_vars_for_npm_tests(), - exit_code: 1, - http_server: true, -}); - -itest!(imports_package_json_sub_path_import_not_defined { - args: - "run --no-lock --node-modules-dir=none npm/imports_package_json/sub_path_import_not_defined.js", - output: "npm/imports_package_json/sub_path_import_not_defined.out", - envs: env_vars_for_npm_tests(), - exit_code: 1, - http_server: true, -}); - -itest!(different_nested_dep_node_modules_dir_false { - args: "run --quiet --no-lock --node-modules-dir=none npm/different_nested_dep/main.js", - output: "npm/different_nested_dep/main.out", - envs: env_vars_for_npm_tests(), - exit_code: 0, - http_server: true, -}); - -itest!(different_nested_dep_node_modules_dir_true { - args: "run --no-lock --quiet --node-modules-dir=auto main.js", - output: "npm/different_nested_dep/main.out", - copy_temp_dir: Some("npm/different_nested_dep/"), - cwd: Some("npm/different_nested_dep/"), - envs: env_vars_for_npm_tests(), - exit_code: 0, - http_server: true, -}); - #[test] fn different_nested_dep_byonm() { let test_context = TestContextBuilder::for_npm() diff --git a/tests/specs/npm_tests/builtin_module_module/__test__.jsonc b/tests/specs/npm_tests/builtin_module_module/__test__.jsonc new file mode 100644 index 0000000000..2f26a95d4a --- /dev/null +++ b/tests/specs/npm_tests/builtin_module_module/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read --quiet builtin_module_module/main.js", + "output": "builtin_module_module/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/builtin_module_module/main.js b/tests/specs/npm_tests/builtin_module_module/builtin_module_module/main.js similarity index 100% rename from tests/testdata/npm/builtin_module_module/main.js rename to tests/specs/npm_tests/builtin_module_module/builtin_module_module/main.js diff --git a/tests/testdata/npm/builtin_module_module/main.out b/tests/specs/npm_tests/builtin_module_module/builtin_module_module/main.out similarity index 100% rename from tests/testdata/npm/builtin_module_module/main.out rename to tests/specs/npm_tests/builtin_module_module/builtin_module_module/main.out diff --git a/tests/specs/npm_tests/cached_only/__test__.jsonc b/tests/specs/npm_tests/cached_only/__test__.jsonc new file mode 100644 index 0000000000..764f702d2c --- /dev/null +++ b/tests/specs/npm_tests/cached_only/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --cached-only cached_only/main.ts", + "output": "cached_only/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/specs/npm_tests/cached_only/cached_only/main.out b/tests/specs/npm_tests/cached_only/cached_only/main.out new file mode 100644 index 0000000000..31113eef3a --- /dev/null +++ b/tests/specs/npm_tests/cached_only/cached_only/main.out @@ -0,0 +1,2 @@ +error: Error getting response at http://localhost:4260/chalk for package "chalk": An npm specifier not found in cache: "chalk", --cached-only is specified. + at file:///[WILDCARD]/specs/npm_tests/cached_only/cached_only/main.ts:1:19 diff --git a/tests/specs/npm_tests/cached_only/cached_only/main.ts b/tests/specs/npm_tests/cached_only/cached_only/main.ts new file mode 100644 index 0000000000..1ccc441a15 --- /dev/null +++ b/tests/specs/npm_tests/cached_only/cached_only/main.ts @@ -0,0 +1,3 @@ +import chalk from "npm:chalk@5"; + +console.log(chalk); diff --git a/tests/specs/npm_tests/check_all/__test__.jsonc b/tests/specs/npm_tests/check_all/__test__.jsonc new file mode 100644 index 0000000000..4275243056 --- /dev/null +++ b/tests/specs/npm_tests/check_all/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "check --all check_errors/main.ts", + "output": "check_errors/main_all.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/check_errors/main.ts b/tests/specs/npm_tests/check_all/check_errors/main.ts similarity index 100% rename from tests/testdata/npm/check_errors/main.ts rename to tests/specs/npm_tests/check_all/check_errors/main.ts diff --git a/tests/testdata/npm/check_errors/main_all.out b/tests/specs/npm_tests/check_all/check_errors/main_all.out similarity index 100% rename from tests/testdata/npm/check_errors/main_all.out rename to tests/specs/npm_tests/check_all/check_errors/main_all.out diff --git a/tests/testdata/npm/check_errors/main_local.out b/tests/specs/npm_tests/check_all/check_errors/main_local.out similarity index 100% rename from tests/testdata/npm/check_errors/main_local.out rename to tests/specs/npm_tests/check_all/check_errors/main_local.out diff --git a/tests/specs/npm_tests/check_local/__test__.jsonc b/tests/specs/npm_tests/check_local/__test__.jsonc new file mode 100644 index 0000000000..1bffa5eed0 --- /dev/null +++ b/tests/specs/npm_tests/check_local/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "check check_errors/main.ts", + "output": "check_errors/main_local.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/specs/npm_tests/check_local/check_errors/main.ts b/tests/specs/npm_tests/check_local/check_errors/main.ts new file mode 100644 index 0000000000..4b86841956 --- /dev/null +++ b/tests/specs/npm_tests/check_local/check_errors/main.ts @@ -0,0 +1,3 @@ +import * as test from "npm:@denotest/check-error"; + +console.log(test.Asdf); // should error diff --git a/tests/specs/npm_tests/check_local/check_errors/main_all.out b/tests/specs/npm_tests/check_local/check_errors/main_all.out new file mode 100644 index 0000000000..4c624c0eaa --- /dev/null +++ b/tests/specs/npm_tests/check_local/check_errors/main_all.out @@ -0,0 +1,19 @@ +Download http://localhost:4260/@denotest/check-error +Download http://localhost:4260/@denotest/check-error/1.0.0.tgz +Check file:///[WILDCARD]/check_errors/main.ts +error: TS2506 [ERROR]: 'Class1' is referenced directly or indirectly in its own base expression. +export class Class1 extends Class2 { + ~~~~~~ + at file:///[WILDCARD]/check-error/1.0.0/index.d.ts:2:14 + +TS2506 [ERROR]: 'Class2' is referenced directly or indirectly in its own base expression. +export class Class2 extends Class1 { + ~~~~~~ + at file:///[WILDCARD]/check-error/1.0.0/index.d.ts:5:14 + +TS2339 [ERROR]: Property 'Asdf' does not exist on type 'typeof import("file:///[WILDCARD]/@denotest/check-error/1.0.0/index.d.ts")'. +console.log(test.Asdf); // should error + ~~~~ + at file:///[WILDCARD]/check_errors/main.ts:3:18 + +Found 3 errors. diff --git a/tests/specs/npm_tests/check_local/check_errors/main_local.out b/tests/specs/npm_tests/check_local/check_errors/main_local.out new file mode 100644 index 0000000000..1a150b5e69 --- /dev/null +++ b/tests/specs/npm_tests/check_local/check_errors/main_local.out @@ -0,0 +1,7 @@ +Download http://localhost:4260/@denotest/check-error +Download http://localhost:4260/@denotest/check-error/1.0.0.tgz +Check file:///[WILDCARD]/check_errors/main.ts +error: TS2339 [ERROR]: Property 'Asdf' does not exist on type 'typeof import("file:///[WILDCARD]/@denotest/check-error/1.0.0/index.d.ts")'. +console.log(test.Asdf); // should error + ~~~~ + at file:///[WILDCARD]/check_errors/main.ts:3:18 diff --git a/tests/specs/npm_tests/check_package_file_dts_dmts_dcts/__test__.jsonc b/tests/specs/npm_tests/check_package_file_dts_dmts_dcts/__test__.jsonc new file mode 100644 index 0000000000..675051a69e --- /dev/null +++ b/tests/specs/npm_tests/check_package_file_dts_dmts_dcts/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "check file_dts_dmts_dcts/main.ts", + "output": "file_dts_dmts_dcts/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/file_dts_dmts_dcts/main.out b/tests/specs/npm_tests/check_package_file_dts_dmts_dcts/file_dts_dmts_dcts/main.out similarity index 100% rename from tests/testdata/npm/file_dts_dmts_dcts/main.out rename to tests/specs/npm_tests/check_package_file_dts_dmts_dcts/file_dts_dmts_dcts/main.out diff --git a/tests/testdata/npm/file_dts_dmts_dcts/main.ts b/tests/specs/npm_tests/check_package_file_dts_dmts_dcts/file_dts_dmts_dcts/main.ts similarity index 100% rename from tests/testdata/npm/file_dts_dmts_dcts/main.ts rename to tests/specs/npm_tests/check_package_file_dts_dmts_dcts/file_dts_dmts_dcts/main.ts diff --git a/tests/specs/npm_tests/child_process_fork_test/__test__.jsonc b/tests/specs/npm_tests/child_process_fork_test/__test__.jsonc new file mode 100644 index 0000000000..f83cb051e1 --- /dev/null +++ b/tests/specs/npm_tests/child_process_fork_test/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet child_process_fork_test/main.ts", + "output": "child_process_fork_test/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/child_process_fork_test/main.out b/tests/specs/npm_tests/child_process_fork_test/child_process_fork_test/main.out similarity index 100% rename from tests/testdata/npm/child_process_fork_test/main.out rename to tests/specs/npm_tests/child_process_fork_test/child_process_fork_test/main.out diff --git a/tests/testdata/npm/child_process_fork_test/main.ts b/tests/specs/npm_tests/child_process_fork_test/child_process_fork_test/main.ts similarity index 100% rename from tests/testdata/npm/child_process_fork_test/main.ts rename to tests/specs/npm_tests/child_process_fork_test/child_process_fork_test/main.ts diff --git a/tests/specs/npm_tests/cjs_invalid_name_exports/__test__.jsonc b/tests/specs/npm_tests/cjs_invalid_name_exports/__test__.jsonc new file mode 100644 index 0000000000..a38b8d0356 --- /dev/null +++ b/tests/specs/npm_tests/cjs_invalid_name_exports/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read --quiet cjs-invalid-name-exports/main.ts", + "output": "cjs-invalid-name-exports/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/cjs-invalid-name-exports/main.out b/tests/specs/npm_tests/cjs_invalid_name_exports/cjs-invalid-name-exports/main.out similarity index 100% rename from tests/testdata/npm/cjs-invalid-name-exports/main.out rename to tests/specs/npm_tests/cjs_invalid_name_exports/cjs-invalid-name-exports/main.out diff --git a/tests/testdata/npm/cjs-invalid-name-exports/main.ts b/tests/specs/npm_tests/cjs_invalid_name_exports/cjs-invalid-name-exports/main.ts similarity index 100% rename from tests/testdata/npm/cjs-invalid-name-exports/main.ts rename to tests/specs/npm_tests/cjs_invalid_name_exports/cjs-invalid-name-exports/main.ts diff --git a/tests/specs/npm_tests/cjs_local_global_decls/__test__.jsonc b/tests/specs/npm_tests/cjs_local_global_decls/__test__.jsonc new file mode 100644 index 0000000000..8bf847873f --- /dev/null +++ b/tests/specs/npm_tests/cjs_local_global_decls/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read cjs_local_global_decls/main.ts", + "output": "cjs_local_global_decls/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/cjs_local_global_decls/main.out b/tests/specs/npm_tests/cjs_local_global_decls/cjs_local_global_decls/main.out similarity index 100% rename from tests/testdata/npm/cjs_local_global_decls/main.out rename to tests/specs/npm_tests/cjs_local_global_decls/cjs_local_global_decls/main.out diff --git a/tests/testdata/npm/cjs_local_global_decls/main.ts b/tests/specs/npm_tests/cjs_local_global_decls/cjs_local_global_decls/main.ts similarity index 100% rename from tests/testdata/npm/cjs_local_global_decls/main.ts rename to tests/specs/npm_tests/cjs_local_global_decls/cjs_local_global_decls/main.ts diff --git a/tests/specs/npm_tests/cjs_module_export_assignment/__test__.jsonc b/tests/specs/npm_tests/cjs_module_export_assignment/__test__.jsonc new file mode 100644 index 0000000000..e9be6361a1 --- /dev/null +++ b/tests/specs/npm_tests/cjs_module_export_assignment/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet --check=all cjs_module_export_assignment/main.ts", + "output": "cjs_module_export_assignment/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/cjs_module_export_assignment/main.out b/tests/specs/npm_tests/cjs_module_export_assignment/cjs_module_export_assignment/main.out similarity index 100% rename from tests/testdata/npm/cjs_module_export_assignment/main.out rename to tests/specs/npm_tests/cjs_module_export_assignment/cjs_module_export_assignment/main.out diff --git a/tests/testdata/npm/cjs_module_export_assignment/main.ts b/tests/specs/npm_tests/cjs_module_export_assignment/cjs_module_export_assignment/main.ts similarity index 100% rename from tests/testdata/npm/cjs_module_export_assignment/main.ts rename to tests/specs/npm_tests/cjs_module_export_assignment/cjs_module_export_assignment/main.ts diff --git a/tests/specs/npm_tests/cjs_module_export_assignment_number/__test__.jsonc b/tests/specs/npm_tests/cjs_module_export_assignment_number/__test__.jsonc new file mode 100644 index 0000000000..d70f82e503 --- /dev/null +++ b/tests/specs/npm_tests/cjs_module_export_assignment_number/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet --check=all cjs_module_export_assignment_number/main.ts", + "output": "cjs_module_export_assignment_number/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/cjs_module_export_assignment_number/main.out b/tests/specs/npm_tests/cjs_module_export_assignment_number/cjs_module_export_assignment_number/main.out similarity index 100% rename from tests/testdata/npm/cjs_module_export_assignment_number/main.out rename to tests/specs/npm_tests/cjs_module_export_assignment_number/cjs_module_export_assignment_number/main.out diff --git a/tests/testdata/npm/cjs_module_export_assignment_number/main.ts b/tests/specs/npm_tests/cjs_module_export_assignment_number/cjs_module_export_assignment_number/main.ts similarity index 100% rename from tests/testdata/npm/cjs_module_export_assignment_number/main.ts rename to tests/specs/npm_tests/cjs_module_export_assignment_number/cjs_module_export_assignment_number/main.ts diff --git a/tests/specs/npm_tests/cjs_pkg_imports/__test__.jsonc b/tests/specs/npm_tests/cjs_pkg_imports/__test__.jsonc new file mode 100644 index 0000000000..c51f14b560 --- /dev/null +++ b/tests/specs/npm_tests/cjs_pkg_imports/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A cjs_pkg_imports/main.ts", + "output": "cjs_pkg_imports/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/cjs_pkg_imports/main.out b/tests/specs/npm_tests/cjs_pkg_imports/cjs_pkg_imports/main.out similarity index 100% rename from tests/testdata/npm/cjs_pkg_imports/main.out rename to tests/specs/npm_tests/cjs_pkg_imports/cjs_pkg_imports/main.out diff --git a/tests/testdata/npm/cjs_pkg_imports/main.ts b/tests/specs/npm_tests/cjs_pkg_imports/cjs_pkg_imports/main.ts similarity index 100% rename from tests/testdata/npm/cjs_pkg_imports/main.ts rename to tests/specs/npm_tests/cjs_pkg_imports/cjs_pkg_imports/main.ts diff --git a/tests/specs/npm_tests/cjs_reexport_collision/__test__.jsonc b/tests/specs/npm_tests/cjs_reexport_collision/__test__.jsonc new file mode 100644 index 0000000000..0b9d1e6211 --- /dev/null +++ b/tests/specs/npm_tests/cjs_reexport_collision/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet cjs_reexport_collision/main.ts", + "output": "cjs_reexport_collision/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/cjs_reexport_collision/main.out b/tests/specs/npm_tests/cjs_reexport_collision/cjs_reexport_collision/main.out similarity index 100% rename from tests/testdata/npm/cjs_reexport_collision/main.out rename to tests/specs/npm_tests/cjs_reexport_collision/cjs_reexport_collision/main.out diff --git a/tests/testdata/npm/cjs_reexport_collision/main.ts b/tests/specs/npm_tests/cjs_reexport_collision/cjs_reexport_collision/main.ts similarity index 100% rename from tests/testdata/npm/cjs_reexport_collision/main.ts rename to tests/specs/npm_tests/cjs_reexport_collision/cjs_reexport_collision/main.ts diff --git a/tests/specs/npm_tests/cjs_require_esm/__test__.jsonc b/tests/specs/npm_tests/cjs_require_esm/__test__.jsonc new file mode 100644 index 0000000000..172f1ca650 --- /dev/null +++ b/tests/specs/npm_tests/cjs_require_esm/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read --quiet cjs_require_esm/main.ts", + "output": "cjs_require_esm/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/cjs_require_esm/main.out b/tests/specs/npm_tests/cjs_require_esm/cjs_require_esm/main.out similarity index 100% rename from tests/testdata/npm/cjs_require_esm/main.out rename to tests/specs/npm_tests/cjs_require_esm/cjs_require_esm/main.out diff --git a/tests/testdata/npm/cjs_require_esm/main.ts b/tests/specs/npm_tests/cjs_require_esm/cjs_require_esm/main.ts similarity index 100% rename from tests/testdata/npm/cjs_require_esm/main.ts rename to tests/specs/npm_tests/cjs_require_esm/cjs_require_esm/main.ts diff --git a/tests/specs/npm_tests/cjs_require_esm_mjs/__test__.jsonc b/tests/specs/npm_tests/cjs_require_esm_mjs/__test__.jsonc new file mode 100644 index 0000000000..3a13231272 --- /dev/null +++ b/tests/specs/npm_tests/cjs_require_esm_mjs/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read --quiet cjs_require_esm_mjs/main.ts", + "output": "cjs_require_esm_mjs/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/cjs_require_esm_mjs/main.out b/tests/specs/npm_tests/cjs_require_esm_mjs/cjs_require_esm_mjs/main.out similarity index 100% rename from tests/testdata/npm/cjs_require_esm_mjs/main.out rename to tests/specs/npm_tests/cjs_require_esm_mjs/cjs_require_esm_mjs/main.out diff --git a/tests/testdata/npm/cjs_require_esm_mjs/main.ts b/tests/specs/npm_tests/cjs_require_esm_mjs/cjs_require_esm_mjs/main.ts similarity index 100% rename from tests/testdata/npm/cjs_require_esm_mjs/main.ts rename to tests/specs/npm_tests/cjs_require_esm_mjs/cjs_require_esm_mjs/main.ts diff --git a/tests/specs/npm_tests/cjs_sub_path/__test__.jsonc b/tests/specs/npm_tests/cjs_sub_path/__test__.jsonc new file mode 100644 index 0000000000..dbec76a13b --- /dev/null +++ b/tests/specs/npm_tests/cjs_sub_path/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read cjs_sub_path/main.js", + "output": "cjs_sub_path/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/cjs_sub_path/main.js b/tests/specs/npm_tests/cjs_sub_path/cjs_sub_path/main.js similarity index 100% rename from tests/testdata/npm/cjs_sub_path/main.js rename to tests/specs/npm_tests/cjs_sub_path/cjs_sub_path/main.js diff --git a/tests/testdata/npm/cjs_sub_path/main.out b/tests/specs/npm_tests/cjs_sub_path/cjs_sub_path/main.out similarity index 100% rename from tests/testdata/npm/cjs_sub_path/main.out rename to tests/specs/npm_tests/cjs_sub_path/cjs_sub_path/main.out diff --git a/tests/specs/npm_tests/cjs_this_in_exports/__test__.jsonc b/tests/specs/npm_tests/cjs_this_in_exports/__test__.jsonc new file mode 100644 index 0000000000..251691ca8e --- /dev/null +++ b/tests/specs/npm_tests/cjs_this_in_exports/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --allow-read --quiet cjs_this_in_exports/main.js", + "output": "cjs_this_in_exports/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/cjs_this_in_exports/main.js b/tests/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.js similarity index 100% rename from tests/testdata/npm/cjs_this_in_exports/main.js rename to tests/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.js diff --git a/tests/testdata/npm/cjs_this_in_exports/main.out b/tests/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.out similarity index 63% rename from tests/testdata/npm/cjs_this_in_exports/main.out rename to tests/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.out index ba436bddc9..9517015ae5 100644 --- a/tests/testdata/npm/cjs_this_in_exports/main.out +++ b/tests/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.out @@ -2,4 +2,4 @@ 1 error: Uncaught (in promise) TypeError: this.otherMethod is not a function at getValue (file://[WILDCARD]/@denotest/cjs-this-in-exports/1.0.0/index.js:3:17) - at file://[WILDCARD]/testdata/npm/cjs_this_in_exports/main.js:11:1 + at file://[WILDCARD]/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.js:11:1 diff --git a/tests/specs/npm_tests/cjs_with_deps/__test__.jsonc b/tests/specs/npm_tests/cjs_with_deps/__test__.jsonc new file mode 100644 index 0000000000..d9014f102a --- /dev/null +++ b/tests/specs/npm_tests/cjs_with_deps/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read --allow-env cjs_with_deps/main.js", + "output": "cjs_with_deps/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main.js b/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main.js new file mode 100644 index 0000000000..568726874e --- /dev/null +++ b/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main.js @@ -0,0 +1,12 @@ +import chalk from "npm:chalk@4"; +import { expect } from "npm:chai@4.3"; + +console.log(chalk.green("chalk cjs loads")); + +const timeout = setTimeout(() => {}, 0); +expect(timeout).to.be.a("number"); +clearTimeout(timeout); + +const interval = setInterval(() => {}, 100); +expect(interval).to.be.a("number"); +clearInterval(interval); diff --git a/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main.out b/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main.out new file mode 100644 index 0000000000..7051c23953 --- /dev/null +++ b/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main.out @@ -0,0 +1,33 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/chai +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/supports-color +Download http://localhost:4260/assertion-error +Download http://localhost:4260/check-error +Download http://localhost:4260/deep-eql +Download http://localhost:4260/get-func-name +Download http://localhost:4260/loupe +Download http://localhost:4260/pathval +Download http://localhost:4260/type-detect +Download http://localhost:4260/color-convert +Download http://localhost:4260/has-flag +Download http://localhost:4260/color-name +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz +Download http://localhost:4260/chai/chai-4.3.6.tgz +Download http://localhost:4260/chalk/chalk-4.1.2.tgz +Download http://localhost:4260/check-error/check-error-1.0.2.tgz +Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz +Download http://localhost:4260/color-name/color-name-1.1.4.tgz +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz +Download http://localhost:4260/loupe/loupe-2.3.4.tgz +Download http://localhost:4260/pathval/pathval-1.1.1.tgz +Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +[UNORDERED_END] +chalk cjs loads diff --git a/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main_info.out b/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main_info.out new file mode 100644 index 0000000000..8e37c88eb0 --- /dev/null +++ b/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main_info.out @@ -0,0 +1,22 @@ +local: [WILDCARD]main.js +type: JavaScript +dependencies: 14 unique +size: [WILDCARD] + +file:///[WILDCARD]/cjs_with_deps/main.js ([WILDCARD]) +├─┬ npm:/chalk@4.1.2 ([WILDCARD]) +│ ├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) +│ │ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) +│ │ └── npm:/color-name@1.1.4 ([WILDCARD]) +│ └─┬ npm:/supports-color@7.2.0 ([WILDCARD]) +│ └── npm:/has-flag@4.0.0 ([WILDCARD]) +└─┬ npm:/chai@4.3.6 ([WILDCARD]) + ├── npm:/assertion-error@1.1.0 ([WILDCARD]) + ├── npm:/check-error@1.0.2 ([WILDCARD]) + ├─┬ npm:/deep-eql@3.0.1 ([WILDCARD]) + │ └── npm:/type-detect@4.0.8 ([WILDCARD]) + ├── npm:/get-func-name@2.0.0 ([WILDCARD]) + ├─┬ npm:/loupe@2.3.4 ([WILDCARD]) + │ └── npm:/get-func-name@2.0.0 ([WILDCARD]) + ├── npm:/pathval@1.1.1 ([WILDCARD]) + └── npm:/type-detect@4.0.8 ([WILDCARD]) diff --git a/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main_info_json.out b/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main_info_json.out new file mode 100644 index 0000000000..af1ef13518 --- /dev/null +++ b/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main_info_json.out @@ -0,0 +1,148 @@ +{ + "roots": [ + "file://[WILDCARD]/main.js" + ], + "modules": [ + { + "kind": "esm", + "dependencies": [ + { + "specifier": "npm:chalk@4", + "code": { + "specifier": "npm:chalk@4", + "span": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 31 + } + } + }, + "npmPackage": "chalk@4.1.2" + }, + { + "specifier": "npm:chai@4.3", + "code": { + "specifier": "npm:chai@4.3", + "span": { + "start": { + "line": 1, + "character": 23 + }, + "end": { + "line": 1, + "character": 37 + } + } + }, + "npmPackage": "chai@4.3.6" + } + ], + "local": "[WILDCARD]main.js", + "size": 325, + "mediaType": "JavaScript", + "specifier": "[WILDCARD]/main.js" + } + ], + "redirects": { + "npm:chai@4.3": "npm:/chai@4.3.6", + "npm:chalk@4": "npm:/chalk@4.1.2" + }, + "version": 1, + "npmPackages": { + "ansi-styles@4.3.0": { + "name": "ansi-styles", + "version": "4.3.0", + "dependencies": [ + "color-convert@2.0.1" + ] + }, + "assertion-error@1.1.0": { + "name": "assertion-error", + "version": "1.1.0", + "dependencies": [] + }, + "chai@4.3.6": { + "name": "chai", + "version": "4.3.6", + "dependencies": [ + "assertion-error@1.1.0", + "check-error@1.0.2", + "deep-eql@3.0.1", + "get-func-name@2.0.0", + "loupe@2.3.4", + "pathval@1.1.1", + "type-detect@4.0.8" + ] + }, + "chalk@4.1.2": { + "name": "chalk", + "version": "4.1.2", + "dependencies": [ + "ansi-styles@4.3.0", + "supports-color@7.2.0" + ] + }, + "check-error@1.0.2": { + "name": "check-error", + "version": "1.0.2", + "dependencies": [] + }, + "color-convert@2.0.1": { + "name": "color-convert", + "version": "2.0.1", + "dependencies": [ + "color-name@1.1.4" + ] + }, + "color-name@1.1.4": { + "name": "color-name", + "version": "1.1.4", + "dependencies": [] + }, + "deep-eql@3.0.1": { + "name": "deep-eql", + "version": "3.0.1", + "dependencies": [ + "type-detect@4.0.8" + ] + }, + "get-func-name@2.0.0": { + "name": "get-func-name", + "version": "2.0.0", + "dependencies": [] + }, + "has-flag@4.0.0": { + "name": "has-flag", + "version": "4.0.0", + "dependencies": [] + }, + "loupe@2.3.4": { + "name": "loupe", + "version": "2.3.4", + "dependencies": [ + "get-func-name@2.0.0" + ] + }, + "pathval@1.1.1": { + "name": "pathval", + "version": "1.1.1", + "dependencies": [] + }, + "supports-color@7.2.0": { + "name": "supports-color", + "version": "7.2.0", + "dependencies": [ + "has-flag@4.0.0" + ] + }, + "type-detect@4.0.8": { + "name": "type-detect", + "version": "4.0.8", + "dependencies": [] + } + } +} diff --git a/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main_node_modules.out b/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main_node_modules.out new file mode 100644 index 0000000000..1ab3679521 --- /dev/null +++ b/tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main_node_modules.out @@ -0,0 +1,47 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/chai +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/supports-color +Download http://localhost:4260/assertion-error +Download http://localhost:4260/check-error +Download http://localhost:4260/deep-eql +Download http://localhost:4260/get-func-name +Download http://localhost:4260/loupe +Download http://localhost:4260/pathval +Download http://localhost:4260/type-detect +Download http://localhost:4260/color-convert +Download http://localhost:4260/has-flag +Download http://localhost:4260/color-name +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Initialize ansi-styles@4.3.0 +Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz +Initialize assertion-error@1.1.0 +Download http://localhost:4260/chai/chai-4.3.6.tgz +Initialize chai@4.3.6 +Download http://localhost:4260/chalk/chalk-4.1.2.tgz +Initialize chalk@4.1.2 +Download http://localhost:4260/check-error/check-error-1.0.2.tgz +Initialize check-error@1.0.2 +Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz +Initialize color-convert@2.0.1 +Download http://localhost:4260/color-name/color-name-1.1.4.tgz +Initialize color-name@1.1.4 +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Initialize deep-eql@3.0.1 +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Initialize get-func-name@2.0.0 +Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz +Initialize has-flag@4.0.0 +Download http://localhost:4260/loupe/loupe-2.3.4.tgz +Initialize loupe@2.3.4 +Download http://localhost:4260/pathval/pathval-1.1.1.tgz +Initialize pathval@1.1.1 +Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz +Initialize supports-color@7.2.0 +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +Initialize type-detect@4.0.8 +[UNORDERED_END] +chalk cjs loads diff --git a/tests/specs/npm_tests/compare_globals/__test__.jsonc b/tests/specs/npm_tests/compare_globals/__test__.jsonc new file mode 100644 index 0000000000..d86a76dbc7 --- /dev/null +++ b/tests/specs/npm_tests/compare_globals/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read --check=all compare_globals/main.ts", + "output": "compare_globals/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/compare_globals/main.out b/tests/specs/npm_tests/compare_globals/compare_globals/main.out similarity index 91% rename from tests/testdata/npm/compare_globals/main.out rename to tests/specs/npm_tests/compare_globals/compare_globals/main.out index 234a68971f..a1b0a566d5 100644 --- a/tests/testdata/npm/compare_globals/main.out +++ b/tests/specs/npm_tests/compare_globals/compare_globals/main.out @@ -8,7 +8,7 @@ Download http://localhost:4260/@denotest/globals/1.0.0.tgz Download http://localhost:4260/@types/node/node-22.5.4.tgz Download http://localhost:4260/undici-types/undici-types-6.19.8.tgz [UNORDERED_END] -Check file:///[WILDCARD]/npm/compare_globals/main.ts +Check file:///[WILDCARD]/compare_globals/main.ts true true [] diff --git a/tests/testdata/npm/compare_globals/main.ts b/tests/specs/npm_tests/compare_globals/compare_globals/main.ts similarity index 100% rename from tests/testdata/npm/compare_globals/main.ts rename to tests/specs/npm_tests/compare_globals/compare_globals/main.ts diff --git a/tests/specs/npm_tests/create_require/__test__.jsonc b/tests/specs/npm_tests/create_require/__test__.jsonc new file mode 100644 index 0000000000..40d9ce0669 --- /dev/null +++ b/tests/specs/npm_tests/create_require/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --reload --allow-read create_require/main.ts", + "output": "create_require/main.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/create_require/main.out b/tests/specs/npm_tests/create_require/create_require/main.out similarity index 100% rename from tests/testdata/npm/create_require/main.out rename to tests/specs/npm_tests/create_require/create_require/main.out diff --git a/tests/testdata/npm/create_require/main.ts b/tests/specs/npm_tests/create_require/create_require/main.ts similarity index 100% rename from tests/testdata/npm/create_require/main.ts rename to tests/specs/npm_tests/create_require/create_require/main.ts diff --git a/tests/specs/npm_tests/deno_cache/__test__.jsonc b/tests/specs/npm_tests/deno_cache/__test__.jsonc new file mode 100644 index 0000000000..93b204c033 --- /dev/null +++ b/tests/specs/npm_tests/deno_cache/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "cache --reload npm:chalk npm:mkdirp", + "output": "deno_cache.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/deno_cache.out b/tests/specs/npm_tests/deno_cache/deno_cache.out similarity index 100% rename from tests/testdata/npm/deno_cache.out rename to tests/specs/npm_tests/deno_cache/deno_cache.out diff --git a/tests/specs/npm_tests/deno_run_bin_cjs/__test__.jsonc b/tests/specs/npm_tests/deno_run_bin_cjs/__test__.jsonc new file mode 100644 index 0000000000..9eb8e9bfec --- /dev/null +++ b/tests/specs/npm_tests/deno_run_bin_cjs/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet npm:@denotest/bin/cli-cjs this is a test", + "output": "deno_run_cjs.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/deno_run_no_ext.out b/tests/specs/npm_tests/deno_run_bin_cjs/deno_run_cjs.out similarity index 100% rename from tests/testdata/npm/deno_run_no_ext.out rename to tests/specs/npm_tests/deno_run_bin_cjs/deno_run_cjs.out diff --git a/tests/specs/npm_tests/deno_run_bin_cjs_no_bin_entrypoint/__test__.jsonc b/tests/specs/npm_tests/deno_run_bin_cjs_no_bin_entrypoint/__test__.jsonc new file mode 100644 index 0000000000..6ee5a326ba --- /dev/null +++ b/tests/specs/npm_tests/deno_run_bin_cjs_no_bin_entrypoint/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet npm:@denotest/bin@0.6.0/cli-cjs.js this is a test", + "output": "deno_run_cjs.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/deno_run_special_chars_in_bin_name.out b/tests/specs/npm_tests/deno_run_bin_cjs_no_bin_entrypoint/deno_run_cjs.out similarity index 100% rename from tests/testdata/npm/deno_run_special_chars_in_bin_name.out rename to tests/specs/npm_tests/deno_run_bin_cjs_no_bin_entrypoint/deno_run_cjs.out diff --git a/tests/specs/npm_tests/deno_run_bin_esm/__test__.jsonc b/tests/specs/npm_tests/deno_run_bin_esm/__test__.jsonc new file mode 100644 index 0000000000..fc48451bb6 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_bin_esm/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet npm:@denotest/bin/cli-esm this is a test", + "output": "deno_run_esm.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/deno_run_bin_esm/deno_run_esm.out b/tests/specs/npm_tests/deno_run_bin_esm/deno_run_esm.out new file mode 100644 index 0000000000..ffe7cbd891 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_bin_esm/deno_run_esm.out @@ -0,0 +1,4 @@ +this +is +a +test diff --git a/tests/specs/npm_tests/deno_run_bin_esm_no_bin_entrypoint/__test__.jsonc b/tests/specs/npm_tests/deno_run_bin_esm_no_bin_entrypoint/__test__.jsonc new file mode 100644 index 0000000000..956755b306 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_bin_esm_no_bin_entrypoint/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet npm:@denotest/bin@0.6.0/cli.mjs this is a test", + "output": "deno_run_esm.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/deno_run_bin_esm_no_bin_entrypoint/deno_run_esm.out b/tests/specs/npm_tests/deno_run_bin_esm_no_bin_entrypoint/deno_run_esm.out new file mode 100644 index 0000000000..ffe7cbd891 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_bin_esm_no_bin_entrypoint/deno_run_esm.out @@ -0,0 +1,4 @@ +this +is +a +test diff --git a/tests/specs/npm_tests/deno_run_bin_no_ext/__test__.jsonc b/tests/specs/npm_tests/deno_run_bin_no_ext/__test__.jsonc new file mode 100644 index 0000000000..71877b399b --- /dev/null +++ b/tests/specs/npm_tests/deno_run_bin_no_ext/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet npm:@denotest/bin/cli-no-ext this is a test", + "output": "deno_run_no_ext.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/deno_run_bin_no_ext/deno_run_no_ext.out b/tests/specs/npm_tests/deno_run_bin_no_ext/deno_run_no_ext.out new file mode 100644 index 0000000000..ffe7cbd891 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_bin_no_ext/deno_run_no_ext.out @@ -0,0 +1,4 @@ +this +is +a +test diff --git a/tests/specs/npm_tests/deno_run_bin_special_chars/__test__.jsonc b/tests/specs/npm_tests/deno_run_bin_special_chars/__test__.jsonc new file mode 100644 index 0000000000..c3e14c0b71 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_bin_special_chars/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet npm:@denotest/special-chars-in-bin-name/\\foo\" this is a test", + "output": "deno_run_special_chars_in_bin_name.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/deno_run_bin_special_chars/deno_run_special_chars_in_bin_name.out b/tests/specs/npm_tests/deno_run_bin_special_chars/deno_run_special_chars_in_bin_name.out new file mode 100644 index 0000000000..ffe7cbd891 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_bin_special_chars/deno_run_special_chars_in_bin_name.out @@ -0,0 +1,4 @@ +this +is +a +test diff --git a/tests/specs/npm_tests/deno_run_cowsay/__test__.jsonc b/tests/specs/npm_tests/deno_run_cowsay/__test__.jsonc new file mode 100644 index 0000000000..0015b88be8 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_cowsay/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet npm:cowsay@1.5.0 Hello", + "output": "deno_run_cowsay.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/deno_run_cowsay/deno_run_cowsay.out b/tests/specs/npm_tests/deno_run_cowsay/deno_run_cowsay.out new file mode 100644 index 0000000000..46de827306 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_cowsay/deno_run_cowsay.out @@ -0,0 +1,8 @@ + _______ +< Hello > + ------- + \ ^__^ + \ (oo)\_______ + (__)\ )\/\ + ||----w | + || || diff --git a/tests/specs/npm_tests/deno_run_cowsay_explicit/__test__.jsonc b/tests/specs/npm_tests/deno_run_cowsay_explicit/__test__.jsonc new file mode 100644 index 0000000000..1ecce925e8 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_cowsay_explicit/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet npm:cowsay@1.5.0/cowsay Hello", + "output": "deno_run_cowsay.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/deno_run_cowsay_explicit/deno_run_cowsay.out b/tests/specs/npm_tests/deno_run_cowsay_explicit/deno_run_cowsay.out new file mode 100644 index 0000000000..46de827306 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_cowsay_explicit/deno_run_cowsay.out @@ -0,0 +1,8 @@ + _______ +< Hello > + ------- + \ ^__^ + \ (oo)\_______ + (__)\ )\/\ + ||----w | + || || diff --git a/tests/specs/npm_tests/deno_run_cowsay_with_node_modules_dir/__test__.jsonc b/tests/specs/npm_tests/deno_run_cowsay_with_node_modules_dir/__test__.jsonc new file mode 100644 index 0000000000..8671ed1fea --- /dev/null +++ b/tests/specs/npm_tests/deno_run_cowsay_with_node_modules_dir/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet --node-modules-dir npm:cowsay@1.5.0 Hello", + "output": "deno_run_cowsay.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/deno_run_cowsay_with_node_modules_dir/deno_run_cowsay.out b/tests/specs/npm_tests/deno_run_cowsay_with_node_modules_dir/deno_run_cowsay.out new file mode 100644 index 0000000000..46de827306 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_cowsay_with_node_modules_dir/deno_run_cowsay.out @@ -0,0 +1,8 @@ + _______ +< Hello > + ------- + \ ^__^ + \ (oo)\_______ + (__)\ )\/\ + ||----w | + || || diff --git a/tests/specs/npm_tests/deno_run_cowthink/__test__.jsonc b/tests/specs/npm_tests/deno_run_cowthink/__test__.jsonc new file mode 100644 index 0000000000..2acc84e7b9 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_cowthink/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet npm:cowsay@1.5.0/cowthink Hello", + "output": "deno_run_cowthink.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/deno_run_cowthink/deno_run_cowthink.out b/tests/specs/npm_tests/deno_run_cowthink/deno_run_cowthink.out new file mode 100644 index 0000000000..8dd990ed6f --- /dev/null +++ b/tests/specs/npm_tests/deno_run_cowthink/deno_run_cowthink.out @@ -0,0 +1,8 @@ + _______ +( Hello ) + ------- + o ^__^ + o (oo)\_______ + (__)\ )\/\ + ||----w | + || || diff --git a/tests/specs/npm_tests/deno_run_no_bin_entrypoint/__test__.jsonc b/tests/specs/npm_tests/deno_run_no_bin_entrypoint/__test__.jsonc new file mode 100644 index 0000000000..5331ec9c41 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_no_bin_entrypoint/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run -A --quiet npm:@denotest/esm-basic", + "output": "deno_run_no_bin_entrypoint.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/deno_run_no_bin_entrypoint.out b/tests/specs/npm_tests/deno_run_no_bin_entrypoint/deno_run_no_bin_entrypoint.out similarity index 100% rename from tests/testdata/npm/deno_run_no_bin_entrypoint.out rename to tests/specs/npm_tests/deno_run_no_bin_entrypoint/deno_run_no_bin_entrypoint.out diff --git a/tests/specs/npm_tests/deno_run_no_bin_entrypoint_non_existent_subpath/__test__.jsonc b/tests/specs/npm_tests/deno_run_no_bin_entrypoint_non_existent_subpath/__test__.jsonc new file mode 100644 index 0000000000..3eaa8274c6 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_no_bin_entrypoint_non_existent_subpath/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run -A --quiet npm:@denotest/esm-basic/non-existent.js", + "output": "deno_run_no_bin_entrypoint_non_existent_subpath.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/deno_run_no_bin_entrypoint_non_existent_subpath.out b/tests/specs/npm_tests/deno_run_no_bin_entrypoint_non_existent_subpath/deno_run_no_bin_entrypoint_non_existent_subpath.out similarity index 100% rename from tests/testdata/npm/deno_run_no_bin_entrypoint_non_existent_subpath.out rename to tests/specs/npm_tests/deno_run_no_bin_entrypoint_non_existent_subpath/deno_run_no_bin_entrypoint_non_existent_subpath.out diff --git a/tests/specs/npm_tests/deno_run_non_existent/__test__.jsonc b/tests/specs/npm_tests/deno_run_non_existent/__test__.jsonc new file mode 100644 index 0000000000..72dc01450b --- /dev/null +++ b/tests/specs/npm_tests/deno_run_non_existent/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run npm:mkdirp@0.5.125", + "output": "deno_run_non_existent.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/deno_run_non_existent.out b/tests/specs/npm_tests/deno_run_non_existent/deno_run_non_existent.out similarity index 100% rename from tests/testdata/npm/deno_run_non_existent.out rename to tests/specs/npm_tests/deno_run_non_existent/deno_run_non_existent.out diff --git a/tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/__test__.jsonc b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/__test__.jsonc new file mode 100644 index 0000000000..24587d928e --- /dev/null +++ b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --quiet --no-lock --node-modules-dir=none different_nested_dep/main.js", + "output": "different_nested_dep/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 0 +} diff --git a/tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/different_nested_dep/main.js b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/different_nested_dep/main.js new file mode 100644 index 0000000000..5677eb094a --- /dev/null +++ b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/different_nested_dep/main.js @@ -0,0 +1,5 @@ +import dep from "@denotest/different-nested-dep"; +import childDep from "@denotest/different-nested-dep-child"; + +console.log(dep); +console.log(childDep); diff --git a/tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/different_nested_dep/main.out b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/different_nested_dep/main.out new file mode 100644 index 0000000000..1191247b6d --- /dev/null +++ b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/different_nested_dep/main.out @@ -0,0 +1,2 @@ +1 +2 diff --git a/tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/different_nested_dep/package.json b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/different_nested_dep/package.json new file mode 100644 index 0000000000..c204258514 --- /dev/null +++ b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/different_nested_dep/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "@denotest/different-nested-dep": "1.0.0", + "@denotest/different-nested-dep-child": "2.0.0" + } +} diff --git a/tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/__test__.jsonc b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/__test__.jsonc new file mode 100644 index 0000000000..0533a992bf --- /dev/null +++ b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --no-lock --quiet --node-modules-dir=auto different_nested_dep/main.js", + "output": "different_nested_dep/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 0 +} diff --git a/tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/different_nested_dep/main.js b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/different_nested_dep/main.js new file mode 100644 index 0000000000..5677eb094a --- /dev/null +++ b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/different_nested_dep/main.js @@ -0,0 +1,5 @@ +import dep from "@denotest/different-nested-dep"; +import childDep from "@denotest/different-nested-dep-child"; + +console.log(dep); +console.log(childDep); diff --git a/tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/different_nested_dep/main.out b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/different_nested_dep/main.out new file mode 100644 index 0000000000..1191247b6d --- /dev/null +++ b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/different_nested_dep/main.out @@ -0,0 +1,2 @@ +1 +2 diff --git a/tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/different_nested_dep/package.json b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/different_nested_dep/package.json new file mode 100644 index 0000000000..c204258514 --- /dev/null +++ b/tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/different_nested_dep/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "@denotest/different-nested-dep": "1.0.0", + "@denotest/different-nested-dep-child": "2.0.0" + } +} diff --git a/tests/specs/npm_tests/directory_import_folder_index_js/__test__.jsonc b/tests/specs/npm_tests/directory_import_folder_index_js/__test__.jsonc new file mode 100644 index 0000000000..8eb6226d6a --- /dev/null +++ b/tests/specs/npm_tests/directory_import_folder_index_js/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run directory_import/folder_index_js.ts", + "output": "directory_import/folder_index_js.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/directory_import/folder_index_js.out b/tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_index_js.out similarity index 100% rename from tests/testdata/npm/directory_import/folder_index_js.out rename to tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_index_js.out diff --git a/tests/testdata/npm/directory_import/folder_index_js.ts b/tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_index_js.ts similarity index 100% rename from tests/testdata/npm/directory_import/folder_index_js.ts rename to tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_index_js.ts diff --git a/tests/testdata/npm/directory_import/folder_no_index.out b/tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_no_index.out similarity index 100% rename from tests/testdata/npm/directory_import/folder_no_index.out rename to tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_no_index.out diff --git a/tests/testdata/npm/directory_import/folder_no_index.ts b/tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_no_index.ts similarity index 100% rename from tests/testdata/npm/directory_import/folder_no_index.ts rename to tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_no_index.ts diff --git a/tests/specs/npm_tests/directory_import_folder_no_index/__test__.jsonc b/tests/specs/npm_tests/directory_import_folder_no_index/__test__.jsonc new file mode 100644 index 0000000000..6137479980 --- /dev/null +++ b/tests/specs/npm_tests/directory_import_folder_no_index/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run directory_import/folder_no_index.ts", + "output": "directory_import/folder_no_index.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_index_js.out b/tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_index_js.out new file mode 100644 index 0000000000..a700b8fdb6 --- /dev/null +++ b/tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_index_js.out @@ -0,0 +1,7 @@ +Download http://localhost:4260/@denotest/sub-folders +Download http://localhost:4260/@denotest/sub-folders/1.0.0.tgz +error: Directory import [WILDCARD]folder_index_js is not supported resolving import from file:///[WILDCARD]/directory_import/folder_index_js.ts +Did you mean to import index.js within the directory? + +Caused by: + [WILDCARD] diff --git a/tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_index_js.ts b/tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_index_js.ts new file mode 100644 index 0000000000..b0d51fcd97 --- /dev/null +++ b/tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_index_js.ts @@ -0,0 +1,2 @@ +import test from "npm:@denotest/sub-folders/folder_index_js"; +console.log(test); diff --git a/tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_no_index.out b/tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_no_index.out new file mode 100644 index 0000000000..844419b4c6 --- /dev/null +++ b/tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_no_index.out @@ -0,0 +1,6 @@ +Download http://localhost:4260/@denotest/sub-folders +Download http://localhost:4260/@denotest/sub-folders/1.0.0.tgz +error: Directory import [WILDCARD]folder_no_index is not supported resolving import from file:///[WILDCARD]/folder_no_index.ts + +Caused by: + [WILDCARD] diff --git a/tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_no_index.ts b/tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_no_index.ts new file mode 100644 index 0000000000..4c5fb7ec09 --- /dev/null +++ b/tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_no_index.ts @@ -0,0 +1,2 @@ +import test from "npm:@denotest/sub-folders/folder_no_index"; +console.log(test); diff --git a/tests/specs/npm_tests/dual_cjs_esm/__test__.jsonc b/tests/specs/npm_tests/dual_cjs_esm/__test__.jsonc new file mode 100644 index 0000000000..5ace51cecb --- /dev/null +++ b/tests/specs/npm_tests/dual_cjs_esm/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet dual_cjs_esm/main.ts", + "output": "dual_cjs_esm/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/dual_cjs_esm/dual_cjs_esm/main.out b/tests/specs/npm_tests/dual_cjs_esm/dual_cjs_esm/main.out new file mode 100644 index 0000000000..32e232f11c --- /dev/null +++ b/tests/specs/npm_tests/dual_cjs_esm/dual_cjs_esm/main.out @@ -0,0 +1,3 @@ +esm +cjs +cjs diff --git a/tests/specs/npm_tests/dual_cjs_esm/dual_cjs_esm/main.ts b/tests/specs/npm_tests/dual_cjs_esm/dual_cjs_esm/main.ts new file mode 100644 index 0000000000..4f3b796678 --- /dev/null +++ b/tests/specs/npm_tests/dual_cjs_esm/dual_cjs_esm/main.ts @@ -0,0 +1,6 @@ +import { getKind } from "npm:@denotest/dual-cjs-esm@latest"; // test out @latest dist tag +import * as cjs from "npm:@denotest/dual-cjs-esm@latest/cjs/main.cjs"; + +console.log(getKind()); +console.log(cjs.getKind()); +console.log(cjs.getSubPathKind()); diff --git a/tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/__test__.jsonc b/tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/__test__.jsonc new file mode 100644 index 0000000000..8dbee51c7e --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read --quiet dynamic_import_deno_ts_from_npm/main.ts", + "output": "dynamic_import_deno_ts_from_npm/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/dynamic_import_deno_ts_from_npm/add.ts b/tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/add.ts similarity index 100% rename from tests/testdata/npm/dynamic_import_deno_ts_from_npm/add.ts rename to tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/add.ts diff --git a/tests/testdata/npm/dynamic_import_deno_ts_from_npm/main.out b/tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/main.out similarity index 100% rename from tests/testdata/npm/dynamic_import_deno_ts_from_npm/main.out rename to tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/main.out diff --git a/tests/testdata/npm/dynamic_import_deno_ts_from_npm/main.ts b/tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/main.ts similarity index 100% rename from tests/testdata/npm/dynamic_import_deno_ts_from_npm/main.ts rename to tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/main.ts diff --git a/tests/testdata/npm/dynamic_import_deno_ts_from_npm/subtract.mts b/tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/subtract.mts similarity index 100% rename from tests/testdata/npm/dynamic_import_deno_ts_from_npm/subtract.mts rename to tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/subtract.mts diff --git a/tests/specs/npm_tests/dynamic_import_invalid_package_name/__test__.jsonc b/tests/specs/npm_tests/dynamic_import_invalid_package_name/__test__.jsonc new file mode 100644 index 0000000000..a15cabf83a --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_invalid_package_name/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --reload dynamic_import_invalid_package_name/main.ts", + "output": "dynamic_import_invalid_package_name/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/dynamic_import_invalid_package_name/main.out b/tests/specs/npm_tests/dynamic_import_invalid_package_name/dynamic_import_invalid_package_name/main.out similarity index 100% rename from tests/testdata/npm/dynamic_import_invalid_package_name/main.out rename to tests/specs/npm_tests/dynamic_import_invalid_package_name/dynamic_import_invalid_package_name/main.out diff --git a/tests/testdata/npm/dynamic_import_invalid_package_name/main.ts b/tests/specs/npm_tests/dynamic_import_invalid_package_name/dynamic_import_invalid_package_name/main.ts similarity index 100% rename from tests/testdata/npm/dynamic_import_invalid_package_name/main.ts rename to tests/specs/npm_tests/dynamic_import_invalid_package_name/dynamic_import_invalid_package_name/main.ts diff --git a/tests/specs/npm_tests/dynamic_import_json/__test__.jsonc b/tests/specs/npm_tests/dynamic_import_json/__test__.jsonc new file mode 100644 index 0000000000..9b4f5a2124 --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_json/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet import_json/main.js", + "output": "import_json/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/import_json/main.js b/tests/specs/npm_tests/dynamic_import_json/import_json/main.js similarity index 100% rename from tests/testdata/npm/import_json/main.js rename to tests/specs/npm_tests/dynamic_import_json/import_json/main.js diff --git a/tests/testdata/npm/import_json/main.out b/tests/specs/npm_tests/dynamic_import_json/import_json/main.out similarity index 100% rename from tests/testdata/npm/import_json/main.out rename to tests/specs/npm_tests/dynamic_import_json/import_json/main.out diff --git a/tests/specs/npm_tests/dynamic_import_reload_same_package/__test__.jsonc b/tests/specs/npm_tests/dynamic_import_reload_same_package/__test__.jsonc new file mode 100644 index 0000000000..d255b9a872 --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_reload_same_package/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --reload dynamic_import_reload_same_package/main.ts", + "output": "dynamic_import_reload_same_package/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/dynamic_import_reload_same_package/main.out b/tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/main.out similarity index 100% rename from tests/testdata/npm/dynamic_import_reload_same_package/main.out rename to tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/main.out diff --git a/tests/testdata/npm/dynamic_import_reload_same_package/main.ts b/tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/main.ts similarity index 100% rename from tests/testdata/npm/dynamic_import_reload_same_package/main.ts rename to tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/main.ts diff --git a/tests/testdata/npm/dynamic_import_reload_same_package/other.ts b/tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/other.ts similarity index 100% rename from tests/testdata/npm/dynamic_import_reload_same_package/other.ts rename to tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/other.ts diff --git a/tests/specs/npm_tests/env_var_re_export_dev/__test__.jsonc b/tests/specs/npm_tests/env_var_re_export_dev/__test__.jsonc new file mode 100644 index 0000000000..e65ae0308d --- /dev/null +++ b/tests/specs/npm_tests/env_var_re_export_dev/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read --allow-env --quiet env_var_re_export/main.js", + "output": "dev\n", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/env_var_re_export/main.js b/tests/specs/npm_tests/env_var_re_export_dev/env_var_re_export/main.js similarity index 100% rename from tests/testdata/npm/env_var_re_export/main.js rename to tests/specs/npm_tests/env_var_re_export_dev/env_var_re_export/main.js diff --git a/tests/specs/npm_tests/env_var_re_export_prod/__test__.jsonc b/tests/specs/npm_tests/env_var_re_export_prod/__test__.jsonc new file mode 100644 index 0000000000..6c206ba3e9 --- /dev/null +++ b/tests/specs/npm_tests/env_var_re_export_prod/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --allow-read --allow-env --quiet env_var_re_export/main.js", + "output": "prod\n", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/", + "NODE_ENV": "production" + } +} diff --git a/tests/specs/npm_tests/env_var_re_export_prod/env_var_re_export/main.js b/tests/specs/npm_tests/env_var_re_export_prod/env_var_re_export/main.js new file mode 100644 index 0000000000..ed91487a0b --- /dev/null +++ b/tests/specs/npm_tests/env_var_re_export_prod/env_var_re_export/main.js @@ -0,0 +1,3 @@ +import { getEnv } from "npm:@denotest/env-var-re-export"; + +console.log(getEnv()); diff --git a/tests/specs/npm_tests/error_version_after_subpath/__test__.jsonc b/tests/specs/npm_tests/error_version_after_subpath/__test__.jsonc new file mode 100644 index 0000000000..157e238d8a --- /dev/null +++ b/tests/specs/npm_tests/error_version_after_subpath/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run -A --quiet error_version_after_subpath/main.js", + "output": "error_version_after_subpath/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/error_version_after_subpath/main.js b/tests/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.js similarity index 100% rename from tests/testdata/npm/error_version_after_subpath/main.js rename to tests/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.js diff --git a/tests/testdata/npm/error_version_after_subpath/main.out b/tests/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.out similarity index 65% rename from tests/testdata/npm/error_version_after_subpath/main.out rename to tests/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.out index 0cdd1b6da0..4e5f03e23c 100644 --- a/tests/testdata/npm/error_version_after_subpath/main.out +++ b/tests/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.out @@ -1,2 +1,2 @@ error: Invalid package specifier 'npm:react-dom/server@18.2.0'. Did you mean to write 'npm:react-dom@18.2.0/server'? - at [WILDCARD]/npm/error_version_after_subpath/main.js:1:8 + at [WILDCARD]/error_version_after_subpath/main.js:1:8 diff --git a/tests/specs/npm_tests/import_json/__test__.jsonc b/tests/specs/npm_tests/import_json/__test__.jsonc new file mode 100644 index 0000000000..9b4f5a2124 --- /dev/null +++ b/tests/specs/npm_tests/import_json/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet import_json/main.js", + "output": "import_json/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/import_json/import_json/main.js b/tests/specs/npm_tests/import_json/import_json/main.js new file mode 100644 index 0000000000..ac6cee9a83 --- /dev/null +++ b/tests/specs/npm_tests/import_json/import_json/main.js @@ -0,0 +1,4 @@ +import json from "npm:@denotest/binary-package@1/package.json" with { + type: "json", +}; +console.log(json); diff --git a/tests/specs/npm_tests/import_json/import_json/main.out b/tests/specs/npm_tests/import_json/import_json/main.out new file mode 100644 index 0000000000..7db7ec4ea4 --- /dev/null +++ b/tests/specs/npm_tests/import_json/import_json/main.out @@ -0,0 +1,10 @@ +{ + name: "@denotest/binary-package", + version: "1.0.0", + main: "index.js", + optionalDependencies: { + "@denotest/binary-package-linux": "1.0.0", + "@denotest/binary-package-mac": "1.0.0", + "@denotest/binary-package-windows": "1.0.0" + } +} diff --git a/tests/specs/npm_tests/import_map/__test__.jsonc b/tests/specs/npm_tests/import_map/__test__.jsonc new file mode 100644 index 0000000000..822acbbe4e --- /dev/null +++ b/tests/specs/npm_tests/import_map/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read --allow-env --import-map import_map/import_map.json import_map/main.js", + "output": "import_map/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/import_map/import_map.json b/tests/specs/npm_tests/import_map/import_map/import_map.json similarity index 100% rename from tests/testdata/npm/import_map/import_map.json rename to tests/specs/npm_tests/import_map/import_map/import_map.json diff --git a/tests/testdata/npm/import_map/main.js b/tests/specs/npm_tests/import_map/import_map/main.js similarity index 100% rename from tests/testdata/npm/import_map/main.js rename to tests/specs/npm_tests/import_map/import_map/main.js diff --git a/tests/testdata/npm/import_map/main.out b/tests/specs/npm_tests/import_map/import_map/main.out similarity index 100% rename from tests/testdata/npm/import_map/main.out rename to tests/specs/npm_tests/import_map/import_map/main.out diff --git a/tests/specs/npm_tests/imports_package_json/__test__.jsonc b/tests/specs/npm_tests/imports_package_json/__test__.jsonc new file mode 100644 index 0000000000..e11b92132e --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --no-lock --node-modules-dir=none imports_package_json/main.js", + "output": "imports_package_json/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/imports_package_json/import_not_defined.js b/tests/specs/npm_tests/imports_package_json/imports_package_json/import_not_defined.js similarity index 100% rename from tests/testdata/npm/imports_package_json/import_not_defined.js rename to tests/specs/npm_tests/imports_package_json/imports_package_json/import_not_defined.js diff --git a/tests/testdata/npm/imports_package_json/import_not_defined.out b/tests/specs/npm_tests/imports_package_json/imports_package_json/import_not_defined.out similarity index 100% rename from tests/testdata/npm/imports_package_json/import_not_defined.out rename to tests/specs/npm_tests/imports_package_json/imports_package_json/import_not_defined.out diff --git a/tests/testdata/npm/imports_package_json/main.js b/tests/specs/npm_tests/imports_package_json/imports_package_json/main.js similarity index 100% rename from tests/testdata/npm/imports_package_json/main.js rename to tests/specs/npm_tests/imports_package_json/imports_package_json/main.js diff --git a/tests/testdata/npm/imports_package_json/main.out b/tests/specs/npm_tests/imports_package_json/imports_package_json/main.out similarity index 100% rename from tests/testdata/npm/imports_package_json/main.out rename to tests/specs/npm_tests/imports_package_json/imports_package_json/main.out diff --git a/tests/testdata/npm/imports_package_json/package.json b/tests/specs/npm_tests/imports_package_json/imports_package_json/package.json similarity index 100% rename from tests/testdata/npm/imports_package_json/package.json rename to tests/specs/npm_tests/imports_package_json/imports_package_json/package.json diff --git a/tests/testdata/npm/imports_package_json/sub_path_import_not_defined.js b/tests/specs/npm_tests/imports_package_json/imports_package_json/sub_path_import_not_defined.js similarity index 100% rename from tests/testdata/npm/imports_package_json/sub_path_import_not_defined.js rename to tests/specs/npm_tests/imports_package_json/imports_package_json/sub_path_import_not_defined.js diff --git a/tests/testdata/npm/imports_package_json/sub_path_import_not_defined.out b/tests/specs/npm_tests/imports_package_json/imports_package_json/sub_path_import_not_defined.out similarity index 100% rename from tests/testdata/npm/imports_package_json/sub_path_import_not_defined.out rename to tests/specs/npm_tests/imports_package_json/imports_package_json/sub_path_import_not_defined.out diff --git a/tests/specs/npm_tests/imports_package_json_import_not_defined/__test__.jsonc b/tests/specs/npm_tests/imports_package_json_import_not_defined/__test__.jsonc new file mode 100644 index 0000000000..0f094838c1 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_import_not_defined/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --no-lock --node-modules-dir=none imports_package_json/import_not_defined.js", + "output": "imports_package_json/import_not_defined.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/import_not_defined.js b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/import_not_defined.js new file mode 100644 index 0000000000..dc4d2df165 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/import_not_defined.js @@ -0,0 +1,3 @@ +import data from "@denotest/imports-package-json/import-not-defined"; + +console.log(data); diff --git a/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/import_not_defined.out b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/import_not_defined.out new file mode 100644 index 0000000000..70d1145a37 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/import_not_defined.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/imports-package-json +Download http://localhost:4260/@denotest/imports-package-json/1.0.0.tgz +error: [ERR_PACKAGE_IMPORT_NOT_DEFINED] Package import specifier "#not-defined" is not defined in package [WILDCARD]package.json imported from '[WILDCARD]import_not_defined.js' diff --git a/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/main.js b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/main.js new file mode 100644 index 0000000000..53090dd948 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/main.js @@ -0,0 +1,7 @@ +import data from "@denotest/imports-package-json"; + +console.log(data.hi); +console.log(data.bye); +console.log(typeof data.fs.readFile); +console.log(typeof data.path.join); +console.log(typeof data.fs2.writeFile); diff --git a/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/main.out b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/main.out new file mode 100644 index 0000000000..979e355765 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/main.out @@ -0,0 +1,7 @@ +Download http://localhost:4260/@denotest/imports-package-json +Download http://localhost:4260/@denotest/imports-package-json/1.0.0.tgz +hi +bye +function +function +function diff --git a/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/package.json b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/package.json new file mode 100644 index 0000000000..cb6a08d1a5 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/package.json @@ -0,0 +1,6 @@ +{ + "name": "my-test", + "dependencies": { + "@denotest/imports-package-json": "1.0.0" + } +} diff --git a/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.js b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.js new file mode 100644 index 0000000000..f1097aa064 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.js @@ -0,0 +1,3 @@ +import data from "@denotest/imports-package-json/sub-path-import-not-defined"; + +console.log(data); diff --git a/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.out b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.out new file mode 100644 index 0000000000..7c803f2bf1 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/imports-package-json +Download http://localhost:4260/@denotest/imports-package-json/1.0.0.tgz +error: [ERR_PACKAGE_IMPORT_NOT_DEFINED] Package import specifier "#hi" is not defined in package [WILDCARD]sub_path[WILDCARD]package.json imported from '[WILDCARD]import_not_defined.js' diff --git a/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/__test__.jsonc b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/__test__.jsonc new file mode 100644 index 0000000000..f862dc58e4 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --no-lock --node-modules-dir=none imports_package_json/sub_path_import_not_defined.js", + "output": "imports_package_json/sub_path_import_not_defined.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.js b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.js new file mode 100644 index 0000000000..dc4d2df165 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.js @@ -0,0 +1,3 @@ +import data from "@denotest/imports-package-json/import-not-defined"; + +console.log(data); diff --git a/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.out b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.out new file mode 100644 index 0000000000..70d1145a37 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/imports-package-json +Download http://localhost:4260/@denotest/imports-package-json/1.0.0.tgz +error: [ERR_PACKAGE_IMPORT_NOT_DEFINED] Package import specifier "#not-defined" is not defined in package [WILDCARD]package.json imported from '[WILDCARD]import_not_defined.js' diff --git a/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/main.js b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/main.js new file mode 100644 index 0000000000..53090dd948 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/main.js @@ -0,0 +1,7 @@ +import data from "@denotest/imports-package-json"; + +console.log(data.hi); +console.log(data.bye); +console.log(typeof data.fs.readFile); +console.log(typeof data.path.join); +console.log(typeof data.fs2.writeFile); diff --git a/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/main.out b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/main.out new file mode 100644 index 0000000000..979e355765 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/main.out @@ -0,0 +1,7 @@ +Download http://localhost:4260/@denotest/imports-package-json +Download http://localhost:4260/@denotest/imports-package-json/1.0.0.tgz +hi +bye +function +function +function diff --git a/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/package.json b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/package.json new file mode 100644 index 0000000000..cb6a08d1a5 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/package.json @@ -0,0 +1,6 @@ +{ + "name": "my-test", + "dependencies": { + "@denotest/imports-package-json": "1.0.0" + } +} diff --git a/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.js b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.js new file mode 100644 index 0000000000..f1097aa064 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.js @@ -0,0 +1,3 @@ +import data from "@denotest/imports-package-json/sub-path-import-not-defined"; + +console.log(data); diff --git a/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.out b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.out new file mode 100644 index 0000000000..7c803f2bf1 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/imports-package-json +Download http://localhost:4260/@denotest/imports-package-json/1.0.0.tgz +error: [ERR_PACKAGE_IMPORT_NOT_DEFINED] Package import specifier "#hi" is not defined in package [WILDCARD]sub_path[WILDCARD]package.json imported from '[WILDCARD]import_not_defined.js' diff --git a/tests/specs/npm_tests/info_chalk_display/__test__.jsonc b/tests/specs/npm_tests/info_chalk_display/__test__.jsonc new file mode 100644 index 0000000000..998aa6f1db --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_display/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "info --quiet cjs_with_deps/main.js", + "output": "cjs_with_deps/main_info.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main.js b/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main.js new file mode 100644 index 0000000000..568726874e --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main.js @@ -0,0 +1,12 @@ +import chalk from "npm:chalk@4"; +import { expect } from "npm:chai@4.3"; + +console.log(chalk.green("chalk cjs loads")); + +const timeout = setTimeout(() => {}, 0); +expect(timeout).to.be.a("number"); +clearTimeout(timeout); + +const interval = setInterval(() => {}, 100); +expect(interval).to.be.a("number"); +clearInterval(interval); diff --git a/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main.out b/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main.out new file mode 100644 index 0000000000..7051c23953 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main.out @@ -0,0 +1,33 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/chai +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/supports-color +Download http://localhost:4260/assertion-error +Download http://localhost:4260/check-error +Download http://localhost:4260/deep-eql +Download http://localhost:4260/get-func-name +Download http://localhost:4260/loupe +Download http://localhost:4260/pathval +Download http://localhost:4260/type-detect +Download http://localhost:4260/color-convert +Download http://localhost:4260/has-flag +Download http://localhost:4260/color-name +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz +Download http://localhost:4260/chai/chai-4.3.6.tgz +Download http://localhost:4260/chalk/chalk-4.1.2.tgz +Download http://localhost:4260/check-error/check-error-1.0.2.tgz +Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz +Download http://localhost:4260/color-name/color-name-1.1.4.tgz +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz +Download http://localhost:4260/loupe/loupe-2.3.4.tgz +Download http://localhost:4260/pathval/pathval-1.1.1.tgz +Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +[UNORDERED_END] +chalk cjs loads diff --git a/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main_info.out b/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main_info.out new file mode 100644 index 0000000000..8e37c88eb0 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main_info.out @@ -0,0 +1,22 @@ +local: [WILDCARD]main.js +type: JavaScript +dependencies: 14 unique +size: [WILDCARD] + +file:///[WILDCARD]/cjs_with_deps/main.js ([WILDCARD]) +├─┬ npm:/chalk@4.1.2 ([WILDCARD]) +│ ├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) +│ │ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) +│ │ └── npm:/color-name@1.1.4 ([WILDCARD]) +│ └─┬ npm:/supports-color@7.2.0 ([WILDCARD]) +│ └── npm:/has-flag@4.0.0 ([WILDCARD]) +└─┬ npm:/chai@4.3.6 ([WILDCARD]) + ├── npm:/assertion-error@1.1.0 ([WILDCARD]) + ├── npm:/check-error@1.0.2 ([WILDCARD]) + ├─┬ npm:/deep-eql@3.0.1 ([WILDCARD]) + │ └── npm:/type-detect@4.0.8 ([WILDCARD]) + ├── npm:/get-func-name@2.0.0 ([WILDCARD]) + ├─┬ npm:/loupe@2.3.4 ([WILDCARD]) + │ └── npm:/get-func-name@2.0.0 ([WILDCARD]) + ├── npm:/pathval@1.1.1 ([WILDCARD]) + └── npm:/type-detect@4.0.8 ([WILDCARD]) diff --git a/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main_info_json.out b/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main_info_json.out new file mode 100644 index 0000000000..af1ef13518 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main_info_json.out @@ -0,0 +1,148 @@ +{ + "roots": [ + "file://[WILDCARD]/main.js" + ], + "modules": [ + { + "kind": "esm", + "dependencies": [ + { + "specifier": "npm:chalk@4", + "code": { + "specifier": "npm:chalk@4", + "span": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 31 + } + } + }, + "npmPackage": "chalk@4.1.2" + }, + { + "specifier": "npm:chai@4.3", + "code": { + "specifier": "npm:chai@4.3", + "span": { + "start": { + "line": 1, + "character": 23 + }, + "end": { + "line": 1, + "character": 37 + } + } + }, + "npmPackage": "chai@4.3.6" + } + ], + "local": "[WILDCARD]main.js", + "size": 325, + "mediaType": "JavaScript", + "specifier": "[WILDCARD]/main.js" + } + ], + "redirects": { + "npm:chai@4.3": "npm:/chai@4.3.6", + "npm:chalk@4": "npm:/chalk@4.1.2" + }, + "version": 1, + "npmPackages": { + "ansi-styles@4.3.0": { + "name": "ansi-styles", + "version": "4.3.0", + "dependencies": [ + "color-convert@2.0.1" + ] + }, + "assertion-error@1.1.0": { + "name": "assertion-error", + "version": "1.1.0", + "dependencies": [] + }, + "chai@4.3.6": { + "name": "chai", + "version": "4.3.6", + "dependencies": [ + "assertion-error@1.1.0", + "check-error@1.0.2", + "deep-eql@3.0.1", + "get-func-name@2.0.0", + "loupe@2.3.4", + "pathval@1.1.1", + "type-detect@4.0.8" + ] + }, + "chalk@4.1.2": { + "name": "chalk", + "version": "4.1.2", + "dependencies": [ + "ansi-styles@4.3.0", + "supports-color@7.2.0" + ] + }, + "check-error@1.0.2": { + "name": "check-error", + "version": "1.0.2", + "dependencies": [] + }, + "color-convert@2.0.1": { + "name": "color-convert", + "version": "2.0.1", + "dependencies": [ + "color-name@1.1.4" + ] + }, + "color-name@1.1.4": { + "name": "color-name", + "version": "1.1.4", + "dependencies": [] + }, + "deep-eql@3.0.1": { + "name": "deep-eql", + "version": "3.0.1", + "dependencies": [ + "type-detect@4.0.8" + ] + }, + "get-func-name@2.0.0": { + "name": "get-func-name", + "version": "2.0.0", + "dependencies": [] + }, + "has-flag@4.0.0": { + "name": "has-flag", + "version": "4.0.0", + "dependencies": [] + }, + "loupe@2.3.4": { + "name": "loupe", + "version": "2.3.4", + "dependencies": [ + "get-func-name@2.0.0" + ] + }, + "pathval@1.1.1": { + "name": "pathval", + "version": "1.1.1", + "dependencies": [] + }, + "supports-color@7.2.0": { + "name": "supports-color", + "version": "7.2.0", + "dependencies": [ + "has-flag@4.0.0" + ] + }, + "type-detect@4.0.8": { + "name": "type-detect", + "version": "4.0.8", + "dependencies": [] + } + } +} diff --git a/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main_node_modules.out b/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main_node_modules.out new file mode 100644 index 0000000000..1ab3679521 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main_node_modules.out @@ -0,0 +1,47 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/chai +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/supports-color +Download http://localhost:4260/assertion-error +Download http://localhost:4260/check-error +Download http://localhost:4260/deep-eql +Download http://localhost:4260/get-func-name +Download http://localhost:4260/loupe +Download http://localhost:4260/pathval +Download http://localhost:4260/type-detect +Download http://localhost:4260/color-convert +Download http://localhost:4260/has-flag +Download http://localhost:4260/color-name +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Initialize ansi-styles@4.3.0 +Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz +Initialize assertion-error@1.1.0 +Download http://localhost:4260/chai/chai-4.3.6.tgz +Initialize chai@4.3.6 +Download http://localhost:4260/chalk/chalk-4.1.2.tgz +Initialize chalk@4.1.2 +Download http://localhost:4260/check-error/check-error-1.0.2.tgz +Initialize check-error@1.0.2 +Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz +Initialize color-convert@2.0.1 +Download http://localhost:4260/color-name/color-name-1.1.4.tgz +Initialize color-name@1.1.4 +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Initialize deep-eql@3.0.1 +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Initialize get-func-name@2.0.0 +Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz +Initialize has-flag@4.0.0 +Download http://localhost:4260/loupe/loupe-2.3.4.tgz +Initialize loupe@2.3.4 +Download http://localhost:4260/pathval/pathval-1.1.1.tgz +Initialize pathval@1.1.1 +Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz +Initialize supports-color@7.2.0 +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +Initialize type-detect@4.0.8 +[UNORDERED_END] +chalk cjs loads diff --git a/tests/specs/npm_tests/info_chalk_display_node_modules_dir/__test__.jsonc b/tests/specs/npm_tests/info_chalk_display_node_modules_dir/__test__.jsonc new file mode 100644 index 0000000000..5dd35f5a4a --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_display_node_modules_dir/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "info --quiet --node-modules-dir cjs_with_deps/main.js", + "output": "cjs_with_deps/main_info.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main.js b/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main.js new file mode 100644 index 0000000000..568726874e --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main.js @@ -0,0 +1,12 @@ +import chalk from "npm:chalk@4"; +import { expect } from "npm:chai@4.3"; + +console.log(chalk.green("chalk cjs loads")); + +const timeout = setTimeout(() => {}, 0); +expect(timeout).to.be.a("number"); +clearTimeout(timeout); + +const interval = setInterval(() => {}, 100); +expect(interval).to.be.a("number"); +clearInterval(interval); diff --git a/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main.out b/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main.out new file mode 100644 index 0000000000..7051c23953 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main.out @@ -0,0 +1,33 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/chai +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/supports-color +Download http://localhost:4260/assertion-error +Download http://localhost:4260/check-error +Download http://localhost:4260/deep-eql +Download http://localhost:4260/get-func-name +Download http://localhost:4260/loupe +Download http://localhost:4260/pathval +Download http://localhost:4260/type-detect +Download http://localhost:4260/color-convert +Download http://localhost:4260/has-flag +Download http://localhost:4260/color-name +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz +Download http://localhost:4260/chai/chai-4.3.6.tgz +Download http://localhost:4260/chalk/chalk-4.1.2.tgz +Download http://localhost:4260/check-error/check-error-1.0.2.tgz +Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz +Download http://localhost:4260/color-name/color-name-1.1.4.tgz +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz +Download http://localhost:4260/loupe/loupe-2.3.4.tgz +Download http://localhost:4260/pathval/pathval-1.1.1.tgz +Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +[UNORDERED_END] +chalk cjs loads diff --git a/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main_info.out b/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main_info.out new file mode 100644 index 0000000000..8e37c88eb0 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main_info.out @@ -0,0 +1,22 @@ +local: [WILDCARD]main.js +type: JavaScript +dependencies: 14 unique +size: [WILDCARD] + +file:///[WILDCARD]/cjs_with_deps/main.js ([WILDCARD]) +├─┬ npm:/chalk@4.1.2 ([WILDCARD]) +│ ├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) +│ │ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) +│ │ └── npm:/color-name@1.1.4 ([WILDCARD]) +│ └─┬ npm:/supports-color@7.2.0 ([WILDCARD]) +│ └── npm:/has-flag@4.0.0 ([WILDCARD]) +└─┬ npm:/chai@4.3.6 ([WILDCARD]) + ├── npm:/assertion-error@1.1.0 ([WILDCARD]) + ├── npm:/check-error@1.0.2 ([WILDCARD]) + ├─┬ npm:/deep-eql@3.0.1 ([WILDCARD]) + │ └── npm:/type-detect@4.0.8 ([WILDCARD]) + ├── npm:/get-func-name@2.0.0 ([WILDCARD]) + ├─┬ npm:/loupe@2.3.4 ([WILDCARD]) + │ └── npm:/get-func-name@2.0.0 ([WILDCARD]) + ├── npm:/pathval@1.1.1 ([WILDCARD]) + └── npm:/type-detect@4.0.8 ([WILDCARD]) diff --git a/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main_info_json.out b/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main_info_json.out new file mode 100644 index 0000000000..af1ef13518 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main_info_json.out @@ -0,0 +1,148 @@ +{ + "roots": [ + "file://[WILDCARD]/main.js" + ], + "modules": [ + { + "kind": "esm", + "dependencies": [ + { + "specifier": "npm:chalk@4", + "code": { + "specifier": "npm:chalk@4", + "span": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 31 + } + } + }, + "npmPackage": "chalk@4.1.2" + }, + { + "specifier": "npm:chai@4.3", + "code": { + "specifier": "npm:chai@4.3", + "span": { + "start": { + "line": 1, + "character": 23 + }, + "end": { + "line": 1, + "character": 37 + } + } + }, + "npmPackage": "chai@4.3.6" + } + ], + "local": "[WILDCARD]main.js", + "size": 325, + "mediaType": "JavaScript", + "specifier": "[WILDCARD]/main.js" + } + ], + "redirects": { + "npm:chai@4.3": "npm:/chai@4.3.6", + "npm:chalk@4": "npm:/chalk@4.1.2" + }, + "version": 1, + "npmPackages": { + "ansi-styles@4.3.0": { + "name": "ansi-styles", + "version": "4.3.0", + "dependencies": [ + "color-convert@2.0.1" + ] + }, + "assertion-error@1.1.0": { + "name": "assertion-error", + "version": "1.1.0", + "dependencies": [] + }, + "chai@4.3.6": { + "name": "chai", + "version": "4.3.6", + "dependencies": [ + "assertion-error@1.1.0", + "check-error@1.0.2", + "deep-eql@3.0.1", + "get-func-name@2.0.0", + "loupe@2.3.4", + "pathval@1.1.1", + "type-detect@4.0.8" + ] + }, + "chalk@4.1.2": { + "name": "chalk", + "version": "4.1.2", + "dependencies": [ + "ansi-styles@4.3.0", + "supports-color@7.2.0" + ] + }, + "check-error@1.0.2": { + "name": "check-error", + "version": "1.0.2", + "dependencies": [] + }, + "color-convert@2.0.1": { + "name": "color-convert", + "version": "2.0.1", + "dependencies": [ + "color-name@1.1.4" + ] + }, + "color-name@1.1.4": { + "name": "color-name", + "version": "1.1.4", + "dependencies": [] + }, + "deep-eql@3.0.1": { + "name": "deep-eql", + "version": "3.0.1", + "dependencies": [ + "type-detect@4.0.8" + ] + }, + "get-func-name@2.0.0": { + "name": "get-func-name", + "version": "2.0.0", + "dependencies": [] + }, + "has-flag@4.0.0": { + "name": "has-flag", + "version": "4.0.0", + "dependencies": [] + }, + "loupe@2.3.4": { + "name": "loupe", + "version": "2.3.4", + "dependencies": [ + "get-func-name@2.0.0" + ] + }, + "pathval@1.1.1": { + "name": "pathval", + "version": "1.1.1", + "dependencies": [] + }, + "supports-color@7.2.0": { + "name": "supports-color", + "version": "7.2.0", + "dependencies": [ + "has-flag@4.0.0" + ] + }, + "type-detect@4.0.8": { + "name": "type-detect", + "version": "4.0.8", + "dependencies": [] + } + } +} diff --git a/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main_node_modules.out b/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main_node_modules.out new file mode 100644 index 0000000000..1ab3679521 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main_node_modules.out @@ -0,0 +1,47 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/chai +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/supports-color +Download http://localhost:4260/assertion-error +Download http://localhost:4260/check-error +Download http://localhost:4260/deep-eql +Download http://localhost:4260/get-func-name +Download http://localhost:4260/loupe +Download http://localhost:4260/pathval +Download http://localhost:4260/type-detect +Download http://localhost:4260/color-convert +Download http://localhost:4260/has-flag +Download http://localhost:4260/color-name +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Initialize ansi-styles@4.3.0 +Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz +Initialize assertion-error@1.1.0 +Download http://localhost:4260/chai/chai-4.3.6.tgz +Initialize chai@4.3.6 +Download http://localhost:4260/chalk/chalk-4.1.2.tgz +Initialize chalk@4.1.2 +Download http://localhost:4260/check-error/check-error-1.0.2.tgz +Initialize check-error@1.0.2 +Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz +Initialize color-convert@2.0.1 +Download http://localhost:4260/color-name/color-name-1.1.4.tgz +Initialize color-name@1.1.4 +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Initialize deep-eql@3.0.1 +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Initialize get-func-name@2.0.0 +Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz +Initialize has-flag@4.0.0 +Download http://localhost:4260/loupe/loupe-2.3.4.tgz +Initialize loupe@2.3.4 +Download http://localhost:4260/pathval/pathval-1.1.1.tgz +Initialize pathval@1.1.1 +Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz +Initialize supports-color@7.2.0 +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +Initialize type-detect@4.0.8 +[UNORDERED_END] +chalk cjs loads diff --git a/tests/specs/npm_tests/info_chalk_json/__test__.jsonc b/tests/specs/npm_tests/info_chalk_json/__test__.jsonc new file mode 100644 index 0000000000..12c8b9b615 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_json/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "info --quiet --json cjs_with_deps/main.js", + "output": "cjs_with_deps/main_info_json.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main.js b/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main.js new file mode 100644 index 0000000000..568726874e --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main.js @@ -0,0 +1,12 @@ +import chalk from "npm:chalk@4"; +import { expect } from "npm:chai@4.3"; + +console.log(chalk.green("chalk cjs loads")); + +const timeout = setTimeout(() => {}, 0); +expect(timeout).to.be.a("number"); +clearTimeout(timeout); + +const interval = setInterval(() => {}, 100); +expect(interval).to.be.a("number"); +clearInterval(interval); diff --git a/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main.out b/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main.out new file mode 100644 index 0000000000..7051c23953 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main.out @@ -0,0 +1,33 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/chai +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/supports-color +Download http://localhost:4260/assertion-error +Download http://localhost:4260/check-error +Download http://localhost:4260/deep-eql +Download http://localhost:4260/get-func-name +Download http://localhost:4260/loupe +Download http://localhost:4260/pathval +Download http://localhost:4260/type-detect +Download http://localhost:4260/color-convert +Download http://localhost:4260/has-flag +Download http://localhost:4260/color-name +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz +Download http://localhost:4260/chai/chai-4.3.6.tgz +Download http://localhost:4260/chalk/chalk-4.1.2.tgz +Download http://localhost:4260/check-error/check-error-1.0.2.tgz +Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz +Download http://localhost:4260/color-name/color-name-1.1.4.tgz +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz +Download http://localhost:4260/loupe/loupe-2.3.4.tgz +Download http://localhost:4260/pathval/pathval-1.1.1.tgz +Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +[UNORDERED_END] +chalk cjs loads diff --git a/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main_info.out b/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main_info.out new file mode 100644 index 0000000000..8e37c88eb0 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main_info.out @@ -0,0 +1,22 @@ +local: [WILDCARD]main.js +type: JavaScript +dependencies: 14 unique +size: [WILDCARD] + +file:///[WILDCARD]/cjs_with_deps/main.js ([WILDCARD]) +├─┬ npm:/chalk@4.1.2 ([WILDCARD]) +│ ├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) +│ │ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) +│ │ └── npm:/color-name@1.1.4 ([WILDCARD]) +│ └─┬ npm:/supports-color@7.2.0 ([WILDCARD]) +│ └── npm:/has-flag@4.0.0 ([WILDCARD]) +└─┬ npm:/chai@4.3.6 ([WILDCARD]) + ├── npm:/assertion-error@1.1.0 ([WILDCARD]) + ├── npm:/check-error@1.0.2 ([WILDCARD]) + ├─┬ npm:/deep-eql@3.0.1 ([WILDCARD]) + │ └── npm:/type-detect@4.0.8 ([WILDCARD]) + ├── npm:/get-func-name@2.0.0 ([WILDCARD]) + ├─┬ npm:/loupe@2.3.4 ([WILDCARD]) + │ └── npm:/get-func-name@2.0.0 ([WILDCARD]) + ├── npm:/pathval@1.1.1 ([WILDCARD]) + └── npm:/type-detect@4.0.8 ([WILDCARD]) diff --git a/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main_info_json.out b/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main_info_json.out new file mode 100644 index 0000000000..af1ef13518 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main_info_json.out @@ -0,0 +1,148 @@ +{ + "roots": [ + "file://[WILDCARD]/main.js" + ], + "modules": [ + { + "kind": "esm", + "dependencies": [ + { + "specifier": "npm:chalk@4", + "code": { + "specifier": "npm:chalk@4", + "span": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 31 + } + } + }, + "npmPackage": "chalk@4.1.2" + }, + { + "specifier": "npm:chai@4.3", + "code": { + "specifier": "npm:chai@4.3", + "span": { + "start": { + "line": 1, + "character": 23 + }, + "end": { + "line": 1, + "character": 37 + } + } + }, + "npmPackage": "chai@4.3.6" + } + ], + "local": "[WILDCARD]main.js", + "size": 325, + "mediaType": "JavaScript", + "specifier": "[WILDCARD]/main.js" + } + ], + "redirects": { + "npm:chai@4.3": "npm:/chai@4.3.6", + "npm:chalk@4": "npm:/chalk@4.1.2" + }, + "version": 1, + "npmPackages": { + "ansi-styles@4.3.0": { + "name": "ansi-styles", + "version": "4.3.0", + "dependencies": [ + "color-convert@2.0.1" + ] + }, + "assertion-error@1.1.0": { + "name": "assertion-error", + "version": "1.1.0", + "dependencies": [] + }, + "chai@4.3.6": { + "name": "chai", + "version": "4.3.6", + "dependencies": [ + "assertion-error@1.1.0", + "check-error@1.0.2", + "deep-eql@3.0.1", + "get-func-name@2.0.0", + "loupe@2.3.4", + "pathval@1.1.1", + "type-detect@4.0.8" + ] + }, + "chalk@4.1.2": { + "name": "chalk", + "version": "4.1.2", + "dependencies": [ + "ansi-styles@4.3.0", + "supports-color@7.2.0" + ] + }, + "check-error@1.0.2": { + "name": "check-error", + "version": "1.0.2", + "dependencies": [] + }, + "color-convert@2.0.1": { + "name": "color-convert", + "version": "2.0.1", + "dependencies": [ + "color-name@1.1.4" + ] + }, + "color-name@1.1.4": { + "name": "color-name", + "version": "1.1.4", + "dependencies": [] + }, + "deep-eql@3.0.1": { + "name": "deep-eql", + "version": "3.0.1", + "dependencies": [ + "type-detect@4.0.8" + ] + }, + "get-func-name@2.0.0": { + "name": "get-func-name", + "version": "2.0.0", + "dependencies": [] + }, + "has-flag@4.0.0": { + "name": "has-flag", + "version": "4.0.0", + "dependencies": [] + }, + "loupe@2.3.4": { + "name": "loupe", + "version": "2.3.4", + "dependencies": [ + "get-func-name@2.0.0" + ] + }, + "pathval@1.1.1": { + "name": "pathval", + "version": "1.1.1", + "dependencies": [] + }, + "supports-color@7.2.0": { + "name": "supports-color", + "version": "7.2.0", + "dependencies": [ + "has-flag@4.0.0" + ] + }, + "type-detect@4.0.8": { + "name": "type-detect", + "version": "4.0.8", + "dependencies": [] + } + } +} diff --git a/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main_node_modules.out b/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main_node_modules.out new file mode 100644 index 0000000000..1ab3679521 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main_node_modules.out @@ -0,0 +1,47 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/chai +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/supports-color +Download http://localhost:4260/assertion-error +Download http://localhost:4260/check-error +Download http://localhost:4260/deep-eql +Download http://localhost:4260/get-func-name +Download http://localhost:4260/loupe +Download http://localhost:4260/pathval +Download http://localhost:4260/type-detect +Download http://localhost:4260/color-convert +Download http://localhost:4260/has-flag +Download http://localhost:4260/color-name +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Initialize ansi-styles@4.3.0 +Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz +Initialize assertion-error@1.1.0 +Download http://localhost:4260/chai/chai-4.3.6.tgz +Initialize chai@4.3.6 +Download http://localhost:4260/chalk/chalk-4.1.2.tgz +Initialize chalk@4.1.2 +Download http://localhost:4260/check-error/check-error-1.0.2.tgz +Initialize check-error@1.0.2 +Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz +Initialize color-convert@2.0.1 +Download http://localhost:4260/color-name/color-name-1.1.4.tgz +Initialize color-name@1.1.4 +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Initialize deep-eql@3.0.1 +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Initialize get-func-name@2.0.0 +Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz +Initialize has-flag@4.0.0 +Download http://localhost:4260/loupe/loupe-2.3.4.tgz +Initialize loupe@2.3.4 +Download http://localhost:4260/pathval/pathval-1.1.1.tgz +Initialize pathval@1.1.1 +Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz +Initialize supports-color@7.2.0 +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +Initialize type-detect@4.0.8 +[UNORDERED_END] +chalk cjs loads diff --git a/tests/specs/npm_tests/info_chalk_json_node_modules_dir/__test__.jsonc b/tests/specs/npm_tests/info_chalk_json_node_modules_dir/__test__.jsonc new file mode 100644 index 0000000000..1b34f48137 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_json_node_modules_dir/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "info --quiet --node-modules-dir --json cjs_with_deps/main.js", + "output": "cjs_with_deps/main_info_json.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main.js b/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main.js new file mode 100644 index 0000000000..568726874e --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main.js @@ -0,0 +1,12 @@ +import chalk from "npm:chalk@4"; +import { expect } from "npm:chai@4.3"; + +console.log(chalk.green("chalk cjs loads")); + +const timeout = setTimeout(() => {}, 0); +expect(timeout).to.be.a("number"); +clearTimeout(timeout); + +const interval = setInterval(() => {}, 100); +expect(interval).to.be.a("number"); +clearInterval(interval); diff --git a/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main.out b/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main.out new file mode 100644 index 0000000000..7051c23953 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main.out @@ -0,0 +1,33 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/chai +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/supports-color +Download http://localhost:4260/assertion-error +Download http://localhost:4260/check-error +Download http://localhost:4260/deep-eql +Download http://localhost:4260/get-func-name +Download http://localhost:4260/loupe +Download http://localhost:4260/pathval +Download http://localhost:4260/type-detect +Download http://localhost:4260/color-convert +Download http://localhost:4260/has-flag +Download http://localhost:4260/color-name +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz +Download http://localhost:4260/chai/chai-4.3.6.tgz +Download http://localhost:4260/chalk/chalk-4.1.2.tgz +Download http://localhost:4260/check-error/check-error-1.0.2.tgz +Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz +Download http://localhost:4260/color-name/color-name-1.1.4.tgz +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz +Download http://localhost:4260/loupe/loupe-2.3.4.tgz +Download http://localhost:4260/pathval/pathval-1.1.1.tgz +Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +[UNORDERED_END] +chalk cjs loads diff --git a/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main_info.out b/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main_info.out new file mode 100644 index 0000000000..8e37c88eb0 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main_info.out @@ -0,0 +1,22 @@ +local: [WILDCARD]main.js +type: JavaScript +dependencies: 14 unique +size: [WILDCARD] + +file:///[WILDCARD]/cjs_with_deps/main.js ([WILDCARD]) +├─┬ npm:/chalk@4.1.2 ([WILDCARD]) +│ ├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) +│ │ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) +│ │ └── npm:/color-name@1.1.4 ([WILDCARD]) +│ └─┬ npm:/supports-color@7.2.0 ([WILDCARD]) +│ └── npm:/has-flag@4.0.0 ([WILDCARD]) +└─┬ npm:/chai@4.3.6 ([WILDCARD]) + ├── npm:/assertion-error@1.1.0 ([WILDCARD]) + ├── npm:/check-error@1.0.2 ([WILDCARD]) + ├─┬ npm:/deep-eql@3.0.1 ([WILDCARD]) + │ └── npm:/type-detect@4.0.8 ([WILDCARD]) + ├── npm:/get-func-name@2.0.0 ([WILDCARD]) + ├─┬ npm:/loupe@2.3.4 ([WILDCARD]) + │ └── npm:/get-func-name@2.0.0 ([WILDCARD]) + ├── npm:/pathval@1.1.1 ([WILDCARD]) + └── npm:/type-detect@4.0.8 ([WILDCARD]) diff --git a/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main_info_json.out b/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main_info_json.out new file mode 100644 index 0000000000..af1ef13518 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main_info_json.out @@ -0,0 +1,148 @@ +{ + "roots": [ + "file://[WILDCARD]/main.js" + ], + "modules": [ + { + "kind": "esm", + "dependencies": [ + { + "specifier": "npm:chalk@4", + "code": { + "specifier": "npm:chalk@4", + "span": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 31 + } + } + }, + "npmPackage": "chalk@4.1.2" + }, + { + "specifier": "npm:chai@4.3", + "code": { + "specifier": "npm:chai@4.3", + "span": { + "start": { + "line": 1, + "character": 23 + }, + "end": { + "line": 1, + "character": 37 + } + } + }, + "npmPackage": "chai@4.3.6" + } + ], + "local": "[WILDCARD]main.js", + "size": 325, + "mediaType": "JavaScript", + "specifier": "[WILDCARD]/main.js" + } + ], + "redirects": { + "npm:chai@4.3": "npm:/chai@4.3.6", + "npm:chalk@4": "npm:/chalk@4.1.2" + }, + "version": 1, + "npmPackages": { + "ansi-styles@4.3.0": { + "name": "ansi-styles", + "version": "4.3.0", + "dependencies": [ + "color-convert@2.0.1" + ] + }, + "assertion-error@1.1.0": { + "name": "assertion-error", + "version": "1.1.0", + "dependencies": [] + }, + "chai@4.3.6": { + "name": "chai", + "version": "4.3.6", + "dependencies": [ + "assertion-error@1.1.0", + "check-error@1.0.2", + "deep-eql@3.0.1", + "get-func-name@2.0.0", + "loupe@2.3.4", + "pathval@1.1.1", + "type-detect@4.0.8" + ] + }, + "chalk@4.1.2": { + "name": "chalk", + "version": "4.1.2", + "dependencies": [ + "ansi-styles@4.3.0", + "supports-color@7.2.0" + ] + }, + "check-error@1.0.2": { + "name": "check-error", + "version": "1.0.2", + "dependencies": [] + }, + "color-convert@2.0.1": { + "name": "color-convert", + "version": "2.0.1", + "dependencies": [ + "color-name@1.1.4" + ] + }, + "color-name@1.1.4": { + "name": "color-name", + "version": "1.1.4", + "dependencies": [] + }, + "deep-eql@3.0.1": { + "name": "deep-eql", + "version": "3.0.1", + "dependencies": [ + "type-detect@4.0.8" + ] + }, + "get-func-name@2.0.0": { + "name": "get-func-name", + "version": "2.0.0", + "dependencies": [] + }, + "has-flag@4.0.0": { + "name": "has-flag", + "version": "4.0.0", + "dependencies": [] + }, + "loupe@2.3.4": { + "name": "loupe", + "version": "2.3.4", + "dependencies": [ + "get-func-name@2.0.0" + ] + }, + "pathval@1.1.1": { + "name": "pathval", + "version": "1.1.1", + "dependencies": [] + }, + "supports-color@7.2.0": { + "name": "supports-color", + "version": "7.2.0", + "dependencies": [ + "has-flag@4.0.0" + ] + }, + "type-detect@4.0.8": { + "name": "type-detect", + "version": "4.0.8", + "dependencies": [] + } + } +} diff --git a/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main_node_modules.out b/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main_node_modules.out new file mode 100644 index 0000000000..1ab3679521 --- /dev/null +++ b/tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main_node_modules.out @@ -0,0 +1,47 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/chai +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/supports-color +Download http://localhost:4260/assertion-error +Download http://localhost:4260/check-error +Download http://localhost:4260/deep-eql +Download http://localhost:4260/get-func-name +Download http://localhost:4260/loupe +Download http://localhost:4260/pathval +Download http://localhost:4260/type-detect +Download http://localhost:4260/color-convert +Download http://localhost:4260/has-flag +Download http://localhost:4260/color-name +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Initialize ansi-styles@4.3.0 +Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz +Initialize assertion-error@1.1.0 +Download http://localhost:4260/chai/chai-4.3.6.tgz +Initialize chai@4.3.6 +Download http://localhost:4260/chalk/chalk-4.1.2.tgz +Initialize chalk@4.1.2 +Download http://localhost:4260/check-error/check-error-1.0.2.tgz +Initialize check-error@1.0.2 +Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz +Initialize color-convert@2.0.1 +Download http://localhost:4260/color-name/color-name-1.1.4.tgz +Initialize color-name@1.1.4 +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Initialize deep-eql@3.0.1 +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Initialize get-func-name@2.0.0 +Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz +Initialize has-flag@4.0.0 +Download http://localhost:4260/loupe/loupe-2.3.4.tgz +Initialize loupe@2.3.4 +Download http://localhost:4260/pathval/pathval-1.1.1.tgz +Initialize pathval@1.1.1 +Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz +Initialize supports-color@7.2.0 +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +Initialize type-detect@4.0.8 +[UNORDERED_END] +chalk cjs loads diff --git a/tests/specs/npm_tests/info_cli_chalk_display/__test__.jsonc b/tests/specs/npm_tests/info_cli_chalk_display/__test__.jsonc new file mode 100644 index 0000000000..7587fbcb6e --- /dev/null +++ b/tests/specs/npm_tests/info_cli_chalk_display/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "info --quiet npm:chalk@4", + "output": "info/chalk.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/info/chalk.out b/tests/specs/npm_tests/info_cli_chalk_display/info/chalk.out similarity index 100% rename from tests/testdata/npm/info/chalk.out rename to tests/specs/npm_tests/info_cli_chalk_display/info/chalk.out diff --git a/tests/testdata/npm/info/chalk_json.out b/tests/specs/npm_tests/info_cli_chalk_display/info/chalk_json.out similarity index 100% rename from tests/testdata/npm/info/chalk_json.out rename to tests/specs/npm_tests/info_cli_chalk_display/info/chalk_json.out diff --git a/tests/specs/npm_tests/info_cli_chalk_json/__test__.jsonc b/tests/specs/npm_tests/info_cli_chalk_json/__test__.jsonc new file mode 100644 index 0000000000..b5173fd93f --- /dev/null +++ b/tests/specs/npm_tests/info_cli_chalk_json/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "info --quiet --json npm:chalk@4", + "output": "info/chalk_json.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/info_cli_chalk_json/info/chalk.out b/tests/specs/npm_tests/info_cli_chalk_json/info/chalk.out new file mode 100644 index 0000000000..63fa20da54 --- /dev/null +++ b/tests/specs/npm_tests/info_cli_chalk_json/info/chalk.out @@ -0,0 +1,9 @@ +dependencies: 5 unique +size: [WILDCARD] + +npm:/chalk@4.1.2 ([WILDCARD]) +├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) +│ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) +│ └── npm:/color-name@1.1.4 ([WILDCARD]) +└─┬ npm:/supports-color@7.2.0 ([WILDCARD]) + └── npm:/has-flag@4.0.0 ([WILDCARD]) diff --git a/tests/specs/npm_tests/info_cli_chalk_json/info/chalk_json.out b/tests/specs/npm_tests/info_cli_chalk_json/info/chalk_json.out new file mode 100644 index 0000000000..d54155270b --- /dev/null +++ b/tests/specs/npm_tests/info_cli_chalk_json/info/chalk_json.out @@ -0,0 +1,57 @@ +{ + "roots": [ + "npm:chalk@4" + ], + "modules": [ + { + "kind": "npm", + "specifier": "npm:/chalk@4.1.2", + "npmPackage": "chalk@4.1.2" + } + ], + "redirects": { + "npm:chalk@4": "npm:/chalk@4.1.2" + }, + "version": 1, + "npmPackages": { + "ansi-styles@4.3.0": { + "name": "ansi-styles", + "version": "4.3.0", + "dependencies": [ + "color-convert@2.0.1" + ] + }, + "chalk@4.1.2": { + "name": "chalk", + "version": "4.1.2", + "dependencies": [ + "ansi-styles@4.3.0", + "supports-color@7.2.0" + ] + }, + "color-convert@2.0.1": { + "name": "color-convert", + "version": "2.0.1", + "dependencies": [ + "color-name@1.1.4" + ] + }, + "color-name@1.1.4": { + "name": "color-name", + "version": "1.1.4", + "dependencies": [] + }, + "has-flag@4.0.0": { + "name": "has-flag", + "version": "4.0.0", + "dependencies": [] + }, + "supports-color@7.2.0": { + "name": "supports-color", + "version": "7.2.0", + "dependencies": [ + "has-flag@4.0.0" + ] + } + } +} diff --git a/tests/specs/npm_tests/info_peer_deps/__test__.jsonc b/tests/specs/npm_tests/info_peer_deps/__test__.jsonc new file mode 100644 index 0000000000..e505f30774 --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "info --quiet peer_deps_with_copied_folders/main.ts", + "output": "peer_deps_with_copied_folders/main_info.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main.out b/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main.out new file mode 100644 index 0000000000..3c133bcde4 --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main.out @@ -0,0 +1,14 @@ +[UNORDERED_START] +Download http://localhost:4260/@denotest/peer-dep-test-child +Download http://localhost:4260/@denotest/peer-dep-test-grandchild +Download http://localhost:4260/@denotest/peer-dep-test-peer +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/@denotest/peer-dep-test-child/1.0.0.tgz +Download http://localhost:4260/@denotest/peer-dep-test-child/2.0.0.tgz +Download http://localhost:4260/@denotest/peer-dep-test-grandchild/1.0.0.tgz +Download http://localhost:4260/@denotest/peer-dep-test-peer/1.0.0.tgz +Download http://localhost:4260/@denotest/peer-dep-test-peer/2.0.0.tgz +[UNORDERED_END] +1 +2 diff --git a/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main.ts b/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main.ts new file mode 100644 index 0000000000..a8ea8104a9 --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main.ts @@ -0,0 +1,5 @@ +import version1 from "npm:@denotest/peer-dep-test-child@1"; +import version2 from "npm:@denotest/peer-dep-test-child@2"; + +console.error(version1); +console.error(version2); diff --git a/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_info.out b/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_info.out new file mode 100644 index 0000000000..e8b92399df --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_info.out @@ -0,0 +1,14 @@ +local: [WILDCARD]main.ts +type: TypeScript +dependencies: 6 unique +size: [WILDCARD] + +file:///[WILDCARD]/peer_deps_with_copied_folders/main.ts (171B) +├─┬ npm:/@denotest/peer-dep-test-child@1.0.0 ([WILDCARD]) +│ ├─┬ npm:/@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@1.0.0 ([WILDCARD]) +│ │ └── npm:/@denotest/peer-dep-test-peer@1.0.0 ([WILDCARD]) +│ └── npm:/@denotest/peer-dep-test-peer@1.0.0 ([WILDCARD]) +└─┬ npm:/@denotest/peer-dep-test-child@2.0.0 ([WILDCARD]) + ├─┬ npm:/@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@2.0.0 ([WILDCARD]) + │ └── npm:/@denotest/peer-dep-test-peer@2.0.0 ([WILDCARD]) + └── npm:/@denotest/peer-dep-test-peer@2.0.0 ([WILDCARD]) diff --git a/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_info_json.out b/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_info_json.out new file mode 100644 index 0000000000..1a5f07c971 --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_info_json.out @@ -0,0 +1,97 @@ +{ + "roots": [ + "[WILDCARD]/peer_deps_with_copied_folders/main.ts" + ], + "modules": [ + { + "kind": "esm", + "dependencies": [ + { + "specifier": "npm:@denotest/peer-dep-test-child@1", + "code": { + "specifier": "npm:@denotest/peer-dep-test-child@1", + "span": { + "start": { + "line": 0, + "character": 21 + }, + "end": { + "line": 0, + "character": 58 + } + } + }, + "npmPackage": "@denotest/peer-dep-test-child@1.0.0_@denotest+peer-dep-test-peer@1.0.0" + }, + { + "specifier": "npm:@denotest/peer-dep-test-child@2", + "code": { + "specifier": "npm:@denotest/peer-dep-test-child@2", + "span": { + "start": { + "line": 1, + "character": 21 + }, + "end": { + "line": 1, + "character": 58 + } + } + }, + "npmPackage": "@denotest/peer-dep-test-child@2.0.0_@denotest+peer-dep-test-peer@2.0.0" + } + ], + "local": "[WILDCARD]main.ts", + "size": 171, + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/main.ts" + } + ], + "redirects": { + "npm:@denotest/peer-dep-test-child@1": "npm:/@denotest/peer-dep-test-child@1.0.0", + "npm:@denotest/peer-dep-test-child@2": "npm:/@denotest/peer-dep-test-child@2.0.0" + }, + "version": 1, + "npmPackages": { + "@denotest/peer-dep-test-child@1.0.0_@denotest+peer-dep-test-peer@1.0.0": { + "name": "@denotest/peer-dep-test-child", + "version": "1.0.0", + "dependencies": [ + "@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@1.0.0", + "@denotest/peer-dep-test-peer@1.0.0" + ] + }, + "@denotest/peer-dep-test-child@2.0.0_@denotest+peer-dep-test-peer@2.0.0": { + "name": "@denotest/peer-dep-test-child", + "version": "2.0.0", + "dependencies": [ + "@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@2.0.0", + "@denotest/peer-dep-test-peer@2.0.0" + ] + }, + "@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@1.0.0": { + "name": "@denotest/peer-dep-test-grandchild", + "version": "1.0.0", + "dependencies": [ + "@denotest/peer-dep-test-peer@1.0.0" + ] + }, + "@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@2.0.0": { + "name": "@denotest/peer-dep-test-grandchild", + "version": "1.0.0", + "dependencies": [ + "@denotest/peer-dep-test-peer@2.0.0" + ] + }, + "@denotest/peer-dep-test-peer@1.0.0": { + "name": "@denotest/peer-dep-test-peer", + "version": "1.0.0", + "dependencies": [] + }, + "@denotest/peer-dep-test-peer@2.0.0": { + "name": "@denotest/peer-dep-test-peer", + "version": "2.0.0", + "dependencies": [] + } + } +} diff --git a/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_node_modules.out b/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_node_modules.out new file mode 100644 index 0000000000..02b5cbafd6 --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_node_modules.out @@ -0,0 +1,9 @@ +[UNORDERED_START] +Initialize @denotest/peer-dep-test-child@1.0.0 +Initialize @denotest/peer-dep-test-child@2.0.0 +Initialize @denotest/peer-dep-test-grandchild@1.0.0 +Initialize @denotest/peer-dep-test-peer@1.0.0 +Initialize @denotest/peer-dep-test-peer@2.0.0 +[UNORDERED_END] +1 +2 diff --git a/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_node_modules_reload.out b/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_node_modules_reload.out new file mode 100644 index 0000000000..9c81452118 --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_node_modules_reload.out @@ -0,0 +1,19 @@ +[UNORDERED_START] +Download http://localhost:4260/@denotest/peer-dep-test-child +Download http://localhost:4260/@denotest/peer-dep-test-grandchild +Download http://localhost:4260/@denotest/peer-dep-test-peer +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/@denotest/peer-dep-test-child/1.0.0.tgz +Initialize @denotest/peer-dep-test-child@1.0.0 +Download http://localhost:4260/@denotest/peer-dep-test-child/2.0.0.tgz +Initialize @denotest/peer-dep-test-child@2.0.0 +Download http://localhost:4260/@denotest/peer-dep-test-grandchild/1.0.0.tgz +Initialize @denotest/peer-dep-test-grandchild@1.0.0 +Download http://localhost:4260/@denotest/peer-dep-test-peer/1.0.0.tgz +Initialize @denotest/peer-dep-test-peer@1.0.0 +Download http://localhost:4260/@denotest/peer-dep-test-peer/2.0.0.tgz +Initialize @denotest/peer-dep-test-peer@2.0.0 +[UNORDERED_END] +1 +2 diff --git a/tests/specs/npm_tests/info_peer_deps_json/__test__.jsonc b/tests/specs/npm_tests/info_peer_deps_json/__test__.jsonc new file mode 100644 index 0000000000..9a630add45 --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps_json/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "info --quiet --json peer_deps_with_copied_folders/main.ts", + "output": "peer_deps_with_copied_folders/main_info_json.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main.out b/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main.out new file mode 100644 index 0000000000..3c133bcde4 --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main.out @@ -0,0 +1,14 @@ +[UNORDERED_START] +Download http://localhost:4260/@denotest/peer-dep-test-child +Download http://localhost:4260/@denotest/peer-dep-test-grandchild +Download http://localhost:4260/@denotest/peer-dep-test-peer +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/@denotest/peer-dep-test-child/1.0.0.tgz +Download http://localhost:4260/@denotest/peer-dep-test-child/2.0.0.tgz +Download http://localhost:4260/@denotest/peer-dep-test-grandchild/1.0.0.tgz +Download http://localhost:4260/@denotest/peer-dep-test-peer/1.0.0.tgz +Download http://localhost:4260/@denotest/peer-dep-test-peer/2.0.0.tgz +[UNORDERED_END] +1 +2 diff --git a/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main.ts b/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main.ts new file mode 100644 index 0000000000..a8ea8104a9 --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main.ts @@ -0,0 +1,5 @@ +import version1 from "npm:@denotest/peer-dep-test-child@1"; +import version2 from "npm:@denotest/peer-dep-test-child@2"; + +console.error(version1); +console.error(version2); diff --git a/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_info.out b/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_info.out new file mode 100644 index 0000000000..e8b92399df --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_info.out @@ -0,0 +1,14 @@ +local: [WILDCARD]main.ts +type: TypeScript +dependencies: 6 unique +size: [WILDCARD] + +file:///[WILDCARD]/peer_deps_with_copied_folders/main.ts (171B) +├─┬ npm:/@denotest/peer-dep-test-child@1.0.0 ([WILDCARD]) +│ ├─┬ npm:/@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@1.0.0 ([WILDCARD]) +│ │ └── npm:/@denotest/peer-dep-test-peer@1.0.0 ([WILDCARD]) +│ └── npm:/@denotest/peer-dep-test-peer@1.0.0 ([WILDCARD]) +└─┬ npm:/@denotest/peer-dep-test-child@2.0.0 ([WILDCARD]) + ├─┬ npm:/@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@2.0.0 ([WILDCARD]) + │ └── npm:/@denotest/peer-dep-test-peer@2.0.0 ([WILDCARD]) + └── npm:/@denotest/peer-dep-test-peer@2.0.0 ([WILDCARD]) diff --git a/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_info_json.out b/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_info_json.out new file mode 100644 index 0000000000..1a5f07c971 --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_info_json.out @@ -0,0 +1,97 @@ +{ + "roots": [ + "[WILDCARD]/peer_deps_with_copied_folders/main.ts" + ], + "modules": [ + { + "kind": "esm", + "dependencies": [ + { + "specifier": "npm:@denotest/peer-dep-test-child@1", + "code": { + "specifier": "npm:@denotest/peer-dep-test-child@1", + "span": { + "start": { + "line": 0, + "character": 21 + }, + "end": { + "line": 0, + "character": 58 + } + } + }, + "npmPackage": "@denotest/peer-dep-test-child@1.0.0_@denotest+peer-dep-test-peer@1.0.0" + }, + { + "specifier": "npm:@denotest/peer-dep-test-child@2", + "code": { + "specifier": "npm:@denotest/peer-dep-test-child@2", + "span": { + "start": { + "line": 1, + "character": 21 + }, + "end": { + "line": 1, + "character": 58 + } + } + }, + "npmPackage": "@denotest/peer-dep-test-child@2.0.0_@denotest+peer-dep-test-peer@2.0.0" + } + ], + "local": "[WILDCARD]main.ts", + "size": 171, + "mediaType": "TypeScript", + "specifier": "file://[WILDCARD]/main.ts" + } + ], + "redirects": { + "npm:@denotest/peer-dep-test-child@1": "npm:/@denotest/peer-dep-test-child@1.0.0", + "npm:@denotest/peer-dep-test-child@2": "npm:/@denotest/peer-dep-test-child@2.0.0" + }, + "version": 1, + "npmPackages": { + "@denotest/peer-dep-test-child@1.0.0_@denotest+peer-dep-test-peer@1.0.0": { + "name": "@denotest/peer-dep-test-child", + "version": "1.0.0", + "dependencies": [ + "@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@1.0.0", + "@denotest/peer-dep-test-peer@1.0.0" + ] + }, + "@denotest/peer-dep-test-child@2.0.0_@denotest+peer-dep-test-peer@2.0.0": { + "name": "@denotest/peer-dep-test-child", + "version": "2.0.0", + "dependencies": [ + "@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@2.0.0", + "@denotest/peer-dep-test-peer@2.0.0" + ] + }, + "@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@1.0.0": { + "name": "@denotest/peer-dep-test-grandchild", + "version": "1.0.0", + "dependencies": [ + "@denotest/peer-dep-test-peer@1.0.0" + ] + }, + "@denotest/peer-dep-test-grandchild@1.0.0_@denotest+peer-dep-test-peer@2.0.0": { + "name": "@denotest/peer-dep-test-grandchild", + "version": "1.0.0", + "dependencies": [ + "@denotest/peer-dep-test-peer@2.0.0" + ] + }, + "@denotest/peer-dep-test-peer@1.0.0": { + "name": "@denotest/peer-dep-test-peer", + "version": "1.0.0", + "dependencies": [] + }, + "@denotest/peer-dep-test-peer@2.0.0": { + "name": "@denotest/peer-dep-test-peer", + "version": "2.0.0", + "dependencies": [] + } + } +} diff --git a/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules.out b/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules.out new file mode 100644 index 0000000000..02b5cbafd6 --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules.out @@ -0,0 +1,9 @@ +[UNORDERED_START] +Initialize @denotest/peer-dep-test-child@1.0.0 +Initialize @denotest/peer-dep-test-child@2.0.0 +Initialize @denotest/peer-dep-test-grandchild@1.0.0 +Initialize @denotest/peer-dep-test-peer@1.0.0 +Initialize @denotest/peer-dep-test-peer@2.0.0 +[UNORDERED_END] +1 +2 diff --git a/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules_reload.out b/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules_reload.out new file mode 100644 index 0000000000..9c81452118 --- /dev/null +++ b/tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules_reload.out @@ -0,0 +1,19 @@ +[UNORDERED_START] +Download http://localhost:4260/@denotest/peer-dep-test-child +Download http://localhost:4260/@denotest/peer-dep-test-grandchild +Download http://localhost:4260/@denotest/peer-dep-test-peer +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/@denotest/peer-dep-test-child/1.0.0.tgz +Initialize @denotest/peer-dep-test-child@1.0.0 +Download http://localhost:4260/@denotest/peer-dep-test-child/2.0.0.tgz +Initialize @denotest/peer-dep-test-child@2.0.0 +Download http://localhost:4260/@denotest/peer-dep-test-grandchild/1.0.0.tgz +Initialize @denotest/peer-dep-test-grandchild@1.0.0 +Download http://localhost:4260/@denotest/peer-dep-test-peer/1.0.0.tgz +Initialize @denotest/peer-dep-test-peer@1.0.0 +Download http://localhost:4260/@denotest/peer-dep-test-peer/2.0.0.tgz +Initialize @denotest/peer-dep-test-peer@2.0.0 +[UNORDERED_END] +1 +2 diff --git a/tests/specs/npm_tests/mixed_case_package_name_global_dir/__test__.jsonc b/tests/specs/npm_tests/mixed_case_package_name_global_dir/__test__.jsonc new file mode 100644 index 0000000000..cc9359aab2 --- /dev/null +++ b/tests/specs/npm_tests/mixed_case_package_name_global_dir/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run mixed_case_package_name/global.ts", + "output": "mixed_case_package_name/global.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/mixed_case_package_name/global.out b/tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/global.out similarity index 100% rename from tests/testdata/npm/mixed_case_package_name/global.out rename to tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/global.out diff --git a/tests/testdata/npm/mixed_case_package_name/global.ts b/tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/global.ts similarity index 100% rename from tests/testdata/npm/mixed_case_package_name/global.ts rename to tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/global.ts diff --git a/tests/testdata/npm/mixed_case_package_name/local.out b/tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/local.out similarity index 100% rename from tests/testdata/npm/mixed_case_package_name/local.out rename to tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/local.out diff --git a/tests/testdata/npm/mixed_case_package_name/local.ts b/tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/local.ts similarity index 100% rename from tests/testdata/npm/mixed_case_package_name/local.ts rename to tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/local.ts diff --git a/tests/specs/npm_tests/mixed_case_package_name_local_dir/__test__.jsonc b/tests/specs/npm_tests/mixed_case_package_name_local_dir/__test__.jsonc new file mode 100644 index 0000000000..0778cb5624 --- /dev/null +++ b/tests/specs/npm_tests/mixed_case_package_name_local_dir/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --node-modules-dir=auto -A mixed_case_package_name/local.ts", + "output": "mixed_case_package_name/local.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/global.out b/tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/global.out new file mode 100644 index 0000000000..fdacea3852 --- /dev/null +++ b/tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/global.out @@ -0,0 +1,9 @@ +[UNORDERED_START] +Download http://localhost:4260/@denotest/MixedCase +Download http://localhost:4260/@denotest/CAPITALS +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/@denotest/CAPITALS/1.0.0.tgz +Download http://localhost:4260/@denotest/MixedCase/1.0.0.tgz +[UNORDERED_END] +5 diff --git a/tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/global.ts b/tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/global.ts new file mode 100644 index 0000000000..a721b3d784 --- /dev/null +++ b/tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/global.ts @@ -0,0 +1,2 @@ +import value from "npm:@denotest/MixedCase"; +console.log(value); diff --git a/tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/local.out b/tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/local.out new file mode 100644 index 0000000000..6ab989d80c --- /dev/null +++ b/tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/local.out @@ -0,0 +1,13 @@ +[UNORDERED_START] +Download http://localhost:4260/@denotest/MixedCase +Download http://localhost:4260/@denotest/CAPITALS +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/@denotest/CAPITALS/1.0.0.tgz +Initialize @denotest/CAPITALS@1.0.0 +Download http://localhost:4260/@denotest/MixedCase/1.0.0.tgz +Initialize @denotest/MixedCase@1.0.0 +[UNORDERED_END] +5 +true +true diff --git a/tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/local.ts b/tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/local.ts new file mode 100644 index 0000000000..6ca6cb581a --- /dev/null +++ b/tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/local.ts @@ -0,0 +1,18 @@ +import value from "npm:@denotest/MixedCase"; +console.log(value); +console.log(pathExists("./node_modules/.deno")); +console.log( + pathExists("./node_modules/.deno/_ibsgk3tporsxg5bpinavaskuifgfg@1.0.0"), +); + +function pathExists(filePath: string) { + try { + Deno.lstatSync(filePath); + return true; + } catch (error) { + if (error instanceof Deno.errors.NotFound) { + return false; + } + throw error; + } +} diff --git a/tests/specs/npm_tests/node_modules_deno_node_modules/__test__.jsonc b/tests/specs/npm_tests/node_modules_deno_node_modules/__test__.jsonc new file mode 100644 index 0000000000..377fd05eab --- /dev/null +++ b/tests/specs/npm_tests/node_modules_deno_node_modules/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --quiet node_modules_deno_node_modules/main.ts", + "output": "node_modules_deno_node_modules/main.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/node_modules_deno_node_modules/main.out b/tests/specs/npm_tests/node_modules_deno_node_modules/node_modules_deno_node_modules/main.out similarity index 100% rename from tests/testdata/npm/node_modules_deno_node_modules/main.out rename to tests/specs/npm_tests/node_modules_deno_node_modules/node_modules_deno_node_modules/main.out diff --git a/tests/testdata/npm/node_modules_deno_node_modules/main.ts b/tests/specs/npm_tests/node_modules_deno_node_modules/node_modules_deno_node_modules/main.ts similarity index 100% rename from tests/testdata/npm/node_modules_deno_node_modules/main.ts rename to tests/specs/npm_tests/node_modules_deno_node_modules/node_modules_deno_node_modules/main.ts diff --git a/tests/specs/npm_tests/node_modules_deno_node_modules_local/__test__.jsonc b/tests/specs/npm_tests/node_modules_deno_node_modules_local/__test__.jsonc new file mode 100644 index 0000000000..a1e67b32ba --- /dev/null +++ b/tests/specs/npm_tests/node_modules_deno_node_modules_local/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --quiet --node-modules-dir node_modules_deno_node_modules/main.ts", + "output": "node_modules_deno_node_modules/main.out", + "exitCode": 0, + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/node_modules_deno_node_modules_local/node_modules_deno_node_modules/main.out b/tests/specs/npm_tests/node_modules_deno_node_modules_local/node_modules_deno_node_modules/main.out new file mode 100644 index 0000000000..1ebdb2dd57 --- /dev/null +++ b/tests/specs/npm_tests/node_modules_deno_node_modules_local/node_modules_deno_node_modules/main.out @@ -0,0 +1,2 @@ +esm +esm diff --git a/tests/specs/npm_tests/node_modules_deno_node_modules_local/node_modules_deno_node_modules/main.ts b/tests/specs/npm_tests/node_modules_deno_node_modules_local/node_modules_deno_node_modules/main.ts new file mode 100644 index 0000000000..6e4a32d8e8 --- /dev/null +++ b/tests/specs/npm_tests/node_modules_deno_node_modules_local/node_modules_deno_node_modules/main.ts @@ -0,0 +1,7 @@ +import { getKind as getKind1 } from "npm:@denotest/dual-cjs-esm-dep"; +// this should still be able to be resolved even though it's missing the +// "@denotest/dual-cjs-esm" package because the above import will resolve it +import { getKind as getKind2 } from "npm:@denotest/dual-cjs-esm-dep-missing"; + +console.log(getKind1()); +console.log(getKind2()); diff --git a/tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/__test__.jsonc b/tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/__test__.jsonc new file mode 100644 index 0000000000..5813bb3f21 --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --node-modules-dir=auto -A --quiet require_added_nm_folder/main.js", + "output": "require_added_nm_folder/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 0 +} diff --git a/tests/testdata/npm/require_added_nm_folder/main.js b/tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/require_added_nm_folder/main.js similarity index 100% rename from tests/testdata/npm/require_added_nm_folder/main.js rename to tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/require_added_nm_folder/main.js diff --git a/tests/testdata/npm/require_added_nm_folder/main.out b/tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/require_added_nm_folder/main.out similarity index 100% rename from tests/testdata/npm/require_added_nm_folder/main.out rename to tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/require_added_nm_folder/main.out diff --git a/tests/specs/npm_tests/node_modules_dir_require_main_entry/__test__.jsonc b/tests/specs/npm_tests/node_modules_dir_require_main_entry/__test__.jsonc new file mode 100644 index 0000000000..45936f1de2 --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_require_main_entry/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --node-modules-dir -A --quiet require_main/main.js", + "output": "require_main/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 0 +} diff --git a/tests/testdata/npm/require_main/main.js b/tests/specs/npm_tests/node_modules_dir_require_main_entry/require_main/main.js similarity index 100% rename from tests/testdata/npm/require_main/main.js rename to tests/specs/npm_tests/node_modules_dir_require_main_entry/require_main/main.js diff --git a/tests/testdata/npm/require_main/main.out b/tests/specs/npm_tests/node_modules_dir_require_main_entry/require_main/main.out similarity index 100% rename from tests/testdata/npm/require_main/main.out rename to tests/specs/npm_tests/node_modules_dir_require_main_entry/require_main/main.out diff --git a/tests/specs/npm_tests/node_modules_dir_with_deps/__test__.jsonc b/tests/specs/npm_tests/node_modules_dir_with_deps/__test__.jsonc new file mode 100644 index 0000000000..ae79e8a472 --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_with_deps/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read --allow-env --node-modules-dir=auto cjs_with_deps/main.js", + "output": "cjs_with_deps/main_node_modules.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main.js b/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main.js new file mode 100644 index 0000000000..568726874e --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main.js @@ -0,0 +1,12 @@ +import chalk from "npm:chalk@4"; +import { expect } from "npm:chai@4.3"; + +console.log(chalk.green("chalk cjs loads")); + +const timeout = setTimeout(() => {}, 0); +expect(timeout).to.be.a("number"); +clearTimeout(timeout); + +const interval = setInterval(() => {}, 100); +expect(interval).to.be.a("number"); +clearInterval(interval); diff --git a/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main.out b/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main.out new file mode 100644 index 0000000000..7051c23953 --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main.out @@ -0,0 +1,33 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/chai +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/supports-color +Download http://localhost:4260/assertion-error +Download http://localhost:4260/check-error +Download http://localhost:4260/deep-eql +Download http://localhost:4260/get-func-name +Download http://localhost:4260/loupe +Download http://localhost:4260/pathval +Download http://localhost:4260/type-detect +Download http://localhost:4260/color-convert +Download http://localhost:4260/has-flag +Download http://localhost:4260/color-name +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz +Download http://localhost:4260/chai/chai-4.3.6.tgz +Download http://localhost:4260/chalk/chalk-4.1.2.tgz +Download http://localhost:4260/check-error/check-error-1.0.2.tgz +Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz +Download http://localhost:4260/color-name/color-name-1.1.4.tgz +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz +Download http://localhost:4260/loupe/loupe-2.3.4.tgz +Download http://localhost:4260/pathval/pathval-1.1.1.tgz +Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +[UNORDERED_END] +chalk cjs loads diff --git a/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main_info.out b/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main_info.out new file mode 100644 index 0000000000..bcaaf1eecf --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main_info.out @@ -0,0 +1,22 @@ +local: [WILDCARD]main.js +type: JavaScript +dependencies: 14 unique +size: [WILDCARD] + +file:///[WILDCARD]/npm/cjs_with_deps/main.js ([WILDCARD]) +├─┬ npm:/chalk@4.1.2 ([WILDCARD]) +│ ├─┬ npm:/ansi-styles@4.3.0 ([WILDCARD]) +│ │ └─┬ npm:/color-convert@2.0.1 ([WILDCARD]) +│ │ └── npm:/color-name@1.1.4 ([WILDCARD]) +│ └─┬ npm:/supports-color@7.2.0 ([WILDCARD]) +│ └── npm:/has-flag@4.0.0 ([WILDCARD]) +└─┬ npm:/chai@4.3.6 ([WILDCARD]) + ├── npm:/assertion-error@1.1.0 ([WILDCARD]) + ├── npm:/check-error@1.0.2 ([WILDCARD]) + ├─┬ npm:/deep-eql@3.0.1 ([WILDCARD]) + │ └── npm:/type-detect@4.0.8 ([WILDCARD]) + ├── npm:/get-func-name@2.0.0 ([WILDCARD]) + ├─┬ npm:/loupe@2.3.4 ([WILDCARD]) + │ └── npm:/get-func-name@2.0.0 ([WILDCARD]) + ├── npm:/pathval@1.1.1 ([WILDCARD]) + └── npm:/type-detect@4.0.8 ([WILDCARD]) diff --git a/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main_info_json.out b/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main_info_json.out new file mode 100644 index 0000000000..af1ef13518 --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main_info_json.out @@ -0,0 +1,148 @@ +{ + "roots": [ + "file://[WILDCARD]/main.js" + ], + "modules": [ + { + "kind": "esm", + "dependencies": [ + { + "specifier": "npm:chalk@4", + "code": { + "specifier": "npm:chalk@4", + "span": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 31 + } + } + }, + "npmPackage": "chalk@4.1.2" + }, + { + "specifier": "npm:chai@4.3", + "code": { + "specifier": "npm:chai@4.3", + "span": { + "start": { + "line": 1, + "character": 23 + }, + "end": { + "line": 1, + "character": 37 + } + } + }, + "npmPackage": "chai@4.3.6" + } + ], + "local": "[WILDCARD]main.js", + "size": 325, + "mediaType": "JavaScript", + "specifier": "[WILDCARD]/main.js" + } + ], + "redirects": { + "npm:chai@4.3": "npm:/chai@4.3.6", + "npm:chalk@4": "npm:/chalk@4.1.2" + }, + "version": 1, + "npmPackages": { + "ansi-styles@4.3.0": { + "name": "ansi-styles", + "version": "4.3.0", + "dependencies": [ + "color-convert@2.0.1" + ] + }, + "assertion-error@1.1.0": { + "name": "assertion-error", + "version": "1.1.0", + "dependencies": [] + }, + "chai@4.3.6": { + "name": "chai", + "version": "4.3.6", + "dependencies": [ + "assertion-error@1.1.0", + "check-error@1.0.2", + "deep-eql@3.0.1", + "get-func-name@2.0.0", + "loupe@2.3.4", + "pathval@1.1.1", + "type-detect@4.0.8" + ] + }, + "chalk@4.1.2": { + "name": "chalk", + "version": "4.1.2", + "dependencies": [ + "ansi-styles@4.3.0", + "supports-color@7.2.0" + ] + }, + "check-error@1.0.2": { + "name": "check-error", + "version": "1.0.2", + "dependencies": [] + }, + "color-convert@2.0.1": { + "name": "color-convert", + "version": "2.0.1", + "dependencies": [ + "color-name@1.1.4" + ] + }, + "color-name@1.1.4": { + "name": "color-name", + "version": "1.1.4", + "dependencies": [] + }, + "deep-eql@3.0.1": { + "name": "deep-eql", + "version": "3.0.1", + "dependencies": [ + "type-detect@4.0.8" + ] + }, + "get-func-name@2.0.0": { + "name": "get-func-name", + "version": "2.0.0", + "dependencies": [] + }, + "has-flag@4.0.0": { + "name": "has-flag", + "version": "4.0.0", + "dependencies": [] + }, + "loupe@2.3.4": { + "name": "loupe", + "version": "2.3.4", + "dependencies": [ + "get-func-name@2.0.0" + ] + }, + "pathval@1.1.1": { + "name": "pathval", + "version": "1.1.1", + "dependencies": [] + }, + "supports-color@7.2.0": { + "name": "supports-color", + "version": "7.2.0", + "dependencies": [ + "has-flag@4.0.0" + ] + }, + "type-detect@4.0.8": { + "name": "type-detect", + "version": "4.0.8", + "dependencies": [] + } + } +} diff --git a/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main_node_modules.out b/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main_node_modules.out new file mode 100644 index 0000000000..1ab3679521 --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main_node_modules.out @@ -0,0 +1,47 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/chai +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/supports-color +Download http://localhost:4260/assertion-error +Download http://localhost:4260/check-error +Download http://localhost:4260/deep-eql +Download http://localhost:4260/get-func-name +Download http://localhost:4260/loupe +Download http://localhost:4260/pathval +Download http://localhost:4260/type-detect +Download http://localhost:4260/color-convert +Download http://localhost:4260/has-flag +Download http://localhost:4260/color-name +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Initialize ansi-styles@4.3.0 +Download http://localhost:4260/assertion-error/assertion-error-1.1.0.tgz +Initialize assertion-error@1.1.0 +Download http://localhost:4260/chai/chai-4.3.6.tgz +Initialize chai@4.3.6 +Download http://localhost:4260/chalk/chalk-4.1.2.tgz +Initialize chalk@4.1.2 +Download http://localhost:4260/check-error/check-error-1.0.2.tgz +Initialize check-error@1.0.2 +Download http://localhost:4260/color-convert/color-convert-2.0.1.tgz +Initialize color-convert@2.0.1 +Download http://localhost:4260/color-name/color-name-1.1.4.tgz +Initialize color-name@1.1.4 +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Initialize deep-eql@3.0.1 +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Initialize get-func-name@2.0.0 +Download http://localhost:4260/has-flag/has-flag-4.0.0.tgz +Initialize has-flag@4.0.0 +Download http://localhost:4260/loupe/loupe-2.3.4.tgz +Initialize loupe@2.3.4 +Download http://localhost:4260/pathval/pathval-1.1.1.tgz +Initialize pathval@1.1.1 +Download http://localhost:4260/supports-color/supports-color-7.2.0.tgz +Initialize supports-color@7.2.0 +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +Initialize type-detect@4.0.8 +[UNORDERED_END] +chalk cjs loads diff --git a/tests/specs/npm_tests/node_modules_dir_yargs/__test__.jsonc b/tests/specs/npm_tests/node_modules_dir_yargs/__test__.jsonc new file mode 100644 index 0000000000..8aa139a51d --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_yargs/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read --allow-env --node-modules-dir=auto cjs_yargs/main.js", + "output": "cjs_yargs/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/cjs_yargs/main.js b/tests/specs/npm_tests/node_modules_dir_yargs/cjs_yargs/main.js similarity index 100% rename from tests/testdata/npm/cjs_yargs/main.js rename to tests/specs/npm_tests/node_modules_dir_yargs/cjs_yargs/main.js diff --git a/tests/testdata/npm/cjs_yargs/main.out b/tests/specs/npm_tests/node_modules_dir_yargs/cjs_yargs/main.out similarity index 100% rename from tests/testdata/npm/cjs_yargs/main.out rename to tests/specs/npm_tests/node_modules_dir_yargs/cjs_yargs/main.out diff --git a/tests/specs/npm_tests/non_existent_dep/__test__.jsonc b/tests/specs/npm_tests/non_existent_dep/__test__.jsonc new file mode 100644 index 0000000000..a437084210 --- /dev/null +++ b/tests/specs/npm_tests/non_existent_dep/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "cache npm:@denotest/non-existent-dep", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1, + "output": "[UNORDERED_START]\nDownload http://localhost:4260/@denotest/non-existent-dep\nDownload http://localhost:4260/@denotest/non-existent\n[UNORDERED_END]\nerror: npm package '@denotest/non-existent' does not exist.\n" +} diff --git a/tests/specs/npm_tests/non_existent_dep_version/__test__.jsonc b/tests/specs/npm_tests/non_existent_dep_version/__test__.jsonc new file mode 100644 index 0000000000..19cd713e2e --- /dev/null +++ b/tests/specs/npm_tests/non_existent_dep_version/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "cache npm:@denotest/non-existent-dep-version", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1, + "output": "[UNORDERED_START]\nDownload http://localhost:4260/@denotest/non-existent-dep-version\nDownload http://localhost:4260/@denotest/esm-basic\n[UNORDERED_END]\nerror: Could not find npm package '@denotest/esm-basic' matching '=99.99.99'.\n" +} diff --git a/tests/specs/npm_tests/nonexistent_file/__test__.jsonc b/tests/specs/npm_tests/nonexistent_file/__test__.jsonc new file mode 100644 index 0000000000..efbda98d28 --- /dev/null +++ b/tests/specs/npm_tests/nonexistent_file/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run -A --quiet nonexistent_file/main.js", + "output": "nonexistent_file/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/nonexistent_file/main.js b/tests/specs/npm_tests/nonexistent_file/nonexistent_file/main.js similarity index 100% rename from tests/testdata/npm/nonexistent_file/main.js rename to tests/specs/npm_tests/nonexistent_file/nonexistent_file/main.js diff --git a/tests/testdata/npm/nonexistent_file/main.out b/tests/specs/npm_tests/nonexistent_file/nonexistent_file/main.out similarity index 100% rename from tests/testdata/npm/nonexistent_file/main.out rename to tests/specs/npm_tests/nonexistent_file/nonexistent_file/main.out diff --git a/tests/specs/npm_tests/nonexistent_file_node_modules_dir/__test__.jsonc b/tests/specs/npm_tests/nonexistent_file_node_modules_dir/__test__.jsonc new file mode 100644 index 0000000000..28da47300b --- /dev/null +++ b/tests/specs/npm_tests/nonexistent_file_node_modules_dir/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run -A --quiet --node-modules-dir nonexistent_file/main.js", + "output": "nonexistent_file/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/specs/npm_tests/nonexistent_file_node_modules_dir/nonexistent_file/main.js b/tests/specs/npm_tests/nonexistent_file_node_modules_dir/nonexistent_file/main.js new file mode 100644 index 0000000000..c480b0548f --- /dev/null +++ b/tests/specs/npm_tests/nonexistent_file_node_modules_dir/nonexistent_file/main.js @@ -0,0 +1,2 @@ +import hmacSHA512 from "npm:crypto-js/non-existent"; +console.log(hmacSHA512); diff --git a/tests/specs/npm_tests/nonexistent_file_node_modules_dir/nonexistent_file/main.out b/tests/specs/npm_tests/nonexistent_file_node_modules_dir/nonexistent_file/main.out new file mode 100644 index 0000000000..baa79b1cef --- /dev/null +++ b/tests/specs/npm_tests/nonexistent_file_node_modules_dir/nonexistent_file/main.out @@ -0,0 +1,4 @@ +error: Unable to load [WILDCARD]non-existent imported from [WILDCARD]main.js + +Caused by: +[WILDCARD] diff --git a/tests/specs/npm_tests/permissions_outside_package/__test__.jsonc b/tests/specs/npm_tests/permissions_outside_package/__test__.jsonc new file mode 100644 index 0000000000..58f917f735 --- /dev/null +++ b/tests/specs/npm_tests/permissions_outside_package/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read permissions_outside_package/main.ts", + "output": "permissions_outside_package/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/permissions_outside_package/foo/config.js b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/foo/config.js similarity index 100% rename from tests/testdata/npm/permissions_outside_package/foo/config.js rename to tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/foo/config.js diff --git a/tests/testdata/npm/permissions_outside_package/foo/package.json b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/foo/package.json similarity index 100% rename from tests/testdata/npm/permissions_outside_package/foo/package.json rename to tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/foo/package.json diff --git a/tests/testdata/npm/permissions_outside_package/main.out b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.out similarity index 100% rename from tests/testdata/npm/permissions_outside_package/main.out rename to tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.out diff --git a/tests/testdata/npm/permissions_outside_package/main.ts b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.ts similarity index 63% rename from tests/testdata/npm/permissions_outside_package/main.ts rename to tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.ts index b0b82b6260..934a3eebcf 100644 --- a/tests/testdata/npm/permissions_outside_package/main.ts +++ b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.ts @@ -1,5 +1,5 @@ import { loadConfigFile } from "npm:@denotest/permissions-outside-package"; -const fileName = `${Deno.cwd()}/npm/permissions_outside_package/foo/config.js`; +const fileName = `${Deno.cwd()}/permissions_outside_package/foo/config.js`; const config = loadConfigFile(fileName); console.log(config); diff --git a/tests/specs/npm_tests/remote_npm_specifier/__test__.jsonc b/tests/specs/npm_tests/remote_npm_specifier/__test__.jsonc new file mode 100644 index 0000000000..416024f0cd --- /dev/null +++ b/tests/specs/npm_tests/remote_npm_specifier/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run --quiet -A remote_npm_specifier/main.ts", + "output": "remote_npm_specifier/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 0 +} diff --git a/tests/testdata/npm/remote_npm_specifier/main.out b/tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/main.out similarity index 100% rename from tests/testdata/npm/remote_npm_specifier/main.out rename to tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/main.out diff --git a/tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/main.ts b/tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/main.ts new file mode 100644 index 0000000000..ea9442059e --- /dev/null +++ b/tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/main.ts @@ -0,0 +1 @@ +import "./remote.ts"; diff --git a/tests/testdata/npm/remote_npm_specifier/remote.ts b/tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/remote.ts similarity index 100% rename from tests/testdata/npm/remote_npm_specifier/remote.ts rename to tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/remote.ts diff --git a/tests/specs/npm_tests/require_esm/__test__.jsonc b/tests/specs/npm_tests/require_esm/__test__.jsonc new file mode 100644 index 0000000000..83859c8f10 --- /dev/null +++ b/tests/specs/npm_tests/require_esm/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --allow-read --quiet require_esm/main.ts", + "output": "require_esm/main.out" +} diff --git a/tests/specs/npm_tests/require_esm/require_esm/esm.js b/tests/specs/npm_tests/require_esm/require_esm/esm.js new file mode 100644 index 0000000000..0613f1911a --- /dev/null +++ b/tests/specs/npm_tests/require_esm/require_esm/esm.js @@ -0,0 +1 @@ +export class Test {} diff --git a/tests/specs/npm_tests/require_esm/require_esm/main.out b/tests/specs/npm_tests/require_esm/require_esm/main.out new file mode 100644 index 0000000000..aab0d5c285 --- /dev/null +++ b/tests/specs/npm_tests/require_esm/require_esm/main.out @@ -0,0 +1 @@ +[Module: null prototype] { Test: [class Test] } diff --git a/tests/specs/npm_tests/require_esm/require_esm/main.ts b/tests/specs/npm_tests/require_esm/require_esm/main.ts new file mode 100644 index 0000000000..67ac808f06 --- /dev/null +++ b/tests/specs/npm_tests/require_esm/require_esm/main.ts @@ -0,0 +1,5 @@ +import { createRequire } from "node:module"; + +const require = createRequire(import.meta.url); + +console.log(require("./esm.js")); diff --git a/tests/specs/npm_tests/require_json/__test__.jsonc b/tests/specs/npm_tests/require_json/__test__.jsonc new file mode 100644 index 0000000000..43af6230f6 --- /dev/null +++ b/tests/specs/npm_tests/require_json/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet require_json/main.js", + "output": "require_json/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/require_json/main.js b/tests/specs/npm_tests/require_json/require_json/main.js similarity index 100% rename from tests/testdata/npm/require_json/main.js rename to tests/specs/npm_tests/require_json/require_json/main.js diff --git a/tests/testdata/npm/require_json/main.out b/tests/specs/npm_tests/require_json/require_json/main.out similarity index 100% rename from tests/testdata/npm/require_json/main.out rename to tests/specs/npm_tests/require_json/require_json/main.out diff --git a/tests/specs/npm_tests/reserved_word_exports/__test__.jsonc b/tests/specs/npm_tests/reserved_word_exports/__test__.jsonc new file mode 100644 index 0000000000..d2f6ae7c29 --- /dev/null +++ b/tests/specs/npm_tests/reserved_word_exports/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run reserved_word_exports/main.ts", + "output": "reserved_word_exports/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/reserved_word_exports/main.out b/tests/specs/npm_tests/reserved_word_exports/reserved_word_exports/main.out similarity index 100% rename from tests/testdata/npm/reserved_word_exports/main.out rename to tests/specs/npm_tests/reserved_word_exports/reserved_word_exports/main.out diff --git a/tests/testdata/npm/reserved_word_exports/main.ts b/tests/specs/npm_tests/reserved_word_exports/reserved_word_exports/main.ts similarity index 100% rename from tests/testdata/npm/reserved_word_exports/main.ts rename to tests/specs/npm_tests/reserved_word_exports/reserved_word_exports/main.ts diff --git a/tests/specs/npm_tests/run_existing_npm_package_with_subpath/__test__.jsonc b/tests/specs/npm_tests/run_existing_npm_package_with_subpath/__test__.jsonc new file mode 100644 index 0000000000..bc76b00be5 --- /dev/null +++ b/tests/specs/npm_tests/run_existing_npm_package_with_subpath/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run --allow-read --node-modules-dir=auto npm:@denotest/bin/cli-esm dev --help", + "output": "run_existing_npm_package_with_subpath/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/run_existing_npm_package_with_subpath/main.out b/tests/specs/npm_tests/run_existing_npm_package_with_subpath/run_existing_npm_package_with_subpath/main.out similarity index 100% rename from tests/testdata/npm/run_existing_npm_package_with_subpath/main.out rename to tests/specs/npm_tests/run_existing_npm_package_with_subpath/run_existing_npm_package_with_subpath/main.out diff --git a/tests/testdata/npm/run_existing_npm_package_with_subpath/package.json b/tests/specs/npm_tests/run_existing_npm_package_with_subpath/run_existing_npm_package_with_subpath/package.json similarity index 100% rename from tests/testdata/npm/run_existing_npm_package_with_subpath/package.json rename to tests/specs/npm_tests/run_existing_npm_package_with_subpath/run_existing_npm_package_with_subpath/package.json diff --git a/tests/specs/npm_tests/sub_paths/__test__.jsonc b/tests/specs/npm_tests/sub_paths/__test__.jsonc new file mode 100644 index 0000000000..88ccbc3ac4 --- /dev/null +++ b/tests/specs/npm_tests/sub_paths/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet sub_paths/main.jsx", + "output": "sub_paths/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/sub_paths/main.jsx b/tests/specs/npm_tests/sub_paths/sub_paths/main.jsx similarity index 100% rename from tests/testdata/npm/sub_paths/main.jsx rename to tests/specs/npm_tests/sub_paths/sub_paths/main.jsx diff --git a/tests/testdata/npm/sub_paths/main.out b/tests/specs/npm_tests/sub_paths/sub_paths/main.out similarity index 100% rename from tests/testdata/npm/sub_paths/main.out rename to tests/specs/npm_tests/sub_paths/sub_paths/main.out diff --git a/tests/specs/npm_tests/tarball_with_global_header/__test__.jsonc b/tests/specs/npm_tests/tarball_with_global_header/__test__.jsonc new file mode 100644 index 0000000000..7cf4a60830 --- /dev/null +++ b/tests/specs/npm_tests/tarball_with_global_header/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet tarball_with_global_header/main.js", + "output": "tarball_with_global_header/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/tarball_with_global_header/main.js b/tests/specs/npm_tests/tarball_with_global_header/tarball_with_global_header/main.js similarity index 100% rename from tests/testdata/npm/tarball_with_global_header/main.js rename to tests/specs/npm_tests/tarball_with_global_header/tarball_with_global_header/main.js diff --git a/tests/testdata/npm/tarball_with_global_header/main.out b/tests/specs/npm_tests/tarball_with_global_header/tarball_with_global_header/main.out similarity index 100% rename from tests/testdata/npm/tarball_with_global_header/main.out rename to tests/specs/npm_tests/tarball_with_global_header/tarball_with_global_header/main.out diff --git a/tests/specs/npm_tests/translate_cjs_to_esm/__test__.jsonc b/tests/specs/npm_tests/translate_cjs_to_esm/__test__.jsonc new file mode 100644 index 0000000000..e1344493cd --- /dev/null +++ b/tests/specs/npm_tests/translate_cjs_to_esm/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "run -A --quiet translate_cjs_to_esm/main.js", + "output": "translate_cjs_to_esm/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/translate_cjs_to_esm/main.js b/tests/specs/npm_tests/translate_cjs_to_esm/translate_cjs_to_esm/main.js similarity index 100% rename from tests/testdata/npm/translate_cjs_to_esm/main.js rename to tests/specs/npm_tests/translate_cjs_to_esm/translate_cjs_to_esm/main.js diff --git a/tests/testdata/npm/translate_cjs_to_esm/main.out b/tests/specs/npm_tests/translate_cjs_to_esm/translate_cjs_to_esm/main.out similarity index 100% rename from tests/testdata/npm/translate_cjs_to_esm/main.out rename to tests/specs/npm_tests/translate_cjs_to_esm/translate_cjs_to_esm/main.out diff --git a/tests/specs/npm_tests/types_ambient_module/__test__.jsonc b/tests/specs/npm_tests/types_ambient_module/__test__.jsonc new file mode 100644 index 0000000000..fc60b34332 --- /dev/null +++ b/tests/specs/npm_tests/types_ambient_module/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "check --quiet types_ambient_module/main.ts", + "output": "types_ambient_module/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/types_ambient_module/import_map.json b/tests/specs/npm_tests/types_ambient_module/types_ambient_module/import_map.json similarity index 100% rename from tests/testdata/npm/types_ambient_module/import_map.json rename to tests/specs/npm_tests/types_ambient_module/types_ambient_module/import_map.json diff --git a/tests/testdata/npm/types_ambient_module/main.out b/tests/specs/npm_tests/types_ambient_module/types_ambient_module/main.out similarity index 100% rename from tests/testdata/npm/types_ambient_module/main.out rename to tests/specs/npm_tests/types_ambient_module/types_ambient_module/main.out diff --git a/tests/testdata/npm/types_ambient_module/main.ts b/tests/specs/npm_tests/types_ambient_module/types_ambient_module/main.ts similarity index 100% rename from tests/testdata/npm/types_ambient_module/main.ts rename to tests/specs/npm_tests/types_ambient_module/types_ambient_module/main.ts diff --git a/tests/testdata/npm/types_ambient_module/main_import_map.out b/tests/specs/npm_tests/types_ambient_module/types_ambient_module/main_import_map.out similarity index 100% rename from tests/testdata/npm/types_ambient_module/main_import_map.out rename to tests/specs/npm_tests/types_ambient_module/types_ambient_module/main_import_map.out diff --git a/tests/testdata/npm/types_ambient_module/main_import_map.ts b/tests/specs/npm_tests/types_ambient_module/types_ambient_module/main_import_map.ts similarity index 100% rename from tests/testdata/npm/types_ambient_module/main_import_map.ts rename to tests/specs/npm_tests/types_ambient_module/types_ambient_module/main_import_map.ts diff --git a/tests/specs/npm_tests/types_ambient_module_import_map/__test__.jsonc b/tests/specs/npm_tests/types_ambient_module_import_map/__test__.jsonc new file mode 100644 index 0000000000..2e8c9b60b9 --- /dev/null +++ b/tests/specs/npm_tests/types_ambient_module_import_map/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "check --quiet --import-map=types_ambient_module/import_map.json types_ambient_module/main_import_map.ts", + "output": "types_ambient_module/main_import_map.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/import_map.json b/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/import_map.json new file mode 100644 index 0000000000..f61d99b474 --- /dev/null +++ b/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/import_map.json @@ -0,0 +1,5 @@ +{ + "imports": { + "types-ambient": "npm:@denotest/types-ambient" + } +} diff --git a/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main.out b/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main.out new file mode 100644 index 0000000000..c84130707e --- /dev/null +++ b/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main.out @@ -0,0 +1,21 @@ +error: TS2551 [ERROR]: Property 'Test2' does not exist on type 'typeof import("@denotest/types-ambient")'. Did you mean 'Test'? +console.log(import1.Test2); // should error + ~~~~~ + at file:///[WILDCARD]/types_ambient_module/main.ts:5:21 + + 'Test' is declared here. + class Test { + ~~~~ + at file:///[WILDCARD]/@denotest/types-ambient/1.0.0/index.d.ts:7:9 + +TS2551 [ERROR]: Property 'Test2' does not exist on type 'typeof import("@denotest/types-ambient")'. Did you mean 'Test'? +console.log(import2.Test2); // should error + ~~~~~ + at file:///[WILDCARD]/types_ambient_module/main.ts:7:21 + + 'Test' is declared here. + class Test { + ~~~~ + at file:///[WILDCARD]/@denotest/types-ambient/1.0.0/index.d.ts:7:9 + +Found 2 errors. diff --git a/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main.ts b/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main.ts new file mode 100644 index 0000000000..8f77cabe8e --- /dev/null +++ b/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main.ts @@ -0,0 +1,7 @@ +import * as import1 from "npm:@denotest/types-ambient"; +import * as import2 from "npm:@denotest/types-ambient@1"; + +console.log(import1.Test); +console.log(import1.Test2); // should error +console.log(import2.Test); +console.log(import2.Test2); // should error diff --git a/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main_import_map.out b/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main_import_map.out new file mode 100644 index 0000000000..548f9b479c --- /dev/null +++ b/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main_import_map.out @@ -0,0 +1,9 @@ +error: TS2551 [ERROR]: Property 'Test2' does not exist on type 'typeof import("@denotest/types-ambient")'. Did you mean 'Test'? +console.log(mod.Test2); // should error + ~~~~~ + at file:///[WILDCARD]/main_import_map.ts:4:17 + + 'Test' is declared here. + class Test { + ~~~~ + at file:///[WILDCARD]/@denotest/types-ambient/1.0.0/index.d.ts:7:9 diff --git a/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main_import_map.ts b/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main_import_map.ts new file mode 100644 index 0000000000..2694c94b7a --- /dev/null +++ b/tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main_import_map.ts @@ -0,0 +1,4 @@ +import * as mod from "npm:@denotest/types-ambient"; + +console.log(mod.Test); +console.log(mod.Test2); // should error diff --git a/tests/specs/npm_tests/types_d_ext/__test__.jsonc b/tests/specs/npm_tests/types_d_ext/__test__.jsonc new file mode 100644 index 0000000000..daa0f26ff0 --- /dev/null +++ b/tests/specs/npm_tests/types_d_ext/__test__.jsonc @@ -0,0 +1,8 @@ +{ + "args": "check --all d_ext/main.ts", + "output": "d_ext/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + } +} diff --git a/tests/testdata/npm/d_ext/main.out b/tests/specs/npm_tests/types_d_ext/d_ext/main.out similarity index 70% rename from tests/testdata/npm/d_ext/main.out rename to tests/specs/npm_tests/types_d_ext/d_ext/main.out index 5c22a76a0c..e99df66965 100644 --- a/tests/testdata/npm/d_ext/main.out +++ b/tests/specs/npm_tests/types_d_ext/d_ext/main.out @@ -1,3 +1,3 @@ Download http://localhost:4260/@denotest/d-ext Download http://localhost:4260/@denotest/d-ext/1.0.0.tgz -Check file:///[WILDCARD]/npm/d_ext/main.ts +Check file:///[WILDCARD]/d_ext/main.ts diff --git a/tests/testdata/npm/d_ext/main.ts b/tests/specs/npm_tests/types_d_ext/d_ext/main.ts similarity index 100% rename from tests/testdata/npm/d_ext/main.ts rename to tests/specs/npm_tests/types_d_ext/d_ext/main.ts diff --git a/tests/specs/npm_tests/types_entry_value_not_exists/__test__.jsonc b/tests/specs/npm_tests/types_entry_value_not_exists/__test__.jsonc new file mode 100644 index 0000000000..1c2e8735fb --- /dev/null +++ b/tests/specs/npm_tests/types_entry_value_not_exists/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "check --all types_entry_value_not_exists/main.ts", + "output": "types_entry_value_not_exists/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/types_entry_value_not_exists/main.out b/tests/specs/npm_tests/types_entry_value_not_exists/types_entry_value_not_exists/main.out similarity index 100% rename from tests/testdata/npm/types_entry_value_not_exists/main.out rename to tests/specs/npm_tests/types_entry_value_not_exists/types_entry_value_not_exists/main.out diff --git a/tests/testdata/npm/types_entry_value_not_exists/main.ts b/tests/specs/npm_tests/types_entry_value_not_exists/types_entry_value_not_exists/main.ts similarity index 100% rename from tests/testdata/npm/types_entry_value_not_exists/main.ts rename to tests/specs/npm_tests/types_entry_value_not_exists/types_entry_value_not_exists/main.ts diff --git a/tests/specs/npm_tests/types_exports_import_types/__test__.jsonc b/tests/specs/npm_tests/types_exports_import_types/__test__.jsonc new file mode 100644 index 0000000000..fbb6a918a2 --- /dev/null +++ b/tests/specs/npm_tests/types_exports_import_types/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "check --all types_exports_import_types/main.ts", + "output": "types_exports_import_types/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/types_exports_import_types/main.out b/tests/specs/npm_tests/types_exports_import_types/types_exports_import_types/main.out similarity index 100% rename from tests/testdata/npm/types_exports_import_types/main.out rename to tests/specs/npm_tests/types_exports_import_types/types_exports_import_types/main.out diff --git a/tests/testdata/npm/types_exports_import_types/main.ts b/tests/specs/npm_tests/types_exports_import_types/types_exports_import_types/main.ts similarity index 100% rename from tests/testdata/npm/types_exports_import_types/main.ts rename to tests/specs/npm_tests/types_exports_import_types/types_exports_import_types/main.ts diff --git a/tests/specs/npm_tests/types_no_types_entry/__test__.jsonc b/tests/specs/npm_tests/types_no_types_entry/__test__.jsonc new file mode 100644 index 0000000000..bae02f3a84 --- /dev/null +++ b/tests/specs/npm_tests/types_no_types_entry/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "check --all types_no_types_entry/main.ts", + "output": "types_no_types_entry/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/types_no_types_entry/main.out b/tests/specs/npm_tests/types_no_types_entry/types_no_types_entry/main.out similarity index 100% rename from tests/testdata/npm/types_no_types_entry/main.out rename to tests/specs/npm_tests/types_no_types_entry/types_no_types_entry/main.out diff --git a/tests/testdata/npm/types_no_types_entry/main.ts b/tests/specs/npm_tests/types_no_types_entry/types_no_types_entry/main.ts similarity index 100% rename from tests/testdata/npm/types_no_types_entry/main.ts rename to tests/specs/npm_tests/types_no_types_entry/types_no_types_entry/main.ts diff --git a/tests/specs/npm_tests/typescript_file_in_package/__test__.jsonc b/tests/specs/npm_tests/typescript_file_in_package/__test__.jsonc new file mode 100644 index 0000000000..c5bd61ca27 --- /dev/null +++ b/tests/specs/npm_tests/typescript_file_in_package/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "run typescript_file_in_package/main.ts", + "output": "typescript_file_in_package/main.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/npm/typescript_file_in_package/main.out b/tests/specs/npm_tests/typescript_file_in_package/typescript_file_in_package/main.out similarity index 100% rename from tests/testdata/npm/typescript_file_in_package/main.out rename to tests/specs/npm_tests/typescript_file_in_package/typescript_file_in_package/main.out diff --git a/tests/testdata/npm/typescript_file_in_package/main.ts b/tests/specs/npm_tests/typescript_file_in_package/typescript_file_in_package/main.ts similarity index 100% rename from tests/testdata/npm/typescript_file_in_package/main.ts rename to tests/specs/npm_tests/typescript_file_in_package/typescript_file_in_package/main.ts diff --git a/tests/testdata/npm/remote_npm_specifier/main.ts b/tests/testdata/npm/remote_npm_specifier/main.ts deleted file mode 100644 index 20a99b6883..0000000000 --- a/tests/testdata/npm/remote_npm_specifier/main.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/npm/remote_npm_specifier/remote.ts"; diff --git a/tools/lint.js b/tools/lint.js index 6cb27f8dc9..04e72c4c90 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -214,7 +214,7 @@ async function ensureNoNewITests() { "lsp_tests.rs": 0, "node_compat_tests.rs": 0, "node_unit_tests.rs": 2, - "npm_tests.rs": 89, + "npm_tests.rs": 5, "pm_tests.rs": 0, "publish_tests.rs": 0, "repl_tests.rs": 0,