From c232ecc6af5a09a8f0480e3b2b87ef2cd2b3a348 Mon Sep 17 00:00:00 2001 From: Mohammad Sulaiman Date: Wed, 25 Sep 2024 21:46:18 +0300 Subject: chore: deprecate npm itests (#25804) --- tests/integration/npm_tests.rs | 713 +-------------------- .../npm_tests/builtin_module_module/__test__.jsonc | 8 + .../builtin_module_module/main.js | 1 + .../builtin_module_module/main.out | 4 + tests/specs/npm_tests/cached_only/__test__.jsonc | 9 + .../npm_tests/cached_only/cached_only/main.out | 2 + .../npm_tests/cached_only/cached_only/main.ts | 3 + tests/specs/npm_tests/check_all/__test__.jsonc | 9 + .../specs/npm_tests/check_all/check_errors/main.ts | 3 + .../npm_tests/check_all/check_errors/main_all.out | 19 + .../check_all/check_errors/main_local.out | 7 + tests/specs/npm_tests/check_local/__test__.jsonc | 9 + .../npm_tests/check_local/check_errors/main.ts | 3 + .../check_local/check_errors/main_all.out | 19 + .../check_local/check_errors/main_local.out | 7 + .../__test__.jsonc | 9 + .../file_dts_dmts_dcts/main.out | 24 + .../file_dts_dmts_dcts/main.ts | 9 + .../child_process_fork_test/__test__.jsonc | 8 + .../child_process_fork_test/main.out | 2 + .../child_process_fork_test/main.ts | 4 + .../cjs_invalid_name_exports/__test__.jsonc | 8 + .../cjs-invalid-name-exports/main.out | 13 + .../cjs-invalid-name-exports/main.ts | 3 + .../cjs_local_global_decls/__test__.jsonc | 8 + .../cjs_local_global_decls/main.out | 3 + .../cjs_local_global_decls/main.ts | 1 + .../cjs_module_export_assignment/__test__.jsonc | 8 + .../cjs_module_export_assignment/main.out | 6 + .../cjs_module_export_assignment/main.ts | 6 + .../__test__.jsonc | 8 + .../cjs_module_export_assignment_number/main.out | 3 + .../cjs_module_export_assignment_number/main.ts | 7 + .../specs/npm_tests/cjs_pkg_imports/__test__.jsonc | 8 + .../cjs_pkg_imports/cjs_pkg_imports/main.out | 3 + .../cjs_pkg_imports/cjs_pkg_imports/main.ts | 3 + .../cjs_reexport_collision/__test__.jsonc | 8 + .../cjs_reexport_collision/main.out | 1 + .../cjs_reexport_collision/main.ts | 2 + .../specs/npm_tests/cjs_require_esm/__test__.jsonc | 8 + .../cjs_require_esm/cjs_require_esm/main.out | 4 + .../cjs_require_esm/cjs_require_esm/main.ts | 2 + .../npm_tests/cjs_require_esm_mjs/__test__.jsonc | 8 + .../cjs_require_esm_mjs/main.out | 4 + .../cjs_require_esm_mjs/main.ts | 2 + tests/specs/npm_tests/cjs_sub_path/__test__.jsonc | 8 + .../npm_tests/cjs_sub_path/cjs_sub_path/main.js | 21 + .../npm_tests/cjs_sub_path/cjs_sub_path/main.out | 35 + .../npm_tests/cjs_this_in_exports/__test__.jsonc | 9 + .../cjs_this_in_exports/main.js | 11 + .../cjs_this_in_exports/main.out | 5 + tests/specs/npm_tests/cjs_with_deps/__test__.jsonc | 8 + .../npm_tests/cjs_with_deps/cjs_with_deps/main.js | 12 + .../npm_tests/cjs_with_deps/cjs_with_deps/main.out | 33 + .../cjs_with_deps/cjs_with_deps/main_info.out | 22 + .../cjs_with_deps/cjs_with_deps/main_info_json.out | 148 +++++ .../cjs_with_deps/main_node_modules.out | 47 ++ .../specs/npm_tests/compare_globals/__test__.jsonc | 8 + .../compare_globals/compare_globals/main.out | 30 + .../compare_globals/compare_globals/main.ts | 54 ++ .../specs/npm_tests/create_require/__test__.jsonc | 9 + .../create_require/create_require/main.out | 12 + .../create_require/create_require/main.ts | 1 + tests/specs/npm_tests/deno_cache/__test__.jsonc | 8 + tests/specs/npm_tests/deno_cache/deno_cache.out | 8 + .../npm_tests/deno_run_bin_cjs/__test__.jsonc | 8 + .../npm_tests/deno_run_bin_cjs/deno_run_cjs.out | 4 + .../__test__.jsonc | 8 + .../deno_run_cjs.out | 4 + .../npm_tests/deno_run_bin_esm/__test__.jsonc | 8 + .../npm_tests/deno_run_bin_esm/deno_run_esm.out | 4 + .../__test__.jsonc | 8 + .../deno_run_esm.out | 4 + .../npm_tests/deno_run_bin_no_ext/__test__.jsonc | 8 + .../deno_run_bin_no_ext/deno_run_no_ext.out | 4 + .../deno_run_bin_special_chars/__test__.jsonc | 8 + .../deno_run_special_chars_in_bin_name.out | 4 + .../specs/npm_tests/deno_run_cowsay/__test__.jsonc | 8 + .../npm_tests/deno_run_cowsay/deno_run_cowsay.out | 8 + .../deno_run_cowsay_explicit/__test__.jsonc | 8 + .../deno_run_cowsay_explicit/deno_run_cowsay.out | 8 + .../__test__.jsonc | 8 + .../deno_run_cowsay.out | 8 + .../npm_tests/deno_run_cowthink/__test__.jsonc | 8 + .../deno_run_cowthink/deno_run_cowthink.out | 8 + .../deno_run_no_bin_entrypoint/__test__.jsonc | 9 + .../deno_run_no_bin_entrypoint.out | 1 + .../__test__.jsonc | 9 + ..._run_no_bin_entrypoint_non_existent_subpath.out | 3 + .../npm_tests/deno_run_non_existent/__test__.jsonc | 9 + .../deno_run_non_existent.out | 2 + .../__test__.jsonc | 9 + .../different_nested_dep/main.js | 5 + .../different_nested_dep/main.out | 2 + .../different_nested_dep/package.json | 6 + .../__test__.jsonc | 9 + .../different_nested_dep/main.js | 5 + .../different_nested_dep/main.out | 2 + .../different_nested_dep/package.json | 6 + .../__test__.jsonc | 9 + .../directory_import/folder_index_js.out | 7 + .../directory_import/folder_index_js.ts | 2 + .../directory_import/folder_no_index.out | 6 + .../directory_import/folder_no_index.ts | 2 + .../__test__.jsonc | 9 + .../directory_import/folder_index_js.out | 7 + .../directory_import/folder_index_js.ts | 2 + .../directory_import/folder_no_index.out | 6 + .../directory_import/folder_no_index.ts | 2 + tests/specs/npm_tests/dual_cjs_esm/__test__.jsonc | 8 + .../npm_tests/dual_cjs_esm/dual_cjs_esm/main.out | 3 + .../npm_tests/dual_cjs_esm/dual_cjs_esm/main.ts | 6 + .../dynamic_import_deno_ts_from_npm/__test__.jsonc | 8 + .../dynamic_import_deno_ts_from_npm/add.ts | 3 + .../dynamic_import_deno_ts_from_npm/main.out | 2 + .../dynamic_import_deno_ts_from_npm/main.ts | 8 + .../dynamic_import_deno_ts_from_npm/subtract.mts | 3 + .../__test__.jsonc | 8 + .../dynamic_import_invalid_package_name/main.out | 6 + .../dynamic_import_invalid_package_name/main.ts | 6 + .../npm_tests/dynamic_import_json/__test__.jsonc | 8 + .../dynamic_import_json/import_json/main.js | 4 + .../dynamic_import_json/import_json/main.out | 10 + .../__test__.jsonc | 8 + .../dynamic_import_reload_same_package/main.out | 5 + .../dynamic_import_reload_same_package/main.ts | 7 + .../dynamic_import_reload_same_package/other.ts | 3 + .../npm_tests/env_var_re_export_dev/__test__.jsonc | 8 + .../env_var_re_export/main.js | 3 + .../env_var_re_export_prod/__test__.jsonc | 9 + .../env_var_re_export/main.js | 3 + .../error_version_after_subpath/__test__.jsonc | 9 + .../error_version_after_subpath/main.js | 1 + .../error_version_after_subpath/main.out | 2 + tests/specs/npm_tests/import_json/__test__.jsonc | 8 + .../npm_tests/import_json/import_json/main.js | 4 + .../npm_tests/import_json/import_json/main.out | 10 + tests/specs/npm_tests/import_map/__test__.jsonc | 8 + .../import_map/import_map/import_map.json | 6 + .../specs/npm_tests/import_map/import_map/main.js | 10 + .../specs/npm_tests/import_map/import_map/main.out | 10 + .../npm_tests/imports_package_json/__test__.jsonc | 8 + .../imports_package_json/import_not_defined.js | 3 + .../imports_package_json/import_not_defined.out | 3 + .../imports_package_json/main.js | 7 + .../imports_package_json/main.out | 7 + .../imports_package_json/package.json | 6 + .../sub_path_import_not_defined.js | 3 + .../sub_path_import_not_defined.out | 3 + .../__test__.jsonc | 9 + .../imports_package_json/import_not_defined.js | 3 + .../imports_package_json/import_not_defined.out | 3 + .../imports_package_json/main.js | 7 + .../imports_package_json/main.out | 7 + .../imports_package_json/package.json | 6 + .../sub_path_import_not_defined.js | 3 + .../sub_path_import_not_defined.out | 3 + .../__test__.jsonc | 9 + .../imports_package_json/import_not_defined.js | 3 + .../imports_package_json/import_not_defined.out | 3 + .../imports_package_json/main.js | 7 + .../imports_package_json/main.out | 7 + .../imports_package_json/package.json | 6 + .../sub_path_import_not_defined.js | 3 + .../sub_path_import_not_defined.out | 3 + .../npm_tests/info_chalk_display/__test__.jsonc | 9 + .../info_chalk_display/cjs_with_deps/main.js | 12 + .../info_chalk_display/cjs_with_deps/main.out | 33 + .../info_chalk_display/cjs_with_deps/main_info.out | 22 + .../cjs_with_deps/main_info_json.out | 148 +++++ .../cjs_with_deps/main_node_modules.out | 47 ++ .../__test__.jsonc | 9 + .../cjs_with_deps/main.js | 12 + .../cjs_with_deps/main.out | 33 + .../cjs_with_deps/main_info.out | 22 + .../cjs_with_deps/main_info_json.out | 148 +++++ .../cjs_with_deps/main_node_modules.out | 47 ++ .../specs/npm_tests/info_chalk_json/__test__.jsonc | 9 + .../info_chalk_json/cjs_with_deps/main.js | 12 + .../info_chalk_json/cjs_with_deps/main.out | 33 + .../info_chalk_json/cjs_with_deps/main_info.out | 22 + .../cjs_with_deps/main_info_json.out | 148 +++++ .../cjs_with_deps/main_node_modules.out | 47 ++ .../__test__.jsonc | 9 + .../cjs_with_deps/main.js | 12 + .../cjs_with_deps/main.out | 33 + .../cjs_with_deps/main_info.out | 22 + .../cjs_with_deps/main_info_json.out | 148 +++++ .../cjs_with_deps/main_node_modules.out | 47 ++ .../info_cli_chalk_display/__test__.jsonc | 9 + .../info_cli_chalk_display/info/chalk.out | 9 + .../info_cli_chalk_display/info/chalk_json.out | 57 ++ .../npm_tests/info_cli_chalk_json/__test__.jsonc | 9 + .../npm_tests/info_cli_chalk_json/info/chalk.out | 9 + .../info_cli_chalk_json/info/chalk_json.out | 57 ++ .../specs/npm_tests/info_peer_deps/__test__.jsonc | 9 + .../peer_deps_with_copied_folders/main.out | 14 + .../peer_deps_with_copied_folders/main.ts | 5 + .../peer_deps_with_copied_folders/main_info.out | 14 + .../main_info_json.out | 97 +++ .../main_node_modules.out | 9 + .../main_node_modules_reload.out | 19 + .../npm_tests/info_peer_deps_json/__test__.jsonc | 9 + .../peer_deps_with_copied_folders/main.out | 14 + .../peer_deps_with_copied_folders/main.ts | 5 + .../peer_deps_with_copied_folders/main_info.out | 14 + .../main_info_json.out | 97 +++ .../main_node_modules.out | 9 + .../main_node_modules_reload.out | 19 + .../__test__.jsonc | 9 + .../mixed_case_package_name/global.out | 9 + .../mixed_case_package_name/global.ts | 2 + .../mixed_case_package_name/local.out | 13 + .../mixed_case_package_name/local.ts | 18 + .../__test__.jsonc | 9 + .../mixed_case_package_name/global.out | 9 + .../mixed_case_package_name/global.ts | 2 + .../mixed_case_package_name/local.out | 13 + .../mixed_case_package_name/local.ts | 18 + .../node_modules_deno_node_modules/__test__.jsonc | 9 + .../node_modules_deno_node_modules/main.out | 2 + .../node_modules_deno_node_modules/main.ts | 7 + .../__test__.jsonc | 9 + .../node_modules_deno_node_modules/main.out | 2 + .../node_modules_deno_node_modules/main.ts | 7 + .../__test__.jsonc | 9 + .../require_added_nm_folder/main.js | 10 + .../require_added_nm_folder/main.out | 1 + .../__test__.jsonc | 9 + .../require_main/main.js | 2 + .../require_main/main.out | 1 + .../node_modules_dir_with_deps/__test__.jsonc | 8 + .../cjs_with_deps/main.js | 12 + .../cjs_with_deps/main.out | 33 + .../cjs_with_deps/main_info.out | 22 + .../cjs_with_deps/main_info_json.out | 148 +++++ .../cjs_with_deps/main_node_modules.out | 47 ++ .../node_modules_dir_yargs/__test__.jsonc | 8 + .../node_modules_dir_yargs/cjs_yargs/main.js | 20 + .../node_modules_dir_yargs/cjs_yargs/main.out | 84 +++ .../npm_tests/non_existent_dep/__test__.jsonc | 9 + .../non_existent_dep_version/__test__.jsonc | 9 + .../npm_tests/nonexistent_file/__test__.jsonc | 9 + .../nonexistent_file/nonexistent_file/main.js | 2 + .../nonexistent_file/nonexistent_file/main.out | 4 + .../__test__.jsonc | 9 + .../nonexistent_file/main.js | 2 + .../nonexistent_file/main.out | 4 + .../permissions_outside_package/__test__.jsonc | 8 + .../permissions_outside_package/foo/config.js | 4 + .../permissions_outside_package/foo/package.json | 4 + .../permissions_outside_package/main.out | 3 + .../permissions_outside_package/main.ts | 5 + .../npm_tests/remote_npm_specifier/__test__.jsonc | 9 + .../remote_npm_specifier/main.out | 1 + .../remote_npm_specifier/main.ts | 1 + .../remote_npm_specifier/remote.ts | 3 + tests/specs/npm_tests/require_esm/__test__.jsonc | 4 + .../specs/npm_tests/require_esm/require_esm/esm.js | 1 + .../npm_tests/require_esm/require_esm/main.out | 1 + .../npm_tests/require_esm/require_esm/main.ts | 5 + tests/specs/npm_tests/require_json/__test__.jsonc | 8 + .../npm_tests/require_json/require_json/main.js | 2 + .../npm_tests/require_json/require_json/main.out | 3 + .../npm_tests/reserved_word_exports/__test__.jsonc | 8 + .../reserved_word_exports/main.out | 141 ++++ .../reserved_word_exports/main.ts | 3 + .../__test__.jsonc | 8 + .../run_existing_npm_package_with_subpath/main.out | 5 + .../package.json | 6 + tests/specs/npm_tests/sub_paths/__test__.jsonc | 8 + tests/specs/npm_tests/sub_paths/sub_paths/main.jsx | 8 + tests/specs/npm_tests/sub_paths/sub_paths/main.out | 1 + .../tarball_with_global_header/__test__.jsonc | 8 + .../tarball_with_global_header/main.js | 3 + .../tarball_with_global_header/main.out | 1 + .../npm_tests/translate_cjs_to_esm/__test__.jsonc | 8 + .../translate_cjs_to_esm/main.js | 6 + .../translate_cjs_to_esm/main.out | 4 + .../npm_tests/types_ambient_module/__test__.jsonc | 9 + .../types_ambient_module/import_map.json | 5 + .../types_ambient_module/main.out | 21 + .../types_ambient_module/main.ts | 7 + .../types_ambient_module/main_import_map.out | 9 + .../types_ambient_module/main_import_map.ts | 4 + .../types_ambient_module_import_map/__test__.jsonc | 9 + .../types_ambient_module/import_map.json | 5 + .../types_ambient_module/main.out | 21 + .../types_ambient_module/main.ts | 7 + .../types_ambient_module/main_import_map.out | 9 + .../types_ambient_module/main_import_map.ts | 4 + tests/specs/npm_tests/types_d_ext/__test__.jsonc | 8 + tests/specs/npm_tests/types_d_ext/d_ext/main.out | 3 + tests/specs/npm_tests/types_d_ext/d_ext/main.ts | 3 + .../types_entry_value_not_exists/__test__.jsonc | 9 + .../types_entry_value_not_exists/main.out | 7 + .../types_entry_value_not_exists/main.ts | 5 + .../types_exports_import_types/__test__.jsonc | 9 + .../types_exports_import_types/main.out | 7 + .../types_exports_import_types/main.ts | 5 + .../npm_tests/types_no_types_entry/__test__.jsonc | 9 + .../types_no_types_entry/main.out | 13 + .../types_no_types_entry/main.ts | 5 + .../typescript_file_in_package/__test__.jsonc | 9 + .../typescript_file_in_package/main.out | 6 + .../typescript_file_in_package/main.ts | 5 + tests/testdata/npm/builtin_module_module/main.js | 1 - tests/testdata/npm/builtin_module_module/main.out | 4 - tests/testdata/npm/check_errors/main.ts | 3 - tests/testdata/npm/check_errors/main_all.out | 19 - tests/testdata/npm/check_errors/main_local.out | 7 - .../testdata/npm/child_process_fork_test/main.out | 2 - tests/testdata/npm/child_process_fork_test/main.ts | 4 - .../testdata/npm/cjs-invalid-name-exports/main.out | 13 - .../testdata/npm/cjs-invalid-name-exports/main.ts | 3 - tests/testdata/npm/cjs_local_global_decls/main.out | 3 - tests/testdata/npm/cjs_local_global_decls/main.ts | 1 - .../npm/cjs_module_export_assignment/main.out | 6 - .../npm/cjs_module_export_assignment/main.ts | 6 - .../cjs_module_export_assignment_number/main.out | 3 - .../cjs_module_export_assignment_number/main.ts | 7 - tests/testdata/npm/cjs_pkg_imports/main.out | 3 - tests/testdata/npm/cjs_pkg_imports/main.ts | 3 - tests/testdata/npm/cjs_reexport_collision/main.out | 1 - tests/testdata/npm/cjs_reexport_collision/main.ts | 2 - tests/testdata/npm/cjs_require_esm/main.out | 4 - tests/testdata/npm/cjs_require_esm/main.ts | 2 - tests/testdata/npm/cjs_require_esm_mjs/main.out | 4 - tests/testdata/npm/cjs_require_esm_mjs/main.ts | 2 - tests/testdata/npm/cjs_sub_path/main.js | 21 - tests/testdata/npm/cjs_sub_path/main.out | 35 - tests/testdata/npm/cjs_this_in_exports/main.js | 11 - tests/testdata/npm/cjs_this_in_exports/main.out | 5 - tests/testdata/npm/cjs_yargs/main.js | 20 - tests/testdata/npm/cjs_yargs/main.out | 84 --- tests/testdata/npm/compare_globals/main.out | 30 - tests/testdata/npm/compare_globals/main.ts | 54 -- tests/testdata/npm/create_require/main.out | 12 - tests/testdata/npm/create_require/main.ts | 1 - tests/testdata/npm/d_ext/main.out | 3 - tests/testdata/npm/d_ext/main.ts | 3 - tests/testdata/npm/deno_cache.out | 8 - tests/testdata/npm/deno_run_no_bin_entrypoint.out | 1 - ..._run_no_bin_entrypoint_non_existent_subpath.out | 3 - tests/testdata/npm/deno_run_no_ext.out | 4 - tests/testdata/npm/deno_run_non_existent.out | 2 - .../npm/deno_run_special_chars_in_bin_name.out | 4 - .../npm/directory_import/folder_index_js.out | 7 - .../npm/directory_import/folder_index_js.ts | 2 - .../npm/directory_import/folder_no_index.out | 6 - .../npm/directory_import/folder_no_index.ts | 2 - .../npm/dynamic_import_deno_ts_from_npm/add.ts | 3 - .../npm/dynamic_import_deno_ts_from_npm/main.out | 2 - .../npm/dynamic_import_deno_ts_from_npm/main.ts | 8 - .../dynamic_import_deno_ts_from_npm/subtract.mts | 3 - .../dynamic_import_invalid_package_name/main.out | 6 - .../dynamic_import_invalid_package_name/main.ts | 6 - .../dynamic_import_reload_same_package/main.out | 5 - .../npm/dynamic_import_reload_same_package/main.ts | 7 - .../dynamic_import_reload_same_package/other.ts | 3 - tests/testdata/npm/env_var_re_export/main.js | 3 - .../npm/error_version_after_subpath/main.js | 1 - .../npm/error_version_after_subpath/main.out | 2 - tests/testdata/npm/file_dts_dmts_dcts/main.out | 24 - tests/testdata/npm/file_dts_dmts_dcts/main.ts | 9 - tests/testdata/npm/import_json/main.js | 4 - tests/testdata/npm/import_json/main.out | 10 - tests/testdata/npm/import_map/import_map.json | 6 - tests/testdata/npm/import_map/main.js | 10 - tests/testdata/npm/import_map/main.out | 10 - .../npm/imports_package_json/import_not_defined.js | 3 - .../imports_package_json/import_not_defined.out | 3 - tests/testdata/npm/imports_package_json/main.js | 7 - tests/testdata/npm/imports_package_json/main.out | 7 - .../testdata/npm/imports_package_json/package.json | 6 - .../sub_path_import_not_defined.js | 3 - .../sub_path_import_not_defined.out | 3 - tests/testdata/npm/info/chalk.out | 9 - tests/testdata/npm/info/chalk_json.out | 57 -- .../npm/mixed_case_package_name/global.out | 9 - .../testdata/npm/mixed_case_package_name/global.ts | 2 - .../testdata/npm/mixed_case_package_name/local.out | 13 - .../testdata/npm/mixed_case_package_name/local.ts | 18 - .../npm/node_modules_deno_node_modules/main.out | 2 - .../npm/node_modules_deno_node_modules/main.ts | 7 - tests/testdata/npm/nonexistent_file/main.js | 2 - tests/testdata/npm/nonexistent_file/main.out | 4 - .../npm/permissions_outside_package/foo/config.js | 4 - .../permissions_outside_package/foo/package.json | 4 - .../npm/permissions_outside_package/main.out | 3 - .../npm/permissions_outside_package/main.ts | 5 - tests/testdata/npm/remote_npm_specifier/main.out | 1 - tests/testdata/npm/remote_npm_specifier/main.ts | 1 - tests/testdata/npm/remote_npm_specifier/remote.ts | 3 - tests/testdata/npm/require_added_nm_folder/main.js | 10 - .../testdata/npm/require_added_nm_folder/main.out | 1 - tests/testdata/npm/require_json/main.js | 2 - tests/testdata/npm/require_json/main.out | 3 - tests/testdata/npm/require_main/main.js | 2 - tests/testdata/npm/require_main/main.out | 1 - tests/testdata/npm/reserved_word_exports/main.out | 141 ---- tests/testdata/npm/reserved_word_exports/main.ts | 3 - .../run_existing_npm_package_with_subpath/main.out | 5 - .../package.json | 6 - tests/testdata/npm/sub_paths/main.jsx | 8 - tests/testdata/npm/sub_paths/main.out | 1 - .../npm/tarball_with_global_header/main.js | 3 - .../npm/tarball_with_global_header/main.out | 1 - tests/testdata/npm/translate_cjs_to_esm/main.js | 6 - tests/testdata/npm/translate_cjs_to_esm/main.out | 4 - .../npm/types_ambient_module/import_map.json | 5 - tests/testdata/npm/types_ambient_module/main.out | 21 - tests/testdata/npm/types_ambient_module/main.ts | 7 - .../npm/types_ambient_module/main_import_map.out | 9 - .../npm/types_ambient_module/main_import_map.ts | 4 - .../npm/types_entry_value_not_exists/main.out | 7 - .../npm/types_entry_value_not_exists/main.ts | 5 - .../npm/types_exports_import_types/main.out | 7 - .../npm/types_exports_import_types/main.ts | 5 - tests/testdata/npm/types_no_types_entry/main.out | 13 - tests/testdata/npm/types_no_types_entry/main.ts | 5 - .../npm/typescript_file_in_package/main.out | 6 - .../npm/typescript_file_in_package/main.ts | 5 - 423 files changed, 4046 insertions(+), 1702 deletions(-) create mode 100644 tests/specs/npm_tests/builtin_module_module/__test__.jsonc create mode 100644 tests/specs/npm_tests/builtin_module_module/builtin_module_module/main.js create mode 100644 tests/specs/npm_tests/builtin_module_module/builtin_module_module/main.out create mode 100644 tests/specs/npm_tests/cached_only/__test__.jsonc create mode 100644 tests/specs/npm_tests/cached_only/cached_only/main.out create mode 100644 tests/specs/npm_tests/cached_only/cached_only/main.ts create mode 100644 tests/specs/npm_tests/check_all/__test__.jsonc create mode 100644 tests/specs/npm_tests/check_all/check_errors/main.ts create mode 100644 tests/specs/npm_tests/check_all/check_errors/main_all.out create mode 100644 tests/specs/npm_tests/check_all/check_errors/main_local.out create mode 100644 tests/specs/npm_tests/check_local/__test__.jsonc create mode 100644 tests/specs/npm_tests/check_local/check_errors/main.ts create mode 100644 tests/specs/npm_tests/check_local/check_errors/main_all.out create mode 100644 tests/specs/npm_tests/check_local/check_errors/main_local.out create mode 100644 tests/specs/npm_tests/check_package_file_dts_dmts_dcts/__test__.jsonc create mode 100644 tests/specs/npm_tests/check_package_file_dts_dmts_dcts/file_dts_dmts_dcts/main.out create mode 100644 tests/specs/npm_tests/check_package_file_dts_dmts_dcts/file_dts_dmts_dcts/main.ts create mode 100644 tests/specs/npm_tests/child_process_fork_test/__test__.jsonc create mode 100644 tests/specs/npm_tests/child_process_fork_test/child_process_fork_test/main.out create mode 100644 tests/specs/npm_tests/child_process_fork_test/child_process_fork_test/main.ts create mode 100644 tests/specs/npm_tests/cjs_invalid_name_exports/__test__.jsonc create mode 100644 tests/specs/npm_tests/cjs_invalid_name_exports/cjs-invalid-name-exports/main.out create mode 100644 tests/specs/npm_tests/cjs_invalid_name_exports/cjs-invalid-name-exports/main.ts create mode 100644 tests/specs/npm_tests/cjs_local_global_decls/__test__.jsonc create mode 100644 tests/specs/npm_tests/cjs_local_global_decls/cjs_local_global_decls/main.out create mode 100644 tests/specs/npm_tests/cjs_local_global_decls/cjs_local_global_decls/main.ts create mode 100644 tests/specs/npm_tests/cjs_module_export_assignment/__test__.jsonc create mode 100644 tests/specs/npm_tests/cjs_module_export_assignment/cjs_module_export_assignment/main.out create mode 100644 tests/specs/npm_tests/cjs_module_export_assignment/cjs_module_export_assignment/main.ts create mode 100644 tests/specs/npm_tests/cjs_module_export_assignment_number/__test__.jsonc create mode 100644 tests/specs/npm_tests/cjs_module_export_assignment_number/cjs_module_export_assignment_number/main.out create mode 100644 tests/specs/npm_tests/cjs_module_export_assignment_number/cjs_module_export_assignment_number/main.ts create mode 100644 tests/specs/npm_tests/cjs_pkg_imports/__test__.jsonc create mode 100644 tests/specs/npm_tests/cjs_pkg_imports/cjs_pkg_imports/main.out create mode 100644 tests/specs/npm_tests/cjs_pkg_imports/cjs_pkg_imports/main.ts create mode 100644 tests/specs/npm_tests/cjs_reexport_collision/__test__.jsonc create mode 100644 tests/specs/npm_tests/cjs_reexport_collision/cjs_reexport_collision/main.out create mode 100644 tests/specs/npm_tests/cjs_reexport_collision/cjs_reexport_collision/main.ts create mode 100644 tests/specs/npm_tests/cjs_require_esm/__test__.jsonc create mode 100644 tests/specs/npm_tests/cjs_require_esm/cjs_require_esm/main.out create mode 100644 tests/specs/npm_tests/cjs_require_esm/cjs_require_esm/main.ts create mode 100644 tests/specs/npm_tests/cjs_require_esm_mjs/__test__.jsonc create mode 100644 tests/specs/npm_tests/cjs_require_esm_mjs/cjs_require_esm_mjs/main.out create mode 100644 tests/specs/npm_tests/cjs_require_esm_mjs/cjs_require_esm_mjs/main.ts create mode 100644 tests/specs/npm_tests/cjs_sub_path/__test__.jsonc create mode 100644 tests/specs/npm_tests/cjs_sub_path/cjs_sub_path/main.js create mode 100644 tests/specs/npm_tests/cjs_sub_path/cjs_sub_path/main.out create mode 100644 tests/specs/npm_tests/cjs_this_in_exports/__test__.jsonc create mode 100644 tests/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.js create mode 100644 tests/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.out create mode 100644 tests/specs/npm_tests/cjs_with_deps/__test__.jsonc create mode 100644 tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main.js create mode 100644 tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main.out create mode 100644 tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main_info.out create mode 100644 tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main_info_json.out create mode 100644 tests/specs/npm_tests/cjs_with_deps/cjs_with_deps/main_node_modules.out create mode 100644 tests/specs/npm_tests/compare_globals/__test__.jsonc create mode 100644 tests/specs/npm_tests/compare_globals/compare_globals/main.out create mode 100644 tests/specs/npm_tests/compare_globals/compare_globals/main.ts create mode 100644 tests/specs/npm_tests/create_require/__test__.jsonc create mode 100644 tests/specs/npm_tests/create_require/create_require/main.out create mode 100644 tests/specs/npm_tests/create_require/create_require/main.ts create mode 100644 tests/specs/npm_tests/deno_cache/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_cache/deno_cache.out create mode 100644 tests/specs/npm_tests/deno_run_bin_cjs/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_bin_cjs/deno_run_cjs.out create mode 100644 tests/specs/npm_tests/deno_run_bin_cjs_no_bin_entrypoint/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_bin_cjs_no_bin_entrypoint/deno_run_cjs.out create mode 100644 tests/specs/npm_tests/deno_run_bin_esm/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_bin_esm/deno_run_esm.out create mode 100644 tests/specs/npm_tests/deno_run_bin_esm_no_bin_entrypoint/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_bin_esm_no_bin_entrypoint/deno_run_esm.out create mode 100644 tests/specs/npm_tests/deno_run_bin_no_ext/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_bin_no_ext/deno_run_no_ext.out create mode 100644 tests/specs/npm_tests/deno_run_bin_special_chars/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_bin_special_chars/deno_run_special_chars_in_bin_name.out create mode 100644 tests/specs/npm_tests/deno_run_cowsay/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_cowsay/deno_run_cowsay.out create mode 100644 tests/specs/npm_tests/deno_run_cowsay_explicit/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_cowsay_explicit/deno_run_cowsay.out create mode 100644 tests/specs/npm_tests/deno_run_cowsay_with_node_modules_dir/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_cowsay_with_node_modules_dir/deno_run_cowsay.out create mode 100644 tests/specs/npm_tests/deno_run_cowthink/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_cowthink/deno_run_cowthink.out create mode 100644 tests/specs/npm_tests/deno_run_no_bin_entrypoint/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_no_bin_entrypoint/deno_run_no_bin_entrypoint.out create mode 100644 tests/specs/npm_tests/deno_run_no_bin_entrypoint_non_existent_subpath/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_no_bin_entrypoint_non_existent_subpath/deno_run_no_bin_entrypoint_non_existent_subpath.out create mode 100644 tests/specs/npm_tests/deno_run_non_existent/__test__.jsonc create mode 100644 tests/specs/npm_tests/deno_run_non_existent/deno_run_non_existent.out create mode 100644 tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/__test__.jsonc create mode 100644 tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/different_nested_dep/main.js create mode 100644 tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/different_nested_dep/main.out create mode 100644 tests/specs/npm_tests/different_nested_dep_node_modules_dir_false/different_nested_dep/package.json create mode 100644 tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/__test__.jsonc create mode 100644 tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/different_nested_dep/main.js create mode 100644 tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/different_nested_dep/main.out create mode 100644 tests/specs/npm_tests/different_nested_dep_node_modules_dir_true/different_nested_dep/package.json create mode 100644 tests/specs/npm_tests/directory_import_folder_index_js/__test__.jsonc create mode 100644 tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_index_js.out create mode 100644 tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_index_js.ts create mode 100644 tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_no_index.out create mode 100644 tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_no_index.ts create mode 100644 tests/specs/npm_tests/directory_import_folder_no_index/__test__.jsonc create mode 100644 tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_index_js.out create mode 100644 tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_index_js.ts create mode 100644 tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_no_index.out create mode 100644 tests/specs/npm_tests/directory_import_folder_no_index/directory_import/folder_no_index.ts create mode 100644 tests/specs/npm_tests/dual_cjs_esm/__test__.jsonc create mode 100644 tests/specs/npm_tests/dual_cjs_esm/dual_cjs_esm/main.out create mode 100644 tests/specs/npm_tests/dual_cjs_esm/dual_cjs_esm/main.ts create mode 100644 tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/__test__.jsonc create mode 100644 tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/add.ts create mode 100644 tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/main.out create mode 100644 tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/main.ts create mode 100644 tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/subtract.mts create mode 100644 tests/specs/npm_tests/dynamic_import_invalid_package_name/__test__.jsonc create mode 100644 tests/specs/npm_tests/dynamic_import_invalid_package_name/dynamic_import_invalid_package_name/main.out create mode 100644 tests/specs/npm_tests/dynamic_import_invalid_package_name/dynamic_import_invalid_package_name/main.ts create mode 100644 tests/specs/npm_tests/dynamic_import_json/__test__.jsonc create mode 100644 tests/specs/npm_tests/dynamic_import_json/import_json/main.js create mode 100644 tests/specs/npm_tests/dynamic_import_json/import_json/main.out create mode 100644 tests/specs/npm_tests/dynamic_import_reload_same_package/__test__.jsonc create mode 100644 tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/main.out create mode 100644 tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/main.ts create mode 100644 tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/other.ts create mode 100644 tests/specs/npm_tests/env_var_re_export_dev/__test__.jsonc create mode 100644 tests/specs/npm_tests/env_var_re_export_dev/env_var_re_export/main.js create mode 100644 tests/specs/npm_tests/env_var_re_export_prod/__test__.jsonc create mode 100644 tests/specs/npm_tests/env_var_re_export_prod/env_var_re_export/main.js create mode 100644 tests/specs/npm_tests/error_version_after_subpath/__test__.jsonc create mode 100644 tests/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.js create mode 100644 tests/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.out create mode 100644 tests/specs/npm_tests/import_json/__test__.jsonc create mode 100644 tests/specs/npm_tests/import_json/import_json/main.js create mode 100644 tests/specs/npm_tests/import_json/import_json/main.out create mode 100644 tests/specs/npm_tests/import_map/__test__.jsonc create mode 100644 tests/specs/npm_tests/import_map/import_map/import_map.json create mode 100644 tests/specs/npm_tests/import_map/import_map/main.js create mode 100644 tests/specs/npm_tests/import_map/import_map/main.out create mode 100644 tests/specs/npm_tests/imports_package_json/__test__.jsonc create mode 100644 tests/specs/npm_tests/imports_package_json/imports_package_json/import_not_defined.js create mode 100644 tests/specs/npm_tests/imports_package_json/imports_package_json/import_not_defined.out create mode 100644 tests/specs/npm_tests/imports_package_json/imports_package_json/main.js create mode 100644 tests/specs/npm_tests/imports_package_json/imports_package_json/main.out create mode 100644 tests/specs/npm_tests/imports_package_json/imports_package_json/package.json create mode 100644 tests/specs/npm_tests/imports_package_json/imports_package_json/sub_path_import_not_defined.js create mode 100644 tests/specs/npm_tests/imports_package_json/imports_package_json/sub_path_import_not_defined.out create mode 100644 tests/specs/npm_tests/imports_package_json_import_not_defined/__test__.jsonc create mode 100644 tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/import_not_defined.js create mode 100644 tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/import_not_defined.out create mode 100644 tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/main.js create mode 100644 tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/main.out create mode 100644 tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/package.json create mode 100644 tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.js create mode 100644 tests/specs/npm_tests/imports_package_json_import_not_defined/imports_package_json/sub_path_import_not_defined.out create mode 100644 tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/__test__.jsonc create mode 100644 tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.js create mode 100644 tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/import_not_defined.out create mode 100644 tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/main.js create mode 100644 tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/main.out create mode 100644 tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/package.json create mode 100644 tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.js create mode 100644 tests/specs/npm_tests/imports_package_json_sub_path_import_not_defined/imports_package_json/sub_path_import_not_defined.out create mode 100644 tests/specs/npm_tests/info_chalk_display/__test__.jsonc create mode 100644 tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main.js create mode 100644 tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main.out create mode 100644 tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main_info.out create mode 100644 tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main_info_json.out create mode 100644 tests/specs/npm_tests/info_chalk_display/cjs_with_deps/main_node_modules.out create mode 100644 tests/specs/npm_tests/info_chalk_display_node_modules_dir/__test__.jsonc create mode 100644 tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main.js create mode 100644 tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main.out create mode 100644 tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main_info.out create mode 100644 tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main_info_json.out create mode 100644 tests/specs/npm_tests/info_chalk_display_node_modules_dir/cjs_with_deps/main_node_modules.out create mode 100644 tests/specs/npm_tests/info_chalk_json/__test__.jsonc create mode 100644 tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main.js create mode 100644 tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main.out create mode 100644 tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main_info.out create mode 100644 tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main_info_json.out create mode 100644 tests/specs/npm_tests/info_chalk_json/cjs_with_deps/main_node_modules.out create mode 100644 tests/specs/npm_tests/info_chalk_json_node_modules_dir/__test__.jsonc create mode 100644 tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main.js create mode 100644 tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main.out create mode 100644 tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main_info.out create mode 100644 tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main_info_json.out create mode 100644 tests/specs/npm_tests/info_chalk_json_node_modules_dir/cjs_with_deps/main_node_modules.out create mode 100644 tests/specs/npm_tests/info_cli_chalk_display/__test__.jsonc create mode 100644 tests/specs/npm_tests/info_cli_chalk_display/info/chalk.out create mode 100644 tests/specs/npm_tests/info_cli_chalk_display/info/chalk_json.out create mode 100644 tests/specs/npm_tests/info_cli_chalk_json/__test__.jsonc create mode 100644 tests/specs/npm_tests/info_cli_chalk_json/info/chalk.out create mode 100644 tests/specs/npm_tests/info_cli_chalk_json/info/chalk_json.out create mode 100644 tests/specs/npm_tests/info_peer_deps/__test__.jsonc create mode 100644 tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main.out create mode 100644 tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main.ts create mode 100644 tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_info.out create mode 100644 tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_info_json.out create mode 100644 tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_node_modules.out create mode 100644 tests/specs/npm_tests/info_peer_deps/peer_deps_with_copied_folders/main_node_modules_reload.out create mode 100644 tests/specs/npm_tests/info_peer_deps_json/__test__.jsonc create mode 100644 tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main.out create mode 100644 tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main.ts create mode 100644 tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_info.out create mode 100644 tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_info_json.out create mode 100644 tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules.out create mode 100644 tests/specs/npm_tests/info_peer_deps_json/peer_deps_with_copied_folders/main_node_modules_reload.out create mode 100644 tests/specs/npm_tests/mixed_case_package_name_global_dir/__test__.jsonc create mode 100644 tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/global.out create mode 100644 tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/global.ts create mode 100644 tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/local.out create mode 100644 tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/local.ts create mode 100644 tests/specs/npm_tests/mixed_case_package_name_local_dir/__test__.jsonc create mode 100644 tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/global.out create mode 100644 tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/global.ts create mode 100644 tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/local.out create mode 100644 tests/specs/npm_tests/mixed_case_package_name_local_dir/mixed_case_package_name/local.ts create mode 100644 tests/specs/npm_tests/node_modules_deno_node_modules/__test__.jsonc create mode 100644 tests/specs/npm_tests/node_modules_deno_node_modules/node_modules_deno_node_modules/main.out create mode 100644 tests/specs/npm_tests/node_modules_deno_node_modules/node_modules_deno_node_modules/main.ts create mode 100644 tests/specs/npm_tests/node_modules_deno_node_modules_local/__test__.jsonc create mode 100644 tests/specs/npm_tests/node_modules_deno_node_modules_local/node_modules_deno_node_modules/main.out create mode 100644 tests/specs/npm_tests/node_modules_deno_node_modules_local/node_modules_deno_node_modules/main.ts create mode 100644 tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/__test__.jsonc create mode 100644 tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/require_added_nm_folder/main.js create mode 100644 tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/require_added_nm_folder/main.out create mode 100644 tests/specs/npm_tests/node_modules_dir_require_main_entry/__test__.jsonc create mode 100644 tests/specs/npm_tests/node_modules_dir_require_main_entry/require_main/main.js create mode 100644 tests/specs/npm_tests/node_modules_dir_require_main_entry/require_main/main.out create mode 100644 tests/specs/npm_tests/node_modules_dir_with_deps/__test__.jsonc create mode 100644 tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main.js create mode 100644 tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main.out create mode 100644 tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main_info.out create mode 100644 tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main_info_json.out create mode 100644 tests/specs/npm_tests/node_modules_dir_with_deps/cjs_with_deps/main_node_modules.out create mode 100644 tests/specs/npm_tests/node_modules_dir_yargs/__test__.jsonc create mode 100644 tests/specs/npm_tests/node_modules_dir_yargs/cjs_yargs/main.js create mode 100644 tests/specs/npm_tests/node_modules_dir_yargs/cjs_yargs/main.out create mode 100644 tests/specs/npm_tests/non_existent_dep/__test__.jsonc create mode 100644 tests/specs/npm_tests/non_existent_dep_version/__test__.jsonc create mode 100644 tests/specs/npm_tests/nonexistent_file/__test__.jsonc create mode 100644 tests/specs/npm_tests/nonexistent_file/nonexistent_file/main.js create mode 100644 tests/specs/npm_tests/nonexistent_file/nonexistent_file/main.out create mode 100644 tests/specs/npm_tests/nonexistent_file_node_modules_dir/__test__.jsonc create mode 100644 tests/specs/npm_tests/nonexistent_file_node_modules_dir/nonexistent_file/main.js create mode 100644 tests/specs/npm_tests/nonexistent_file_node_modules_dir/nonexistent_file/main.out create mode 100644 tests/specs/npm_tests/permissions_outside_package/__test__.jsonc create mode 100644 tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/foo/config.js create mode 100644 tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/foo/package.json create mode 100644 tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.out create mode 100644 tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.ts create mode 100644 tests/specs/npm_tests/remote_npm_specifier/__test__.jsonc create mode 100644 tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/main.out create mode 100644 tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/main.ts create mode 100644 tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/remote.ts create mode 100644 tests/specs/npm_tests/require_esm/__test__.jsonc create mode 100644 tests/specs/npm_tests/require_esm/require_esm/esm.js create mode 100644 tests/specs/npm_tests/require_esm/require_esm/main.out create mode 100644 tests/specs/npm_tests/require_esm/require_esm/main.ts create mode 100644 tests/specs/npm_tests/require_json/__test__.jsonc create mode 100644 tests/specs/npm_tests/require_json/require_json/main.js create mode 100644 tests/specs/npm_tests/require_json/require_json/main.out create mode 100644 tests/specs/npm_tests/reserved_word_exports/__test__.jsonc create mode 100644 tests/specs/npm_tests/reserved_word_exports/reserved_word_exports/main.out create mode 100644 tests/specs/npm_tests/reserved_word_exports/reserved_word_exports/main.ts create mode 100644 tests/specs/npm_tests/run_existing_npm_package_with_subpath/__test__.jsonc create mode 100644 tests/specs/npm_tests/run_existing_npm_package_with_subpath/run_existing_npm_package_with_subpath/main.out create mode 100644 tests/specs/npm_tests/run_existing_npm_package_with_subpath/run_existing_npm_package_with_subpath/package.json create mode 100644 tests/specs/npm_tests/sub_paths/__test__.jsonc create mode 100644 tests/specs/npm_tests/sub_paths/sub_paths/main.jsx create mode 100644 tests/specs/npm_tests/sub_paths/sub_paths/main.out create mode 100644 tests/specs/npm_tests/tarball_with_global_header/__test__.jsonc create mode 100644 tests/specs/npm_tests/tarball_with_global_header/tarball_with_global_header/main.js create mode 100644 tests/specs/npm_tests/tarball_with_global_header/tarball_with_global_header/main.out create mode 100644 tests/specs/npm_tests/translate_cjs_to_esm/__test__.jsonc create mode 100644 tests/specs/npm_tests/translate_cjs_to_esm/translate_cjs_to_esm/main.js create mode 100644 tests/specs/npm_tests/translate_cjs_to_esm/translate_cjs_to_esm/main.out create mode 100644 tests/specs/npm_tests/types_ambient_module/__test__.jsonc create mode 100644 tests/specs/npm_tests/types_ambient_module/types_ambient_module/import_map.json create mode 100644 tests/specs/npm_tests/types_ambient_module/types_ambient_module/main.out create mode 100644 tests/specs/npm_tests/types_ambient_module/types_ambient_module/main.ts create mode 100644 tests/specs/npm_tests/types_ambient_module/types_ambient_module/main_import_map.out create mode 100644 tests/specs/npm_tests/types_ambient_module/types_ambient_module/main_import_map.ts create mode 100644 tests/specs/npm_tests/types_ambient_module_import_map/__test__.jsonc create mode 100644 tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/import_map.json create mode 100644 tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main.out create mode 100644 tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main.ts create mode 100644 tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main_import_map.out create mode 100644 tests/specs/npm_tests/types_ambient_module_import_map/types_ambient_module/main_import_map.ts create mode 100644 tests/specs/npm_tests/types_d_ext/__test__.jsonc create mode 100644 tests/specs/npm_tests/types_d_ext/d_ext/main.out create mode 100644 tests/specs/npm_tests/types_d_ext/d_ext/main.ts create mode 100644 tests/specs/npm_tests/types_entry_value_not_exists/__test__.jsonc create mode 100644 tests/specs/npm_tests/types_entry_value_not_exists/types_entry_value_not_exists/main.out create mode 100644 tests/specs/npm_tests/types_entry_value_not_exists/types_entry_value_not_exists/main.ts create mode 100644 tests/specs/npm_tests/types_exports_import_types/__test__.jsonc create mode 100644 tests/specs/npm_tests/types_exports_import_types/types_exports_import_types/main.out create mode 100644 tests/specs/npm_tests/types_exports_import_types/types_exports_import_types/main.ts create mode 100644 tests/specs/npm_tests/types_no_types_entry/__test__.jsonc create mode 100644 tests/specs/npm_tests/types_no_types_entry/types_no_types_entry/main.out create mode 100644 tests/specs/npm_tests/types_no_types_entry/types_no_types_entry/main.ts create mode 100644 tests/specs/npm_tests/typescript_file_in_package/__test__.jsonc create mode 100644 tests/specs/npm_tests/typescript_file_in_package/typescript_file_in_package/main.out create mode 100644 tests/specs/npm_tests/typescript_file_in_package/typescript_file_in_package/main.ts delete mode 100644 tests/testdata/npm/builtin_module_module/main.js delete mode 100644 tests/testdata/npm/builtin_module_module/main.out delete mode 100644 tests/testdata/npm/check_errors/main.ts delete mode 100644 tests/testdata/npm/check_errors/main_all.out delete mode 100644 tests/testdata/npm/check_errors/main_local.out delete mode 100644 tests/testdata/npm/child_process_fork_test/main.out delete mode 100644 tests/testdata/npm/child_process_fork_test/main.ts delete mode 100644 tests/testdata/npm/cjs-invalid-name-exports/main.out delete mode 100644 tests/testdata/npm/cjs-invalid-name-exports/main.ts delete mode 100644 tests/testdata/npm/cjs_local_global_decls/main.out delete mode 100644 tests/testdata/npm/cjs_local_global_decls/main.ts delete mode 100644 tests/testdata/npm/cjs_module_export_assignment/main.out delete mode 100644 tests/testdata/npm/cjs_module_export_assignment/main.ts delete mode 100644 tests/testdata/npm/cjs_module_export_assignment_number/main.out delete mode 100644 tests/testdata/npm/cjs_module_export_assignment_number/main.ts delete mode 100644 tests/testdata/npm/cjs_pkg_imports/main.out delete mode 100644 tests/testdata/npm/cjs_pkg_imports/main.ts delete mode 100644 tests/testdata/npm/cjs_reexport_collision/main.out delete mode 100644 tests/testdata/npm/cjs_reexport_collision/main.ts delete mode 100644 tests/testdata/npm/cjs_require_esm/main.out delete mode 100644 tests/testdata/npm/cjs_require_esm/main.ts delete mode 100644 tests/testdata/npm/cjs_require_esm_mjs/main.out delete mode 100644 tests/testdata/npm/cjs_require_esm_mjs/main.ts delete mode 100644 tests/testdata/npm/cjs_sub_path/main.js delete mode 100644 tests/testdata/npm/cjs_sub_path/main.out delete mode 100644 tests/testdata/npm/cjs_this_in_exports/main.js delete mode 100644 tests/testdata/npm/cjs_this_in_exports/main.out delete mode 100644 tests/testdata/npm/cjs_yargs/main.js delete mode 100644 tests/testdata/npm/cjs_yargs/main.out delete mode 100644 tests/testdata/npm/compare_globals/main.out delete mode 100644 tests/testdata/npm/compare_globals/main.ts delete mode 100644 tests/testdata/npm/create_require/main.out delete mode 100644 tests/testdata/npm/create_require/main.ts delete mode 100644 tests/testdata/npm/d_ext/main.out delete mode 100644 tests/testdata/npm/d_ext/main.ts delete mode 100644 tests/testdata/npm/deno_cache.out delete mode 100644 tests/testdata/npm/deno_run_no_bin_entrypoint.out delete mode 100644 tests/testdata/npm/deno_run_no_bin_entrypoint_non_existent_subpath.out delete mode 100644 tests/testdata/npm/deno_run_no_ext.out delete mode 100644 tests/testdata/npm/deno_run_non_existent.out delete mode 100644 tests/testdata/npm/deno_run_special_chars_in_bin_name.out delete mode 100644 tests/testdata/npm/directory_import/folder_index_js.out delete mode 100644 tests/testdata/npm/directory_import/folder_index_js.ts delete mode 100644 tests/testdata/npm/directory_import/folder_no_index.out delete mode 100644 tests/testdata/npm/directory_import/folder_no_index.ts delete mode 100644 tests/testdata/npm/dynamic_import_deno_ts_from_npm/add.ts delete mode 100644 tests/testdata/npm/dynamic_import_deno_ts_from_npm/main.out delete mode 100644 tests/testdata/npm/dynamic_import_deno_ts_from_npm/main.ts delete mode 100644 tests/testdata/npm/dynamic_import_deno_ts_from_npm/subtract.mts delete mode 100644 tests/testdata/npm/dynamic_import_invalid_package_name/main.out delete mode 100644 tests/testdata/npm/dynamic_import_invalid_package_name/main.ts delete mode 100644 tests/testdata/npm/dynamic_import_reload_same_package/main.out delete mode 100644 tests/testdata/npm/dynamic_import_reload_same_package/main.ts delete mode 100644 tests/testdata/npm/dynamic_import_reload_same_package/other.ts delete mode 100644 tests/testdata/npm/env_var_re_export/main.js delete mode 100644 tests/testdata/npm/error_version_after_subpath/main.js delete mode 100644 tests/testdata/npm/error_version_after_subpath/main.out delete mode 100644 tests/testdata/npm/file_dts_dmts_dcts/main.out delete mode 100644 tests/testdata/npm/file_dts_dmts_dcts/main.ts delete mode 100644 tests/testdata/npm/import_json/main.js delete mode 100644 tests/testdata/npm/import_json/main.out delete mode 100644 tests/testdata/npm/import_map/import_map.json delete mode 100644 tests/testdata/npm/import_map/main.js delete mode 100644 tests/testdata/npm/import_map/main.out delete mode 100644 tests/testdata/npm/imports_package_json/import_not_defined.js delete mode 100644 tests/testdata/npm/imports_package_json/import_not_defined.out delete mode 100644 tests/testdata/npm/imports_package_json/main.js delete mode 100644 tests/testdata/npm/imports_package_json/main.out delete mode 100644 tests/testdata/npm/imports_package_json/package.json delete mode 100644 tests/testdata/npm/imports_package_json/sub_path_import_not_defined.js delete mode 100644 tests/testdata/npm/imports_package_json/sub_path_import_not_defined.out delete mode 100644 tests/testdata/npm/info/chalk.out delete mode 100644 tests/testdata/npm/info/chalk_json.out delete mode 100644 tests/testdata/npm/mixed_case_package_name/global.out delete mode 100644 tests/testdata/npm/mixed_case_package_name/global.ts delete mode 100644 tests/testdata/npm/mixed_case_package_name/local.out delete mode 100644 tests/testdata/npm/mixed_case_package_name/local.ts delete mode 100644 tests/testdata/npm/node_modules_deno_node_modules/main.out delete mode 100644 tests/testdata/npm/node_modules_deno_node_modules/main.ts delete mode 100644 tests/testdata/npm/nonexistent_file/main.js delete mode 100644 tests/testdata/npm/nonexistent_file/main.out delete mode 100644 tests/testdata/npm/permissions_outside_package/foo/config.js delete mode 100644 tests/testdata/npm/permissions_outside_package/foo/package.json delete mode 100644 tests/testdata/npm/permissions_outside_package/main.out delete mode 100644 tests/testdata/npm/permissions_outside_package/main.ts delete mode 100644 tests/testdata/npm/remote_npm_specifier/main.out delete mode 100644 tests/testdata/npm/remote_npm_specifier/main.ts delete mode 100644 tests/testdata/npm/remote_npm_specifier/remote.ts delete mode 100644 tests/testdata/npm/require_added_nm_folder/main.js delete mode 100644 tests/testdata/npm/require_added_nm_folder/main.out delete mode 100644 tests/testdata/npm/require_json/main.js delete mode 100644 tests/testdata/npm/require_json/main.out delete mode 100644 tests/testdata/npm/require_main/main.js delete mode 100644 tests/testdata/npm/require_main/main.out delete mode 100644 tests/testdata/npm/reserved_word_exports/main.out delete mode 100644 tests/testdata/npm/reserved_word_exports/main.ts delete mode 100644 tests/testdata/npm/run_existing_npm_package_with_subpath/main.out delete mode 100644 tests/testdata/npm/run_existing_npm_package_with_subpath/package.json delete mode 100644 tests/testdata/npm/sub_paths/main.jsx delete mode 100644 tests/testdata/npm/sub_paths/main.out delete mode 100644 tests/testdata/npm/tarball_with_global_header/main.js delete mode 100644 tests/testdata/npm/tarball_with_global_header/main.out delete mode 100644 tests/testdata/npm/translate_cjs_to_esm/main.js delete mode 100644 tests/testdata/npm/translate_cjs_to_esm/main.out delete mode 100644 tests/testdata/npm/types_ambient_module/import_map.json delete mode 100644 tests/testdata/npm/types_ambient_module/main.out delete mode 100644 tests/testdata/npm/types_ambient_module/main.ts delete mode 100644 tests/testdata/npm/types_ambient_module/main_import_map.out delete mode 100644 tests/testdata/npm/types_ambient_module/main_import_map.ts delete mode 100644 tests/testdata/npm/types_entry_value_not_exists/main.out delete mode 100644 tests/testdata/npm/types_entry_value_not_exists/main.ts delete mode 100644 tests/testdata/npm/types_exports_import_types/main.out delete mode 100644 tests/testdata/npm/types_exports_import_types/main.ts delete mode 100644 tests/testdata/npm/types_no_types_entry/main.out delete mode 100644 tests/testdata/npm/types_no_types_entry/main.ts delete mode 100644 tests/testdata/npm/typescript_file_in_package/main.out delete mode 100644 tests/testdata/npm/typescript_file_in_package/main.ts (limited to 'tests') diff --git a/tests/integration/npm_tests.rs b/tests/integration/npm_tests.rs index 004136ae7..f47b1bdd4 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", - 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/"), -}); - -itest!(cjs_pkg_imports { - args: "run -A npm/cjs_pkg_imports/main.ts", - output: "npm/cjs_pkg_imports/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, + exit_code: 0, + cwd: Some("npm/require_resolve_url/"), + copy_temp_dir: Some("npm/require_resolve_url/"), }); - #[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, -}); - -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" - )), -}); +// 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!(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 000000000..2f26a95d4 --- /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/specs/npm_tests/builtin_module_module/builtin_module_module/main.js b/tests/specs/npm_tests/builtin_module_module/builtin_module_module/main.js new file mode 100644 index 000000000..9a036791b --- /dev/null +++ b/tests/specs/npm_tests/builtin_module_module/builtin_module_module/main.js @@ -0,0 +1 @@ +import "npm:@denotest/builtin-module-module"; diff --git a/tests/specs/npm_tests/builtin_module_module/builtin_module_module/main.out b/tests/specs/npm_tests/builtin_module_module/builtin_module_module/main.out new file mode 100644 index 000000000..160ba6503 --- /dev/null +++ b/tests/specs/npm_tests/builtin_module_module/builtin_module_module/main.out @@ -0,0 +1,4 @@ +function +function +function +true 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 000000000..764f702d2 --- /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 000000000..31113eef3 --- /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 000000000..1ccc441a1 --- /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 000000000..427524305 --- /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/specs/npm_tests/check_all/check_errors/main.ts b/tests/specs/npm_tests/check_all/check_errors/main.ts new file mode 100644 index 000000000..4b8684195 --- /dev/null +++ b/tests/specs/npm_tests/check_all/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_all/check_errors/main_all.out b/tests/specs/npm_tests/check_all/check_errors/main_all.out new file mode 100644 index 000000000..4c624c0ea --- /dev/null +++ b/tests/specs/npm_tests/check_all/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_all/check_errors/main_local.out b/tests/specs/npm_tests/check_all/check_errors/main_local.out new file mode 100644 index 000000000..4d3a892e7 --- /dev/null +++ b/tests/specs/npm_tests/check_all/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]/npm/check_errors/main.ts:3:18 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 000000000..1bffa5eed --- /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 000000000..4b8684195 --- /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 000000000..4c624c0ea --- /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 000000000..1a150b5e6 --- /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 000000000..675051a69 --- /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/specs/npm_tests/check_package_file_dts_dmts_dcts/file_dts_dmts_dcts/main.out b/tests/specs/npm_tests/check_package_file_dts_dmts_dcts/file_dts_dmts_dcts/main.out new file mode 100644 index 000000000..507d2c2f7 --- /dev/null +++ b/tests/specs/npm_tests/check_package_file_dts_dmts_dcts/file_dts_dmts_dcts/main.out @@ -0,0 +1,24 @@ +Download http://localhost:4260/@denotest/file-dts-dmts-dcts +Download http://localhost:4260/@denotest/file-dts-dmts-dcts/1.0.0.tgz +Check file:///[WILDCARD]/main.ts +error: TS2322 [ERROR]: Type '5' is not assignable to type '"dts"'. +const value1: Dts1 = 5; + ~~~~~~ + at file:///[WILDCARD] + +TS2322 [ERROR]: Type '5' is not assignable to type '"mts"'. +const value2: Mts1 = 5; + ~~~~~~ + at file:///[WILDCARD] + +TS2322 [ERROR]: Type '5' is not assignable to type '"mts"'. +const value3: Mts2 = 5; + ~~~~~~ + at file:///[WILDCARD] + +TS2322 [ERROR]: Type '5' is not assignable to type '"cts"'. +const value4: Cts1 = 5; + ~~~~~~ + at file:///[WILDCARD] + +Found 4 errors. diff --git a/tests/specs/npm_tests/check_package_file_dts_dmts_dcts/file_dts_dmts_dcts/main.ts b/tests/specs/npm_tests/check_package_file_dts_dmts_dcts/file_dts_dmts_dcts/main.ts new file mode 100644 index 000000000..63686e2d3 --- /dev/null +++ b/tests/specs/npm_tests/check_package_file_dts_dmts_dcts/file_dts_dmts_dcts/main.ts @@ -0,0 +1,9 @@ +import { Value as Dts1 } from "npm:@denotest/file-dts-dmts-dcts/js"; +import { Value as Mts1 } from "npm:@denotest/file-dts-dmts-dcts"; +import { Value as Mts2 } from "npm:@denotest/file-dts-dmts-dcts/mjs"; +import { Value as Cts1 } from "npm:@denotest/file-dts-dmts-dcts/cjs"; + +const value1: Dts1 = 5; +const value2: Mts1 = 5; +const value3: Mts2 = 5; +const value4: Cts1 = 5; 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 000000000..f83cb051e --- /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/specs/npm_tests/child_process_fork_test/child_process_fork_test/main.out b/tests/specs/npm_tests/child_process_fork_test/child_process_fork_test/main.out new file mode 100644 index 000000000..d5bc57741 --- /dev/null +++ b/tests/specs/npm_tests/child_process_fork_test/child_process_fork_test/main.out @@ -0,0 +1,2 @@ +function +Done. diff --git a/tests/specs/npm_tests/child_process_fork_test/child_process_fork_test/main.ts b/tests/specs/npm_tests/child_process_fork_test/child_process_fork_test/main.ts new file mode 100644 index 000000000..e560edb7e --- /dev/null +++ b/tests/specs/npm_tests/child_process_fork_test/child_process_fork_test/main.ts @@ -0,0 +1,4 @@ +import "npm:chalk@4"; +import { run } from "npm:@denotest/child-process-fork"; + +run(); 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 000000000..a38b8d035 --- /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/specs/npm_tests/cjs_invalid_name_exports/cjs-invalid-name-exports/main.out b/tests/specs/npm_tests/cjs_invalid_name_exports/cjs-invalid-name-exports/main.out new file mode 100644 index 000000000..45ec15d0e --- /dev/null +++ b/tests/specs/npm_tests/cjs_invalid_name_exports/cjs-invalid-name-exports/main.out @@ -0,0 +1,13 @@ +[Module: null prototype] { + "a \\ b": "a \\ b", + "another 'case'": "example", + default: { + 'wow "double quotes"': "double quotes", + "another 'case'": "example", + "a \\ b": "a \\ b", + "name variable": "a", + "foo - bar": "foo - bar" + }, + "foo - bar": "foo - bar", + 'wow "double quotes"': "double quotes" +} diff --git a/tests/specs/npm_tests/cjs_invalid_name_exports/cjs-invalid-name-exports/main.ts b/tests/specs/npm_tests/cjs_invalid_name_exports/cjs-invalid-name-exports/main.ts new file mode 100644 index 000000000..9bdf0e43b --- /dev/null +++ b/tests/specs/npm_tests/cjs_invalid_name_exports/cjs-invalid-name-exports/main.ts @@ -0,0 +1,3 @@ +import * as foo from "npm:@denotest/cjs-invalid-name-exports"; + +console.log(foo); 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 000000000..8bf847873 --- /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/specs/npm_tests/cjs_local_global_decls/cjs_local_global_decls/main.out b/tests/specs/npm_tests/cjs_local_global_decls/cjs_local_global_decls/main.out new file mode 100644 index 000000000..5e7a36c8d --- /dev/null +++ b/tests/specs/npm_tests/cjs_local_global_decls/cjs_local_global_decls/main.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/cjs-local-global-decls +Download http://localhost:4260/@denotest/cjs-local-global-decls/1.0.0.tgz +Loaded. diff --git a/tests/specs/npm_tests/cjs_local_global_decls/cjs_local_global_decls/main.ts b/tests/specs/npm_tests/cjs_local_global_decls/cjs_local_global_decls/main.ts new file mode 100644 index 000000000..04074057b --- /dev/null +++ b/tests/specs/npm_tests/cjs_local_global_decls/cjs_local_global_decls/main.ts @@ -0,0 +1 @@ +import "npm:@denotest/cjs-local-global-decls@1.0.0"; 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 000000000..e9be6361a --- /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/specs/npm_tests/cjs_module_export_assignment/cjs_module_export_assignment/main.out b/tests/specs/npm_tests/cjs_module_export_assignment/cjs_module_export_assignment/main.out new file mode 100644 index 000000000..dea185e38 --- /dev/null +++ b/tests/specs/npm_tests/cjs_module_export_assignment/cjs_module_export_assignment/main.out @@ -0,0 +1,6 @@ +{ func: [Function: func] } +[Module: null prototype] { + default: { func: [Function: func] }, + func: [Function: func] +} +5 diff --git a/tests/specs/npm_tests/cjs_module_export_assignment/cjs_module_export_assignment/main.ts b/tests/specs/npm_tests/cjs_module_export_assignment/cjs_module_export_assignment/main.ts new file mode 100644 index 000000000..93d3db1c3 --- /dev/null +++ b/tests/specs/npm_tests/cjs_module_export_assignment/cjs_module_export_assignment/main.ts @@ -0,0 +1,6 @@ +import defaultImport, * as namespaceImport from "npm:@denotest/cjs-module-export-assignment"; +import { func } from "npm:@denotest/cjs-module-export-assignment"; + +console.log(defaultImport); +console.log(namespaceImport); +console.log(func()); 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 000000000..d70f82e50 --- /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/specs/npm_tests/cjs_module_export_assignment_number/cjs_module_export_assignment_number/main.out b/tests/specs/npm_tests/cjs_module_export_assignment_number/cjs_module_export_assignment_number/main.out new file mode 100644 index 000000000..e559775cf --- /dev/null +++ b/tests/specs/npm_tests/cjs_module_export_assignment_number/cjs_module_export_assignment_number/main.out @@ -0,0 +1,3 @@ +5 +5 +[Module: null prototype] { default: 5 } diff --git a/tests/specs/npm_tests/cjs_module_export_assignment_number/cjs_module_export_assignment_number/main.ts b/tests/specs/npm_tests/cjs_module_export_assignment_number/cjs_module_export_assignment_number/main.ts new file mode 100644 index 000000000..aee24bf19 --- /dev/null +++ b/tests/specs/npm_tests/cjs_module_export_assignment_number/cjs_module_export_assignment_number/main.ts @@ -0,0 +1,7 @@ +import defaultImport, * as namespaceImport from "npm:@denotest/cjs-module-export-assignment-number"; + +const testDefault: 5 = defaultImport; +console.log(testDefault); +const testNamespace: 5 = namespaceImport.default; +console.log(testNamespace); +console.log(namespaceImport); 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 000000000..c51f14b56 --- /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/specs/npm_tests/cjs_pkg_imports/cjs_pkg_imports/main.out b/tests/specs/npm_tests/cjs_pkg_imports/cjs_pkg_imports/main.out new file mode 100644 index 000000000..661146bd0 --- /dev/null +++ b/tests/specs/npm_tests/cjs_pkg_imports/cjs_pkg_imports/main.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/cjs-pkg-imports +Download http://localhost:4260/@denotest/cjs-pkg-imports/1.0.0.tgz +{ crypto: Crypto { subtle: SubtleCrypto {} }, number: 5 } diff --git a/tests/specs/npm_tests/cjs_pkg_imports/cjs_pkg_imports/main.ts b/tests/specs/npm_tests/cjs_pkg_imports/cjs_pkg_imports/main.ts new file mode 100644 index 000000000..b30a3f85c --- /dev/null +++ b/tests/specs/npm_tests/cjs_pkg_imports/cjs_pkg_imports/main.ts @@ -0,0 +1,3 @@ +import crypto from "npm:@denotest/cjs-pkg-imports"; + +console.log(crypto); 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 000000000..0b9d1e621 --- /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/specs/npm_tests/cjs_reexport_collision/cjs_reexport_collision/main.out b/tests/specs/npm_tests/cjs_reexport_collision/cjs_reexport_collision/main.out new file mode 100644 index 000000000..ed3193f8d --- /dev/null +++ b/tests/specs/npm_tests/cjs_reexport_collision/cjs_reexport_collision/main.out @@ -0,0 +1 @@ +Hi. diff --git a/tests/specs/npm_tests/cjs_reexport_collision/cjs_reexport_collision/main.ts b/tests/specs/npm_tests/cjs_reexport_collision/cjs_reexport_collision/main.ts new file mode 100644 index 000000000..4bfcd89b1 --- /dev/null +++ b/tests/specs/npm_tests/cjs_reexport_collision/cjs_reexport_collision/main.ts @@ -0,0 +1,2 @@ +import ReExportCollision from "npm:@denotest/cjs-reexport-collision"; +ReExportCollision.default.sayHello(); 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 000000000..172f1ca65 --- /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/specs/npm_tests/cjs_require_esm/cjs_require_esm/main.out b/tests/specs/npm_tests/cjs_require_esm/cjs_require_esm/main.out new file mode 100644 index 000000000..4afceccc9 --- /dev/null +++ b/tests/specs/npm_tests/cjs_require_esm/cjs_require_esm/main.out @@ -0,0 +1,4 @@ +[Module: null prototype] { + Test: [Module: null prototype] { Test: [class Test] }, + default: { Test: [Module: null prototype] { Test: [class Test] } } +} diff --git a/tests/specs/npm_tests/cjs_require_esm/cjs_require_esm/main.ts b/tests/specs/npm_tests/cjs_require_esm/cjs_require_esm/main.ts new file mode 100644 index 000000000..069d4b60e --- /dev/null +++ b/tests/specs/npm_tests/cjs_require_esm/cjs_require_esm/main.ts @@ -0,0 +1,2 @@ +import * as ns from "npm:@denotest/cjs-require-esm"; +console.log(ns); 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 000000000..3a1323127 --- /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/specs/npm_tests/cjs_require_esm_mjs/cjs_require_esm_mjs/main.out b/tests/specs/npm_tests/cjs_require_esm_mjs/cjs_require_esm_mjs/main.out new file mode 100644 index 000000000..4afceccc9 --- /dev/null +++ b/tests/specs/npm_tests/cjs_require_esm_mjs/cjs_require_esm_mjs/main.out @@ -0,0 +1,4 @@ +[Module: null prototype] { + Test: [Module: null prototype] { Test: [class Test] }, + default: { Test: [Module: null prototype] { Test: [class Test] } } +} diff --git a/tests/specs/npm_tests/cjs_require_esm_mjs/cjs_require_esm_mjs/main.ts b/tests/specs/npm_tests/cjs_require_esm_mjs/cjs_require_esm_mjs/main.ts new file mode 100644 index 000000000..d753c2a83 --- /dev/null +++ b/tests/specs/npm_tests/cjs_require_esm_mjs/cjs_require_esm_mjs/main.ts @@ -0,0 +1,2 @@ +import * as ns from "npm:@denotest/cjs-require-esm/require_mjs.js"; +console.log(ns); 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 000000000..dbec76a13 --- /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/specs/npm_tests/cjs_sub_path/cjs_sub_path/main.js b/tests/specs/npm_tests/cjs_sub_path/cjs_sub_path/main.js new file mode 100644 index 000000000..b71360959 --- /dev/null +++ b/tests/specs/npm_tests/cjs_sub_path/cjs_sub_path/main.js @@ -0,0 +1,21 @@ +// this package will require a subpath like "ajv/dist/compile/codegen" +// and also get the parent directory index.js file using require("..") +import Ajv from "npm:ajv@~8.11"; +import addFormats from "npm:ajv-formats@2.1.1"; +import { expect } from "npm:chai@4.3"; + +const ajv = new Ajv(); +addFormats(ajv); + +const schema = { + type: "string", + format: "date", + formatMinimum: "2016-02-06", + formatExclusiveMaximum: "2016-12-27", +}; +const validate = ajv.compile(schema); + +expect(validate("2016-02-06")).to.be.true; +expect(validate("2016-02-05")).to.be.false; + +console.log("Fini"); diff --git a/tests/specs/npm_tests/cjs_sub_path/cjs_sub_path/main.out b/tests/specs/npm_tests/cjs_sub_path/cjs_sub_path/main.out new file mode 100644 index 000000000..868733775 --- /dev/null +++ b/tests/specs/npm_tests/cjs_sub_path/cjs_sub_path/main.out @@ -0,0 +1,35 @@ +[UNORDERED_START] +Download http://localhost:4260/ajv +Download http://localhost:4260/ajv-formats +Download http://localhost:4260/chai +Download http://localhost:4260/fast-deep-equal +Download http://localhost:4260/json-schema-traverse +Download http://localhost:4260/require-from-string +Download http://localhost:4260/uri-js +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/punycode +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ajv/ajv-8.11.0.tgz +Download http://localhost:4260/ajv-formats/ajv-formats-2.1.1.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/check-error/check-error-1.0.2.tgz +Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz +Download http://localhost:4260/fast-deep-equal/fast-deep-equal-3.1.3.tgz +Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz +Download http://localhost:4260/json-schema-traverse/json-schema-traverse-1.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/punycode/punycode-2.1.1.tgz +Download http://localhost:4260/require-from-string/require-from-string-2.0.2.tgz +Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz +Download http://localhost:4260/uri-js/uri-js-4.4.1.tgz +[UNORDERED_END] +Fini 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 000000000..251691ca8 --- /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/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.js b/tests/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.js new file mode 100644 index 000000000..03aaabe05 --- /dev/null +++ b/tests/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.js @@ -0,0 +1,11 @@ +import defaultImport, { getValue } from "npm:@denotest/cjs-this-in-exports"; +import * as namespaceImport from "npm:@denotest/cjs-this-in-exports"; + +console.log(defaultImport.getValue()); +// In Node this actually fails, but it seems to work in Deno +// so I guess there's no harm in that. +console.log(namespaceImport.getValue()); + +// This will throw because it's lost its context. +// (same thing occurs with Node's cjs -> esm translation) +getValue(); diff --git a/tests/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.out b/tests/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.out new file mode 100644 index 000000000..9517015ae --- /dev/null +++ b/tests/specs/npm_tests/cjs_this_in_exports/cjs_this_in_exports/main.out @@ -0,0 +1,5 @@ +1 +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]/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 000000000..d9014f102 --- /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 000000000..568726874 --- /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 000000000..7051c2395 --- /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 000000000..8e37c88eb --- /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 000000000..af1ef1351 --- /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 000000000..1ab367952 --- /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 000000000..d86a76dbc --- /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/specs/npm_tests/compare_globals/compare_globals/main.out b/tests/specs/npm_tests/compare_globals/compare_globals/main.out new file mode 100644 index 000000000..a1b0a566d --- /dev/null +++ b/tests/specs/npm_tests/compare_globals/compare_globals/main.out @@ -0,0 +1,30 @@ +[UNORDERED_START] +Download http://localhost:4260/@types/node +Download http://localhost:4260/undici-types +Download http://localhost:4260/@denotest/globals +[UNORDERED_END] +[UNORDERED_START] +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]/compare_globals/main.ts +true +true +[] +setTimeout 1 false +setTimeout 2 function +setTimeout 3 function +setTimeout 4 function +setTimeout 5 undefined +window 1 false +window 2 false +false +false +self 1 true +self 2 true +false +false +bar +bar +true diff --git a/tests/specs/npm_tests/compare_globals/compare_globals/main.ts b/tests/specs/npm_tests/compare_globals/compare_globals/main.ts new file mode 100644 index 000000000..9482798d8 --- /dev/null +++ b/tests/specs/npm_tests/compare_globals/compare_globals/main.ts @@ -0,0 +1,54 @@ +/// + +import * as globals from "npm:@denotest/globals"; +console.log(globals.global === globals.globalThis); +// @ts-expect-error even though these are the same object, they have different types +console.log(globals.globalThis === globalThis); +console.log(globals.process.execArgv); + +type AssertTrue = never; +type _TestNoProcessGlobal = AssertTrue< + typeof globalThis extends { process: any } ? false : true +>; +type _TestHasNodeJsGlobal = NodeJS.Architecture; + +const controller = new AbortController(); +controller.abort("reason"); // in the NodeJS declaration it doesn't have a reason + +// Some globals are not the same between Node and Deno. +// @ts-expect-error incompatible types between Node and Deno +console.log("setTimeout 1", globalThis.setTimeout === globals.getSetTimeout()); + +// Super edge case where some Node code deletes a global where the +// Node code has its own global and the Deno code has the same global, +// but it's different. Basically if some Node code deletes +// one of these globals then we don't want it to suddenly inherit +// the Deno global (or touch the Deno global at all). +console.log("setTimeout 2", typeof globalThis.setTimeout); +console.log("setTimeout 3", typeof globals.getSetTimeout()); +globals.deleteSetTimeout(); +console.log("setTimeout 4", typeof globalThis.setTimeout); +console.log("setTimeout 5", typeof globals.getSetTimeout()); + +// In Deno 2 and Node.js, the window global is not defined. +console.log("window 1", "window" in globalThis); +console.log( + "window 2", + Object.getOwnPropertyDescriptor(globalThis, "window") !== undefined, +); +globals.checkWindowGlobal(); + +// In Deno 2 self global is defined, but in Node it is not. +console.log("self 1", "self" in globalThis); +console.log( + "self 2", + Object.getOwnPropertyDescriptor(globalThis, "self") !== undefined, +); +globals.checkSelfGlobal(); + +// "Non-managed" globals are shared between Node and Deno. +(globalThis as any).foo = "bar"; +console.log((globalThis as any).foo); +console.log(globals.getFoo()); + +console.log(Reflect.ownKeys(globalThis).includes("console")); // non-enumerable keys are included 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 000000000..40d9ce066 --- /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/specs/npm_tests/create_require/create_require/main.out b/tests/specs/npm_tests/create_require/create_require/main.out new file mode 100644 index 000000000..70b0415b3 --- /dev/null +++ b/tests/specs/npm_tests/create_require/create_require/main.out @@ -0,0 +1,12 @@ +[WILDCARD] +function +function +function +function +function +function +The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received https://example.com/ +The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received https://example.com/ +The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 1 +The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received foo +The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ./foo diff --git a/tests/specs/npm_tests/create_require/create_require/main.ts b/tests/specs/npm_tests/create_require/create_require/main.ts new file mode 100644 index 000000000..625c734aa --- /dev/null +++ b/tests/specs/npm_tests/create_require/create_require/main.ts @@ -0,0 +1 @@ +import "npm:@denotest/create-require@1.0.0"; 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 000000000..93b204c03 --- /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/specs/npm_tests/deno_cache/deno_cache.out b/tests/specs/npm_tests/deno_cache/deno_cache.out new file mode 100644 index 000000000..d723293a8 --- /dev/null +++ b/tests/specs/npm_tests/deno_cache/deno_cache.out @@ -0,0 +1,8 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/mkdirp +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/chalk/chalk-5.0.1.tgz +Download http://localhost:4260/mkdirp/mkdirp-1.0.4.tgz +[UNORDERED_END] 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 000000000..9eb8e9bfe --- /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/specs/npm_tests/deno_run_bin_cjs/deno_run_cjs.out b/tests/specs/npm_tests/deno_run_bin_cjs/deno_run_cjs.out new file mode 100644 index 000000000..ffe7cbd89 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_bin_cjs/deno_run_cjs.out @@ -0,0 +1,4 @@ +this +is +a +test 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 000000000..6ee5a326b --- /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/specs/npm_tests/deno_run_bin_cjs_no_bin_entrypoint/deno_run_cjs.out b/tests/specs/npm_tests/deno_run_bin_cjs_no_bin_entrypoint/deno_run_cjs.out new file mode 100644 index 000000000..ffe7cbd89 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_bin_cjs_no_bin_entrypoint/deno_run_cjs.out @@ -0,0 +1,4 @@ +this +is +a +test 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 000000000..fc48451bb --- /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 000000000..ffe7cbd89 --- /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 000000000..956755b30 --- /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 000000000..ffe7cbd89 --- /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 000000000..71877b399 --- /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 000000000..ffe7cbd89 --- /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 000000000..c3e14c0b7 --- /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 000000000..ffe7cbd89 --- /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 000000000..0015b88be --- /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 000000000..46de82730 --- /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 000000000..1ecce925e --- /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 000000000..46de82730 --- /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 000000000..8671ed1fe --- /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 000000000..46de82730 --- /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 000000000..2acc84e7b --- /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 000000000..8dd990ed6 --- /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 000000000..5331ec9c4 --- /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/specs/npm_tests/deno_run_no_bin_entrypoint/deno_run_no_bin_entrypoint.out b/tests/specs/npm_tests/deno_run_no_bin_entrypoint/deno_run_no_bin_entrypoint.out new file mode 100644 index 000000000..2b885ed59 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_no_bin_entrypoint/deno_run_no_bin_entrypoint.out @@ -0,0 +1 @@ +error: Failed resolving binary export. '[WILDCARD]@denotest[WILDCARD]esm-basic[WILDCARD]package.json' did not have a bin property 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 000000000..3eaa8274c --- /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/specs/npm_tests/deno_run_no_bin_entrypoint_non_existent_subpath/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 new file mode 100644 index 000000000..525fe4b4f --- /dev/null +++ b/tests/specs/npm_tests/deno_run_no_bin_entrypoint_non_existent_subpath/deno_run_no_bin_entrypoint_non_existent_subpath.out @@ -0,0 +1,3 @@ +error: Failed resolving binary export. '[WILDCARD]@denotest[WILDCARD]esm-basic[WILDCARD]package.json' did not have a bin property + +Fallback failed: Cannot find module 'file:///[WILDCARD]/non-existent.js' 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 000000000..72dc01450 --- /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/specs/npm_tests/deno_run_non_existent/deno_run_non_existent.out b/tests/specs/npm_tests/deno_run_non_existent/deno_run_non_existent.out new file mode 100644 index 000000000..247e650e6 --- /dev/null +++ b/tests/specs/npm_tests/deno_run_non_existent/deno_run_non_existent.out @@ -0,0 +1,2 @@ +Download http://localhost:4260/mkdirp +error: Could not find npm package 'mkdirp' matching '0.5.125'. 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 000000000..24587d928 --- /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 000000000..5677eb094 --- /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 000000000..1191247b6 --- /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 000000000..c20425851 --- /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 000000000..0533a992b --- /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 000000000..5677eb094 --- /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 000000000..1191247b6 --- /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 000000000..c20425851 --- /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 000000000..8eb6226d6 --- /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/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_index_js.out b/tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_index_js.out new file mode 100644 index 000000000..a700b8fdb --- /dev/null +++ b/tests/specs/npm_tests/directory_import_folder_index_js/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_index_js/directory_import/folder_index_js.ts b/tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_index_js.ts new file mode 100644 index 000000000..b0d51fcd9 --- /dev/null +++ b/tests/specs/npm_tests/directory_import_folder_index_js/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_index_js/directory_import/folder_no_index.out b/tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_no_index.out new file mode 100644 index 000000000..844419b4c --- /dev/null +++ b/tests/specs/npm_tests/directory_import_folder_index_js/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_index_js/directory_import/folder_no_index.ts b/tests/specs/npm_tests/directory_import_folder_index_js/directory_import/folder_no_index.ts new file mode 100644 index 000000000..4c5fb7ec0 --- /dev/null +++ b/tests/specs/npm_tests/directory_import_folder_index_js/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/directory_import_folder_no_index/__test__.jsonc b/tests/specs/npm_tests/directory_import_folder_no_index/__test__.jsonc new file mode 100644 index 000000000..613747998 --- /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 000000000..a700b8fdb --- /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 000000000..b0d51fcd9 --- /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 000000000..844419b4c --- /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 000000000..4c5fb7ec0 --- /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 000000000..5ace51cec --- /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 000000000..32e232f11 --- /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 000000000..4f3b79667 --- /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 000000000..8dbee51c7 --- /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/specs/npm_tests/dynamic_import_deno_ts_from_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 new file mode 100644 index 000000000..3b399665d --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/add.ts @@ -0,0 +1,3 @@ +export function add(a: number, b: number) { + return a + b; +} diff --git a/tests/specs/npm_tests/dynamic_import_deno_ts_from_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 new file mode 100644 index 000000000..81d7aba8a --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/main.out @@ -0,0 +1,2 @@ +3 +-1 diff --git a/tests/specs/npm_tests/dynamic_import_deno_ts_from_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 new file mode 100644 index 000000000..4d5deec48 --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/main.ts @@ -0,0 +1,8 @@ +import { dynamicImport } from "npm:@denotest/dynamic-import"; + +const { add } = await dynamicImport(new URL("./add.ts", import.meta.url)); +console.log(add(1, 2)); +const { subtract } = await dynamicImport( + new URL("./subtract.mts", import.meta.url), +); +console.log(subtract(1, 2)); diff --git a/tests/specs/npm_tests/dynamic_import_deno_ts_from_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 new file mode 100644 index 000000000..4bf634170 --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_deno_ts_from_npm/dynamic_import_deno_ts_from_npm/subtract.mts @@ -0,0 +1,3 @@ +export function subtract(a: number, b: number) { + return a - b; +} 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 000000000..a15cabf83 --- /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/specs/npm_tests/dynamic_import_invalid_package_name/dynamic_import_invalid_package_name/main.out b/tests/specs/npm_tests/dynamic_import_invalid_package_name/dynamic_import_invalid_package_name/main.out new file mode 100644 index 000000000..414d08795 --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_invalid_package_name/dynamic_import_invalid_package_name/main.out @@ -0,0 +1,6 @@ +Download http://localhost:4260/ws%3A +FAILED +TypeError: npm package 'ws:' does not exist. + at async file:///[WILDCARD]/dynamic_import_invalid_package_name/main.ts:2:3 { + code: "ERR_MODULE_NOT_FOUND" +} diff --git a/tests/specs/npm_tests/dynamic_import_invalid_package_name/dynamic_import_invalid_package_name/main.ts b/tests/specs/npm_tests/dynamic_import_invalid_package_name/dynamic_import_invalid_package_name/main.ts new file mode 100644 index 000000000..368ccc282 --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_invalid_package_name/dynamic_import_invalid_package_name/main.ts @@ -0,0 +1,6 @@ +try { + await import(`npm:${"ws:"}`); +} catch (err) { + console.log("FAILED"); + console.log(err); +} 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 000000000..9b4f5a212 --- /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/specs/npm_tests/dynamic_import_json/import_json/main.js b/tests/specs/npm_tests/dynamic_import_json/import_json/main.js new file mode 100644 index 000000000..ac6cee9a8 --- /dev/null +++ b/tests/specs/npm_tests/dynamic_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/dynamic_import_json/import_json/main.out b/tests/specs/npm_tests/dynamic_import_json/import_json/main.out new file mode 100644 index 000000000..7db7ec4ea --- /dev/null +++ b/tests/specs/npm_tests/dynamic_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/dynamic_import_reload_same_package/__test__.jsonc b/tests/specs/npm_tests/dynamic_import_reload_same_package/__test__.jsonc new file mode 100644 index 000000000..d255b9a87 --- /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/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/main.out b/tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/main.out new file mode 100644 index 000000000..b2f99b465 --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/main.out @@ -0,0 +1,5 @@ +Download http://localhost:4260/chalk +Download http://localhost:4260/chalk/chalk-5.0.1.tgz +Starting... +Ran other. +Finished... diff --git a/tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/main.ts b/tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/main.ts new file mode 100644 index 000000000..7c7ee7d55 --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/main.ts @@ -0,0 +1,7 @@ +import chalk from "npm:chalk@5"; + +console.log(chalk.green("Starting...")); +// non-analyzable +const importName = "./other.ts"; +await import(importName); +console.log(chalk.green("Finished...")); diff --git a/tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/other.ts b/tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/other.ts new file mode 100644 index 000000000..28e3da14f --- /dev/null +++ b/tests/specs/npm_tests/dynamic_import_reload_same_package/dynamic_import_reload_same_package/other.ts @@ -0,0 +1,3 @@ +import chalk from "npm:chalk@5"; + +console.log(chalk.green("Ran other.")); 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 000000000..e65ae0308 --- /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/specs/npm_tests/env_var_re_export_dev/env_var_re_export/main.js b/tests/specs/npm_tests/env_var_re_export_dev/env_var_re_export/main.js new file mode 100644 index 000000000..ed91487a0 --- /dev/null +++ b/tests/specs/npm_tests/env_var_re_export_dev/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/env_var_re_export_prod/__test__.jsonc b/tests/specs/npm_tests/env_var_re_export_prod/__test__.jsonc new file mode 100644 index 000000000..6c206ba3e --- /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 000000000..ed91487a0 --- /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 000000000..157e238d8 --- /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/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.js b/tests/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.js new file mode 100644 index 000000000..77c7a017c --- /dev/null +++ b/tests/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.js @@ -0,0 +1 @@ +import "npm:react-dom/server@18.2.0"; diff --git a/tests/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.out b/tests/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.out new file mode 100644 index 000000000..4e5f03e23 --- /dev/null +++ b/tests/specs/npm_tests/error_version_after_subpath/error_version_after_subpath/main.out @@ -0,0 +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]/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 000000000..9b4f5a212 --- /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 000000000..ac6cee9a8 --- /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 000000000..7db7ec4ea --- /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 000000000..822acbbe4 --- /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/specs/npm_tests/import_map/import_map/import_map.json b/tests/specs/npm_tests/import_map/import_map/import_map.json new file mode 100644 index 000000000..1c3baacd1 --- /dev/null +++ b/tests/specs/npm_tests/import_map/import_map/import_map.json @@ -0,0 +1,6 @@ +{ + "imports": { + "chalk": "npm:chalk@5", + "@denotest/": "npm:/@denotest/dual-cjs-esm/" + } +} diff --git a/tests/specs/npm_tests/import_map/import_map/main.js b/tests/specs/npm_tests/import_map/import_map/main.js new file mode 100644 index 000000000..e354b7e92 --- /dev/null +++ b/tests/specs/npm_tests/import_map/import_map/main.js @@ -0,0 +1,10 @@ +import chalk from "chalk"; +import { getSubPathKind } from "@denotest/subpath/main.mjs"; + +console.log(chalk.green("chalk import map loads")); + +export function test(value) { + return chalk.red(value); +} + +console.log(getSubPathKind()); diff --git a/tests/specs/npm_tests/import_map/import_map/main.out b/tests/specs/npm_tests/import_map/import_map/main.out new file mode 100644 index 000000000..05f313d4e --- /dev/null +++ b/tests/specs/npm_tests/import_map/import_map/main.out @@ -0,0 +1,10 @@ +[UNORDERED_START] +Download http://localhost:4260/chalk +Download http://localhost:4260/@denotest/dual-cjs-esm +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/@denotest/dual-cjs-esm/1.0.0.tgz +Download http://localhost:4260/chalk/chalk-5.0.1.tgz +[UNORDERED_END] +chalk import map loads +esm 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 000000000..e11b92132 --- /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/specs/npm_tests/imports_package_json/imports_package_json/import_not_defined.js b/tests/specs/npm_tests/imports_package_json/imports_package_json/import_not_defined.js new file mode 100644 index 000000000..dc4d2df16 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json/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/imports_package_json/import_not_defined.out b/tests/specs/npm_tests/imports_package_json/imports_package_json/import_not_defined.out new file mode 100644 index 000000000..70d1145a3 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json/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/imports_package_json/main.js b/tests/specs/npm_tests/imports_package_json/imports_package_json/main.js new file mode 100644 index 000000000..53090dd94 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json/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/imports_package_json/main.out b/tests/specs/npm_tests/imports_package_json/imports_package_json/main.out new file mode 100644 index 000000000..979e35576 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json/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/imports_package_json/package.json b/tests/specs/npm_tests/imports_package_json/imports_package_json/package.json new file mode 100644 index 000000000..cb6a08d1a --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json/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/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 new file mode 100644 index 000000000..f1097aa06 --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json/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/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 new file mode 100644 index 000000000..7c803f2bf --- /dev/null +++ b/tests/specs/npm_tests/imports_package_json/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_import_not_defined/__test__.jsonc b/tests/specs/npm_tests/imports_package_json_import_not_defined/__test__.jsonc new file mode 100644 index 000000000..0f094838c --- /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 000000000..dc4d2df16 --- /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 000000000..70d1145a3 --- /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 000000000..53090dd94 --- /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 000000000..979e35576 --- /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 000000000..cb6a08d1a --- /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 000000000..f1097aa06 --- /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 000000000..7c803f2bf --- /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 000000000..f862dc58e --- /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 000000000..dc4d2df16 --- /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 000000000..70d1145a3 --- /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 000000000..53090dd94 --- /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 000000000..979e35576 --- /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 000000000..cb6a08d1a --- /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 000000000..f1097aa06 --- /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 000000000..7c803f2bf --- /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 000000000..998aa6f1d --- /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 000000000..568726874 --- /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 000000000..7051c2395 --- /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 000000000..8e37c88eb --- /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 000000000..af1ef1351 --- /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 000000000..1ab367952 --- /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 000000000..5dd35f5a4 --- /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 000000000..568726874 --- /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 000000000..7051c2395 --- /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 000000000..8e37c88eb --- /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 000000000..af1ef1351 --- /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 000000000..1ab367952 --- /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 000000000..12c8b9b61 --- /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 000000000..568726874 --- /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 000000000..7051c2395 --- /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 000000000..8e37c88eb --- /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 000000000..af1ef1351 --- /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 000000000..1ab367952 --- /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 000000000..1b34f4813 --- /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 000000000..568726874 --- /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 000000000..7051c2395 --- /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 000000000..8e37c88eb --- /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 000000000..af1ef1351 --- /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 000000000..1ab367952 --- /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 000000000..7587fbcb6 --- /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/specs/npm_tests/info_cli_chalk_display/info/chalk.out b/tests/specs/npm_tests/info_cli_chalk_display/info/chalk.out new file mode 100644 index 000000000..63fa20da5 --- /dev/null +++ b/tests/specs/npm_tests/info_cli_chalk_display/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_display/info/chalk_json.out b/tests/specs/npm_tests/info_cli_chalk_display/info/chalk_json.out new file mode 100644 index 000000000..d54155270 --- /dev/null +++ b/tests/specs/npm_tests/info_cli_chalk_display/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_cli_chalk_json/__test__.jsonc b/tests/specs/npm_tests/info_cli_chalk_json/__test__.jsonc new file mode 100644 index 000000000..b5173fd93 --- /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 000000000..63fa20da5 --- /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 000000000..d54155270 --- /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 000000000..e505f3077 --- /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 000000000..3c133bcde --- /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 000000000..a8ea8104a --- /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 000000000..e8b92399d --- /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 000000000..1a5f07c97 --- /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 000000000..02b5cbafd --- /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 000000000..9c8145211 --- /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 000000000..9a630add4 --- /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 000000000..3c133bcde --- /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 000000000..a8ea8104a --- /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 000000000..e8b92399d --- /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 000000000..1a5f07c97 --- /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 000000000..02b5cbafd --- /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 000000000..9c8145211 --- /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 000000000..cc9359aab --- /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/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/global.out b/tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/global.out new file mode 100644 index 000000000..fdacea385 --- /dev/null +++ b/tests/specs/npm_tests/mixed_case_package_name_global_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_global_dir/mixed_case_package_name/global.ts b/tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/global.ts new file mode 100644 index 000000000..a721b3d78 --- /dev/null +++ b/tests/specs/npm_tests/mixed_case_package_name_global_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_global_dir/mixed_case_package_name/local.out b/tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/local.out new file mode 100644 index 000000000..6ab989d80 --- /dev/null +++ b/tests/specs/npm_tests/mixed_case_package_name_global_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_global_dir/mixed_case_package_name/local.ts b/tests/specs/npm_tests/mixed_case_package_name_global_dir/mixed_case_package_name/local.ts new file mode 100644 index 000000000..6ca6cb581 --- /dev/null +++ b/tests/specs/npm_tests/mixed_case_package_name_global_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/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 000000000..0778cb562 --- /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 000000000..fdacea385 --- /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 000000000..a721b3d78 --- /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 000000000..6ab989d80 --- /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 000000000..6ca6cb581 --- /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 000000000..377fd05ea --- /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/specs/npm_tests/node_modules_deno_node_modules/node_modules_deno_node_modules/main.out b/tests/specs/npm_tests/node_modules_deno_node_modules/node_modules_deno_node_modules/main.out new file mode 100644 index 000000000..1ebdb2dd5 --- /dev/null +++ b/tests/specs/npm_tests/node_modules_deno_node_modules/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/node_modules_deno_node_modules/main.ts b/tests/specs/npm_tests/node_modules_deno_node_modules/node_modules_deno_node_modules/main.ts new file mode 100644 index 000000000..6e4a32d8e --- /dev/null +++ b/tests/specs/npm_tests/node_modules_deno_node_modules/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_deno_node_modules_local/__test__.jsonc b/tests/specs/npm_tests/node_modules_deno_node_modules_local/__test__.jsonc new file mode 100644 index 000000000..a1e67b32b --- /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 000000000..1ebdb2dd5 --- /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 000000000..6e4a32d8e --- /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 000000000..5813bb3f2 --- /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/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/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 new file mode 100644 index 000000000..723b2023a --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/require_added_nm_folder/main.js @@ -0,0 +1,10 @@ +import { getValue } from "npm:@denotest/require-added-nm-folder"; + +Deno.mkdirSync("./node_modules/.other-package"); +Deno.writeTextFileSync("./node_modules/.other-package/package.json", "{}"); +Deno.writeTextFileSync( + "./node_modules/.other-package/index.js", + "exports.get = () => 5;", +); + +console.log(getValue()); diff --git a/tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/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 new file mode 100644 index 000000000..7ed6ff82d --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_require_added_node_modules_folder/require_added_nm_folder/main.out @@ -0,0 +1 @@ +5 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 000000000..45936f1de --- /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/specs/npm_tests/node_modules_dir_require_main_entry/require_main/main.js b/tests/specs/npm_tests/node_modules_dir_require_main_entry/require_main/main.js new file mode 100644 index 000000000..ddecd4fdb --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_require_main_entry/require_main/main.js @@ -0,0 +1,2 @@ +import fraction from "npm:autoprefixer"; +console.log(typeof fraction); diff --git a/tests/specs/npm_tests/node_modules_dir_require_main_entry/require_main/main.out b/tests/specs/npm_tests/node_modules_dir_require_main_entry/require_main/main.out new file mode 100644 index 000000000..e2dbde096 --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_require_main_entry/require_main/main.out @@ -0,0 +1 @@ +function 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 000000000..ae79e8a47 --- /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 000000000..568726874 --- /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 000000000..7051c2395 --- /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 000000000..bcaaf1eec --- /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 000000000..af1ef1351 --- /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 000000000..1ab367952 --- /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 000000000..8aa139a51 --- /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/specs/npm_tests/node_modules_dir_yargs/cjs_yargs/main.js b/tests/specs/npm_tests/node_modules_dir_yargs/cjs_yargs/main.js new file mode 100644 index 000000000..832fd053c --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_yargs/cjs_yargs/main.js @@ -0,0 +1,20 @@ +import yargs from "npm:yargs@15.4.1"; + +const args = yargs(["serve", "8000"]) + .command("serve [port]", "start the server", (yargs) => { + return yargs + .positional("port", { + describe: "port to bind on", + default: 5000, + }); + }, (argv) => { + console.info(`start server on :${argv.port}`); + }) + .option("verbose", { + alias: "v", + type: "boolean", + description: "Run with verbose logging", + }) + .argv; + +console.log(args); diff --git a/tests/specs/npm_tests/node_modules_dir_yargs/cjs_yargs/main.out b/tests/specs/npm_tests/node_modules_dir_yargs/cjs_yargs/main.out new file mode 100644 index 000000000..938d7a771 --- /dev/null +++ b/tests/specs/npm_tests/node_modules_dir_yargs/cjs_yargs/main.out @@ -0,0 +1,84 @@ +[UNORDERED_START] +Download http://localhost:4260/yargs +Download http://localhost:4260/cliui +Download http://localhost:4260/decamelize +Download http://localhost:4260/find-up +Download http://localhost:4260/get-caller-file +Download http://localhost:4260/require-directory +Download http://localhost:4260/require-main-filename +Download http://localhost:4260/set-blocking +Download http://localhost:4260/string-width +Download http://localhost:4260/which-module +Download http://localhost:4260/y18n +Download http://localhost:4260/yargs-parser +Download http://localhost:4260/strip-ansi +Download http://localhost:4260/wrap-ansi +Download http://localhost:4260/locate-path +Download http://localhost:4260/path-exists +Download http://localhost:4260/emoji-regex +Download http://localhost:4260/is-fullwidth-code-point +Download http://localhost:4260/camelcase +Download http://localhost:4260/ansi-regex +Download http://localhost:4260/ansi-styles +Download http://localhost:4260/p-locate +Download http://localhost:4260/color-convert +Download http://localhost:4260/p-limit +Download http://localhost:4260/color-name +Download http://localhost:4260/p-try +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/ansi-regex/ansi-regex-5.0.1.tgz +Initialize ansi-regex@5.0.1 +Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz +Initialize ansi-styles@4.3.0 +Download http://localhost:4260/camelcase/camelcase-5.3.1.tgz +Initialize camelcase@5.3.1 +Download http://localhost:4260/cliui/cliui-6.0.0.tgz +Initialize cliui@6.0.0 +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/decamelize/decamelize-1.2.0.tgz +Initialize decamelize@1.2.0 +Download http://localhost:4260/emoji-regex/emoji-regex-8.0.0.tgz +Initialize emoji-regex@8.0.0 +Download http://localhost:4260/find-up/find-up-4.1.0.tgz +Initialize find-up@4.1.0 +Download http://localhost:4260/get-caller-file/get-caller-file-2.0.5.tgz +Initialize get-caller-file@2.0.5 +Download http://localhost:4260/is-fullwidth-code-point/is-fullwidth-code-point-3.0.0.tgz +Initialize is-fullwidth-code-point@3.0.0 +Download http://localhost:4260/locate-path/locate-path-5.0.0.tgz +Initialize locate-path@5.0.0 +Download http://localhost:4260/p-limit/p-limit-2.3.0.tgz +Initialize p-limit@2.3.0 +Download http://localhost:4260/p-locate/p-locate-4.1.0.tgz +Initialize p-locate@4.1.0 +Download http://localhost:4260/p-try/p-try-2.2.0.tgz +Initialize p-try@2.2.0 +Download http://localhost:4260/path-exists/path-exists-4.0.0.tgz +Initialize path-exists@4.0.0 +Download http://localhost:4260/require-directory/require-directory-2.1.1.tgz +Initialize require-directory@2.1.1 +Download http://localhost:4260/require-main-filename/require-main-filename-2.0.0.tgz +Initialize require-main-filename@2.0.0 +Download http://localhost:4260/set-blocking/set-blocking-2.0.0.tgz +Initialize set-blocking@2.0.0 +Download http://localhost:4260/string-width/string-width-4.2.3.tgz +Initialize string-width@4.2.3 +Download http://localhost:4260/strip-ansi/strip-ansi-6.0.1.tgz +Initialize strip-ansi@6.0.1 +Download http://localhost:4260/which-module/which-module-2.0.0.tgz +Initialize which-module@2.0.0 +Download http://localhost:4260/wrap-ansi/wrap-ansi-6.2.0.tgz +Initialize wrap-ansi@6.2.0 +Download http://localhost:4260/y18n/y18n-4.0.3.tgz +Initialize y18n@4.0.3 +Download http://localhost:4260/yargs/yargs-15.4.1.tgz +Initialize yargs@15.4.1 +Download http://localhost:4260/yargs-parser/yargs-parser-18.1.3.tgz +Initialize yargs-parser@18.1.3 +[UNORDERED_END] +start server on :8000 +[WILDCARD] 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 000000000..a43708421 --- /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 000000000..19cd713e2 --- /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 000000000..efbda98d2 --- /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/specs/npm_tests/nonexistent_file/nonexistent_file/main.js b/tests/specs/npm_tests/nonexistent_file/nonexistent_file/main.js new file mode 100644 index 000000000..c480b0548 --- /dev/null +++ b/tests/specs/npm_tests/nonexistent_file/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/nonexistent_file/main.out b/tests/specs/npm_tests/nonexistent_file/nonexistent_file/main.out new file mode 100644 index 000000000..baa79b1ce --- /dev/null +++ b/tests/specs/npm_tests/nonexistent_file/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/nonexistent_file_node_modules_dir/__test__.jsonc b/tests/specs/npm_tests/nonexistent_file_node_modules_dir/__test__.jsonc new file mode 100644 index 000000000..28da47300 --- /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 000000000..c480b0548 --- /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 000000000..baa79b1ce --- /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 000000000..58f917f73 --- /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/specs/npm_tests/permissions_outside_package/permissions_outside_package/foo/config.js b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/foo/config.js new file mode 100644 index 000000000..e667790d2 --- /dev/null +++ b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/foo/config.js @@ -0,0 +1,4 @@ +module.exports = { + "name": "foobar", + "version": "0.0.1", +}; diff --git a/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/foo/package.json b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/foo/package.json new file mode 100644 index 000000000..cc049e6ce --- /dev/null +++ b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/foo/package.json @@ -0,0 +1,4 @@ +{ + "name": "foobar", + "version": "0.0.1" +} diff --git a/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.out b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.out new file mode 100644 index 000000000..089f329c4 --- /dev/null +++ b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/permissions-outside-package +Download http://localhost:4260/@denotest/permissions-outside-package/1.0.0.tgz +{ name: "foobar", version: "0.0.1" } diff --git a/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.ts b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.ts new file mode 100644 index 000000000..934a3eebc --- /dev/null +++ b/tests/specs/npm_tests/permissions_outside_package/permissions_outside_package/main.ts @@ -0,0 +1,5 @@ +import { loadConfigFile } from "npm:@denotest/permissions-outside-package"; + +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 000000000..416024f0c --- /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/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/main.out b/tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/main.out new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/main.out @@ -0,0 +1 @@ +test 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 000000000..ea9442059 --- /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/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/remote.ts b/tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/remote.ts new file mode 100644 index 000000000..923ed3ed8 --- /dev/null +++ b/tests/specs/npm_tests/remote_npm_specifier/remote_npm_specifier/remote.ts @@ -0,0 +1,3 @@ +import chalk from "npm:chalk"; + +console.log(chalk.green("test")); 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 000000000..83859c8f1 --- /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 000000000..0613f1911 --- /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 000000000..aab0d5c28 --- /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 000000000..67ac808f0 --- /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 000000000..43af6230f --- /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/specs/npm_tests/require_json/require_json/main.js b/tests/specs/npm_tests/require_json/require_json/main.js new file mode 100644 index 000000000..d11e85305 --- /dev/null +++ b/tests/specs/npm_tests/require_json/require_json/main.js @@ -0,0 +1,2 @@ +import globals from "npm:globals@13.17.0"; +console.log(globals); diff --git a/tests/specs/npm_tests/require_json/require_json/main.out b/tests/specs/npm_tests/require_json/require_json/main.out new file mode 100644 index 000000000..97db68e1b --- /dev/null +++ b/tests/specs/npm_tests/require_json/require_json/main.out @@ -0,0 +1,3 @@ +[WILDCARD] + devtools: { +[WILDCARD] \ No newline at end of file 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 000000000..d2f6ae7c2 --- /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/specs/npm_tests/reserved_word_exports/reserved_word_exports/main.out b/tests/specs/npm_tests/reserved_word_exports/reserved_word_exports/main.out new file mode 100644 index 000000000..ccfd35bc8 --- /dev/null +++ b/tests/specs/npm_tests/reserved_word_exports/reserved_word_exports/main.out @@ -0,0 +1,141 @@ +Download http://localhost:4260/@denotest/reserved-word-exports +Download http://localhost:4260/@denotest/reserved-word-exports/1.0.0.tgz +[Module: null prototype] { + abstract: "abstract", + arguments: "arguments", + async: "async", + await: "await", + boolean: "boolean", + break: "break", + byte: "byte", + case: "case", + catch: "catch", + char: "char", + class: "class", + const: "const", + continue: "continue", + debugger: "debugger", + default: { + abstract: "abstract", + arguments: "arguments", + async: "async", + await: "await", + boolean: "boolean", + break: "break", + byte: "byte", + case: "case", + catch: "catch", + char: "char", + class: "class", + const: "const", + continue: "continue", + debugger: "debugger", + default: "default", + delete: "delete", + do: "do", + double: "double", + else: "else", + enum: "enum", + eval: "eval", + export: "export", + extends: "extends", + false: "false", + final: "final", + finally: "finally", + float: "float", + for: "for", + function: "function", + get: "get", + goto: "goto", + if: "if", + implements: "implements", + import: "import", + in: "in", + instanceof: "instanceof", + int: "int", + interface: "interface", + let: "let", + long: "long", + mod: "mod", + native: "native", + new: "new", + null: "null", + package: "package", + private: "private", + protected: "protected", + public: "public", + return: "return", + set: "set", + short: "short", + static: "static", + super: "super", + switch: "switch", + synchronized: "synchronized", + this: "this", + throw: "throw", + throws: "throws", + transient: "transient", + true: "true", + try: "try", + typeof: "typeof", + var: "var", + void: "void", + volatile: "volatile", + while: "while", + with: "with", + yield: "yield" + }, + delete: "delete", + do: "do", + double: "double", + else: "else", + enum: "enum", + eval: "eval", + export: "export", + extends: "extends", + false: "false", + final: "final", + finally: "finally", + float: "float", + for: "for", + function: "function", + get: "get", + goto: "goto", + if: "if", + implements: "implements", + import: "import", + in: "in", + instanceof: "instanceof", + int: "int", + interface: "interface", + let: "let", + long: "long", + mod: "mod", + native: "native", + new: "new", + null: "null", + package: "package", + private: "private", + protected: "protected", + public: "public", + return: "return", + set: "set", + short: "short", + static: "static", + super: "super", + switch: "switch", + synchronized: "synchronized", + this: "this", + throw: "throw", + throws: "throws", + transient: "transient", + true: "true", + try: "try", + typeof: "typeof", + var: "var", + void: "void", + volatile: "volatile", + while: "while", + with: "with", + yield: "yield" +} diff --git a/tests/specs/npm_tests/reserved_word_exports/reserved_word_exports/main.ts b/tests/specs/npm_tests/reserved_word_exports/reserved_word_exports/main.ts new file mode 100644 index 000000000..33cf183d3 --- /dev/null +++ b/tests/specs/npm_tests/reserved_word_exports/reserved_word_exports/main.ts @@ -0,0 +1,3 @@ +import * as exports from "npm:@denotest/reserved-word-exports"; + +console.log(exports); 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 000000000..bc76b00be --- /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/specs/npm_tests/run_existing_npm_package_with_subpath/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 new file mode 100644 index 000000000..f6ee03ef1 --- /dev/null +++ b/tests/specs/npm_tests/run_existing_npm_package_with_subpath/run_existing_npm_package_with_subpath/main.out @@ -0,0 +1,5 @@ +Download http://localhost:4260/@denotest/bin +Download http://localhost:4260/@denotest/bin/1.0.0.tgz +Initialize @denotest/bin@1.0.0 +dev +--help diff --git a/tests/specs/npm_tests/run_existing_npm_package_with_subpath/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 new file mode 100644 index 000000000..e9a7e84ce --- /dev/null +++ b/tests/specs/npm_tests/run_existing_npm_package_with_subpath/run_existing_npm_package_with_subpath/package.json @@ -0,0 +1,6 @@ +{ + "name": "run-existing-npm-package", + "dependencies": { + "@denotest/bin": "1.0.0" + } +} 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 000000000..88ccbc3ac --- /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/specs/npm_tests/sub_paths/sub_paths/main.jsx b/tests/specs/npm_tests/sub_paths/sub_paths/main.jsx new file mode 100644 index 000000000..0c712b9ff --- /dev/null +++ b/tests/specs/npm_tests/sub_paths/sub_paths/main.jsx @@ -0,0 +1,8 @@ +import React from "npm:react@18.2.0"; +import { renderToString } from "npm:react-dom@18.2.0/server"; + +function App({ name }) { + return
Hello {name}!
; +} + +console.log(renderToString()); diff --git a/tests/specs/npm_tests/sub_paths/sub_paths/main.out b/tests/specs/npm_tests/sub_paths/sub_paths/main.out new file mode 100644 index 000000000..f034585a7 --- /dev/null +++ b/tests/specs/npm_tests/sub_paths/sub_paths/main.out @@ -0,0 +1 @@ +
Hello World!
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 000000000..7cf4a6083 --- /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/specs/npm_tests/tarball_with_global_header/tarball_with_global_header/main.js b/tests/specs/npm_tests/tarball_with_global_header/tarball_with_global_header/main.js new file mode 100644 index 000000000..d1bb40fbc --- /dev/null +++ b/tests/specs/npm_tests/tarball_with_global_header/tarball_with_global_header/main.js @@ -0,0 +1,3 @@ +import { Client } from "npm:ssh2"; + +console.log(Client); diff --git a/tests/specs/npm_tests/tarball_with_global_header/tarball_with_global_header/main.out b/tests/specs/npm_tests/tarball_with_global_header/tarball_with_global_header/main.out new file mode 100644 index 000000000..ff211087b --- /dev/null +++ b/tests/specs/npm_tests/tarball_with_global_header/tarball_with_global_header/main.out @@ -0,0 +1 @@ +[class Client extends EventEmitter] 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 000000000..e1344493c --- /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/specs/npm_tests/translate_cjs_to_esm/translate_cjs_to_esm/main.js b/tests/specs/npm_tests/translate_cjs_to_esm/translate_cjs_to_esm/main.js new file mode 100644 index 000000000..04a86fbf1 --- /dev/null +++ b/tests/specs/npm_tests/translate_cjs_to_esm/translate_cjs_to_esm/main.js @@ -0,0 +1,6 @@ +import fsx from "npm:fs-extra@10.1.0"; +import { createApp } from "npm:vue"; +import "npm:@denotest/cjs-with-file-stem"; + +console.log(fsx.access); +console.log(createApp); diff --git a/tests/specs/npm_tests/translate_cjs_to_esm/translate_cjs_to_esm/main.out b/tests/specs/npm_tests/translate_cjs_to_esm/translate_cjs_to_esm/main.out new file mode 100644 index 000000000..c21a965b8 --- /dev/null +++ b/tests/specs/npm_tests/translate_cjs_to_esm/translate_cjs_to_esm/main.out @@ -0,0 +1,4 @@ +hello +world +[Function: access] +[Function: createApp] 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 000000000..fc60b3433 --- /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/specs/npm_tests/types_ambient_module/types_ambient_module/import_map.json b/tests/specs/npm_tests/types_ambient_module/types_ambient_module/import_map.json new file mode 100644 index 000000000..f61d99b47 --- /dev/null +++ b/tests/specs/npm_tests/types_ambient_module/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/types_ambient_module/main.out b/tests/specs/npm_tests/types_ambient_module/types_ambient_module/main.out new file mode 100644 index 000000000..c84130707 --- /dev/null +++ b/tests/specs/npm_tests/types_ambient_module/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/types_ambient_module/main.ts b/tests/specs/npm_tests/types_ambient_module/types_ambient_module/main.ts new file mode 100644 index 000000000..8f77cabe8 --- /dev/null +++ b/tests/specs/npm_tests/types_ambient_module/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/types_ambient_module/main_import_map.out b/tests/specs/npm_tests/types_ambient_module/types_ambient_module/main_import_map.out new file mode 100644 index 000000000..548f9b479 --- /dev/null +++ b/tests/specs/npm_tests/types_ambient_module/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/types_ambient_module/main_import_map.ts b/tests/specs/npm_tests/types_ambient_module/types_ambient_module/main_import_map.ts new file mode 100644 index 000000000..2694c94b7 --- /dev/null +++ b/tests/specs/npm_tests/types_ambient_module/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_ambient_module_import_map/__test__.jsonc b/tests/specs/npm_tests/types_ambient_module_import_map/__test__.jsonc new file mode 100644 index 000000000..2e8c9b60b --- /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 000000000..f61d99b47 --- /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 000000000..c84130707 --- /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 000000000..8f77cabe8 --- /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 000000000..548f9b479 --- /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 000000000..2694c94b7 --- /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 000000000..daa0f26ff --- /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/specs/npm_tests/types_d_ext/d_ext/main.out b/tests/specs/npm_tests/types_d_ext/d_ext/main.out new file mode 100644 index 000000000..e99df6696 --- /dev/null +++ b/tests/specs/npm_tests/types_d_ext/d_ext/main.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/d-ext +Download http://localhost:4260/@denotest/d-ext/1.0.0.tgz +Check file:///[WILDCARD]/d_ext/main.ts diff --git a/tests/specs/npm_tests/types_d_ext/d_ext/main.ts b/tests/specs/npm_tests/types_d_ext/d_ext/main.ts new file mode 100644 index 000000000..c92dbe065 --- /dev/null +++ b/tests/specs/npm_tests/types_d_ext/d_ext/main.ts @@ -0,0 +1,3 @@ +import { test } from "npm:@denotest/d-ext"; + +console.log(test); 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 000000000..1c2e8735f --- /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/specs/npm_tests/types_entry_value_not_exists/types_entry_value_not_exists/main.out b/tests/specs/npm_tests/types_entry_value_not_exists/types_entry_value_not_exists/main.out new file mode 100644 index 000000000..017a17ea2 --- /dev/null +++ b/tests/specs/npm_tests/types_entry_value_not_exists/types_entry_value_not_exists/main.out @@ -0,0 +1,7 @@ +Download http://localhost:4260/@denotest/types-entry-value-not-exists +Download http://localhost:4260/@denotest/types-entry-value-not-exists/1.0.0.tgz +Check file://[WILDCARD]/types_entry_value_not_exists/main.ts +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const result: string = getValue(); + ~~~~~~ + at file:///[WILDCARD]/main.ts:4:7 diff --git a/tests/specs/npm_tests/types_entry_value_not_exists/types_entry_value_not_exists/main.ts b/tests/specs/npm_tests/types_entry_value_not_exists/types_entry_value_not_exists/main.ts new file mode 100644 index 000000000..04374ef87 --- /dev/null +++ b/tests/specs/npm_tests/types_entry_value_not_exists/types_entry_value_not_exists/main.ts @@ -0,0 +1,5 @@ +import { getValue } from "npm:@denotest/types-entry-value-not-exists"; + +// should error here +const result: string = getValue(); +console.log(result); 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 000000000..fbb6a918a --- /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/specs/npm_tests/types_exports_import_types/types_exports_import_types/main.out b/tests/specs/npm_tests/types_exports_import_types/types_exports_import_types/main.out new file mode 100644 index 000000000..10f9425ca --- /dev/null +++ b/tests/specs/npm_tests/types_exports_import_types/types_exports_import_types/main.out @@ -0,0 +1,7 @@ +Download http://localhost:4260/@denotest/types-exports-import-types +Download http://localhost:4260/@denotest/types-exports-import-types/1.0.0.tgz +Check file://[WILDCARD]/types_exports_import_types/main.ts +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const result: string = getValue(); + ~~~~~~ + at file:///[WILDCARD]/main.ts:4:7 diff --git a/tests/specs/npm_tests/types_exports_import_types/types_exports_import_types/main.ts b/tests/specs/npm_tests/types_exports_import_types/types_exports_import_types/main.ts new file mode 100644 index 000000000..3ae3e92a3 --- /dev/null +++ b/tests/specs/npm_tests/types_exports_import_types/types_exports_import_types/main.ts @@ -0,0 +1,5 @@ +import { getValue } from "npm:@denotest/types-exports-import-types"; + +// should error here +const result: string = getValue(); +console.log(result); 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 000000000..bae02f3a8 --- /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/specs/npm_tests/types_no_types_entry/types_no_types_entry/main.out b/tests/specs/npm_tests/types_no_types_entry/types_no_types_entry/main.out new file mode 100644 index 000000000..53e872eaf --- /dev/null +++ b/tests/specs/npm_tests/types_no_types_entry/types_no_types_entry/main.out @@ -0,0 +1,13 @@ +[UNORDERED_START] +Download http://localhost:4260/@denotest/types-no-types-entry +Download http://localhost:4260/@denotest/types-entry-value-not-exists +[UNORDERED_END] +[UNORDERED_START] +Download http://localhost:4260/@denotest/types-entry-value-not-exists/1.0.0.tgz +Download http://localhost:4260/@denotest/types-no-types-entry/1.0.0.tgz +[UNORDERED_END] +Check file://[WILDCARD]/types_no_types_entry/main.ts +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const result: string = getValue(); + ~~~~~~ + at file:///[WILDCARD]/main.ts:4:7 diff --git a/tests/specs/npm_tests/types_no_types_entry/types_no_types_entry/main.ts b/tests/specs/npm_tests/types_no_types_entry/types_no_types_entry/main.ts new file mode 100644 index 000000000..eef53b681 --- /dev/null +++ b/tests/specs/npm_tests/types_no_types_entry/types_no_types_entry/main.ts @@ -0,0 +1,5 @@ +import { getValue } from "npm:@denotest/types-no-types-entry"; + +// should error here +const result: string = getValue(); +console.log(result); 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 000000000..c5bd61ca2 --- /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/specs/npm_tests/typescript_file_in_package/typescript_file_in_package/main.out b/tests/specs/npm_tests/typescript_file_in_package/typescript_file_in_package/main.out new file mode 100644 index 000000000..3c3b97190 --- /dev/null +++ b/tests/specs/npm_tests/typescript_file_in_package/typescript_file_in_package/main.out @@ -0,0 +1,6 @@ +Download http://localhost:4260/@denotest/typescript-file +Download http://localhost:4260/@denotest/typescript-file/1.0.0.tgz +error: Could not resolve 'npm:@denotest/typescript-file@1.0.0'. + +Caused by: + TypeScript files are not supported in npm packages: file:///[WILDCARD]/@denotest/typescript-file/1.0.0/index.ts diff --git a/tests/specs/npm_tests/typescript_file_in_package/typescript_file_in_package/main.ts b/tests/specs/npm_tests/typescript_file_in_package/typescript_file_in_package/main.ts new file mode 100644 index 000000000..aefc38ebe --- /dev/null +++ b/tests/specs/npm_tests/typescript_file_in_package/typescript_file_in_package/main.ts @@ -0,0 +1,5 @@ +// We don't support typescript files in npm packages because we don't +// want to encourage people distributing npm packages that aren't JavaScript. +import { getValue } from "npm:@denotest/typescript-file"; + +console.log(getValue()); diff --git a/tests/testdata/npm/builtin_module_module/main.js b/tests/testdata/npm/builtin_module_module/main.js deleted file mode 100644 index 9a036791b..000000000 --- a/tests/testdata/npm/builtin_module_module/main.js +++ /dev/null @@ -1 +0,0 @@ -import "npm:@denotest/builtin-module-module"; diff --git a/tests/testdata/npm/builtin_module_module/main.out b/tests/testdata/npm/builtin_module_module/main.out deleted file mode 100644 index 160ba6503..000000000 --- a/tests/testdata/npm/builtin_module_module/main.out +++ /dev/null @@ -1,4 +0,0 @@ -function -function -function -true diff --git a/tests/testdata/npm/check_errors/main.ts b/tests/testdata/npm/check_errors/main.ts deleted file mode 100644 index 4b8684195..000000000 --- a/tests/testdata/npm/check_errors/main.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as test from "npm:@denotest/check-error"; - -console.log(test.Asdf); // should error diff --git a/tests/testdata/npm/check_errors/main_all.out b/tests/testdata/npm/check_errors/main_all.out deleted file mode 100644 index 4c624c0ea..000000000 --- a/tests/testdata/npm/check_errors/main_all.out +++ /dev/null @@ -1,19 +0,0 @@ -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/testdata/npm/check_errors/main_local.out b/tests/testdata/npm/check_errors/main_local.out deleted file mode 100644 index 4d3a892e7..000000000 --- a/tests/testdata/npm/check_errors/main_local.out +++ /dev/null @@ -1,7 +0,0 @@ -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]/npm/check_errors/main.ts:3:18 diff --git a/tests/testdata/npm/child_process_fork_test/main.out b/tests/testdata/npm/child_process_fork_test/main.out deleted file mode 100644 index d5bc57741..000000000 --- a/tests/testdata/npm/child_process_fork_test/main.out +++ /dev/null @@ -1,2 +0,0 @@ -function -Done. diff --git a/tests/testdata/npm/child_process_fork_test/main.ts b/tests/testdata/npm/child_process_fork_test/main.ts deleted file mode 100644 index e560edb7e..000000000 --- a/tests/testdata/npm/child_process_fork_test/main.ts +++ /dev/null @@ -1,4 +0,0 @@ -import "npm:chalk@4"; -import { run } from "npm:@denotest/child-process-fork"; - -run(); diff --git a/tests/testdata/npm/cjs-invalid-name-exports/main.out b/tests/testdata/npm/cjs-invalid-name-exports/main.out deleted file mode 100644 index 45ec15d0e..000000000 --- a/tests/testdata/npm/cjs-invalid-name-exports/main.out +++ /dev/null @@ -1,13 +0,0 @@ -[Module: null prototype] { - "a \\ b": "a \\ b", - "another 'case'": "example", - default: { - 'wow "double quotes"': "double quotes", - "another 'case'": "example", - "a \\ b": "a \\ b", - "name variable": "a", - "foo - bar": "foo - bar" - }, - "foo - bar": "foo - bar", - 'wow "double quotes"': "double quotes" -} diff --git a/tests/testdata/npm/cjs-invalid-name-exports/main.ts b/tests/testdata/npm/cjs-invalid-name-exports/main.ts deleted file mode 100644 index 9bdf0e43b..000000000 --- a/tests/testdata/npm/cjs-invalid-name-exports/main.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as foo from "npm:@denotest/cjs-invalid-name-exports"; - -console.log(foo); diff --git a/tests/testdata/npm/cjs_local_global_decls/main.out b/tests/testdata/npm/cjs_local_global_decls/main.out deleted file mode 100644 index 5e7a36c8d..000000000 --- a/tests/testdata/npm/cjs_local_global_decls/main.out +++ /dev/null @@ -1,3 +0,0 @@ -Download http://localhost:4260/@denotest/cjs-local-global-decls -Download http://localhost:4260/@denotest/cjs-local-global-decls/1.0.0.tgz -Loaded. diff --git a/tests/testdata/npm/cjs_local_global_decls/main.ts b/tests/testdata/npm/cjs_local_global_decls/main.ts deleted file mode 100644 index 04074057b..000000000 --- a/tests/testdata/npm/cjs_local_global_decls/main.ts +++ /dev/null @@ -1 +0,0 @@ -import "npm:@denotest/cjs-local-global-decls@1.0.0"; diff --git a/tests/testdata/npm/cjs_module_export_assignment/main.out b/tests/testdata/npm/cjs_module_export_assignment/main.out deleted file mode 100644 index dea185e38..000000000 --- a/tests/testdata/npm/cjs_module_export_assignment/main.out +++ /dev/null @@ -1,6 +0,0 @@ -{ func: [Function: func] } -[Module: null prototype] { - default: { func: [Function: func] }, - func: [Function: func] -} -5 diff --git a/tests/testdata/npm/cjs_module_export_assignment/main.ts b/tests/testdata/npm/cjs_module_export_assignment/main.ts deleted file mode 100644 index 93d3db1c3..000000000 --- a/tests/testdata/npm/cjs_module_export_assignment/main.ts +++ /dev/null @@ -1,6 +0,0 @@ -import defaultImport, * as namespaceImport from "npm:@denotest/cjs-module-export-assignment"; -import { func } from "npm:@denotest/cjs-module-export-assignment"; - -console.log(defaultImport); -console.log(namespaceImport); -console.log(func()); diff --git a/tests/testdata/npm/cjs_module_export_assignment_number/main.out b/tests/testdata/npm/cjs_module_export_assignment_number/main.out deleted file mode 100644 index e559775cf..000000000 --- a/tests/testdata/npm/cjs_module_export_assignment_number/main.out +++ /dev/null @@ -1,3 +0,0 @@ -5 -5 -[Module: null prototype] { default: 5 } diff --git a/tests/testdata/npm/cjs_module_export_assignment_number/main.ts b/tests/testdata/npm/cjs_module_export_assignment_number/main.ts deleted file mode 100644 index aee24bf19..000000000 --- a/tests/testdata/npm/cjs_module_export_assignment_number/main.ts +++ /dev/null @@ -1,7 +0,0 @@ -import defaultImport, * as namespaceImport from "npm:@denotest/cjs-module-export-assignment-number"; - -const testDefault: 5 = defaultImport; -console.log(testDefault); -const testNamespace: 5 = namespaceImport.default; -console.log(testNamespace); -console.log(namespaceImport); diff --git a/tests/testdata/npm/cjs_pkg_imports/main.out b/tests/testdata/npm/cjs_pkg_imports/main.out deleted file mode 100644 index 661146bd0..000000000 --- a/tests/testdata/npm/cjs_pkg_imports/main.out +++ /dev/null @@ -1,3 +0,0 @@ -Download http://localhost:4260/@denotest/cjs-pkg-imports -Download http://localhost:4260/@denotest/cjs-pkg-imports/1.0.0.tgz -{ crypto: Crypto { subtle: SubtleCrypto {} }, number: 5 } diff --git a/tests/testdata/npm/cjs_pkg_imports/main.ts b/tests/testdata/npm/cjs_pkg_imports/main.ts deleted file mode 100644 index b30a3f85c..000000000 --- a/tests/testdata/npm/cjs_pkg_imports/main.ts +++ /dev/null @@ -1,3 +0,0 @@ -import crypto from "npm:@denotest/cjs-pkg-imports"; - -console.log(crypto); diff --git a/tests/testdata/npm/cjs_reexport_collision/main.out b/tests/testdata/npm/cjs_reexport_collision/main.out deleted file mode 100644 index ed3193f8d..000000000 --- a/tests/testdata/npm/cjs_reexport_collision/main.out +++ /dev/null @@ -1 +0,0 @@ -Hi. diff --git a/tests/testdata/npm/cjs_reexport_collision/main.ts b/tests/testdata/npm/cjs_reexport_collision/main.ts deleted file mode 100644 index 4bfcd89b1..000000000 --- a/tests/testdata/npm/cjs_reexport_collision/main.ts +++ /dev/null @@ -1,2 +0,0 @@ -import ReExportCollision from "npm:@denotest/cjs-reexport-collision"; -ReExportCollision.default.sayHello(); diff --git a/tests/testdata/npm/cjs_require_esm/main.out b/tests/testdata/npm/cjs_require_esm/main.out deleted file mode 100644 index 4afceccc9..000000000 --- a/tests/testdata/npm/cjs_require_esm/main.out +++ /dev/null @@ -1,4 +0,0 @@ -[Module: null prototype] { - Test: [Module: null prototype] { Test: [class Test] }, - default: { Test: [Module: null prototype] { Test: [class Test] } } -} diff --git a/tests/testdata/npm/cjs_require_esm/main.ts b/tests/testdata/npm/cjs_require_esm/main.ts deleted file mode 100644 index 069d4b60e..000000000 --- a/tests/testdata/npm/cjs_require_esm/main.ts +++ /dev/null @@ -1,2 +0,0 @@ -import * as ns from "npm:@denotest/cjs-require-esm"; -console.log(ns); diff --git a/tests/testdata/npm/cjs_require_esm_mjs/main.out b/tests/testdata/npm/cjs_require_esm_mjs/main.out deleted file mode 100644 index 4afceccc9..000000000 --- a/tests/testdata/npm/cjs_require_esm_mjs/main.out +++ /dev/null @@ -1,4 +0,0 @@ -[Module: null prototype] { - Test: [Module: null prototype] { Test: [class Test] }, - default: { Test: [Module: null prototype] { Test: [class Test] } } -} diff --git a/tests/testdata/npm/cjs_require_esm_mjs/main.ts b/tests/testdata/npm/cjs_require_esm_mjs/main.ts deleted file mode 100644 index d753c2a83..000000000 --- a/tests/testdata/npm/cjs_require_esm_mjs/main.ts +++ /dev/null @@ -1,2 +0,0 @@ -import * as ns from "npm:@denotest/cjs-require-esm/require_mjs.js"; -console.log(ns); diff --git a/tests/testdata/npm/cjs_sub_path/main.js b/tests/testdata/npm/cjs_sub_path/main.js deleted file mode 100644 index b71360959..000000000 --- a/tests/testdata/npm/cjs_sub_path/main.js +++ /dev/null @@ -1,21 +0,0 @@ -// this package will require a subpath like "ajv/dist/compile/codegen" -// and also get the parent directory index.js file using require("..") -import Ajv from "npm:ajv@~8.11"; -import addFormats from "npm:ajv-formats@2.1.1"; -import { expect } from "npm:chai@4.3"; - -const ajv = new Ajv(); -addFormats(ajv); - -const schema = { - type: "string", - format: "date", - formatMinimum: "2016-02-06", - formatExclusiveMaximum: "2016-12-27", -}; -const validate = ajv.compile(schema); - -expect(validate("2016-02-06")).to.be.true; -expect(validate("2016-02-05")).to.be.false; - -console.log("Fini"); diff --git a/tests/testdata/npm/cjs_sub_path/main.out b/tests/testdata/npm/cjs_sub_path/main.out deleted file mode 100644 index 868733775..000000000 --- a/tests/testdata/npm/cjs_sub_path/main.out +++ /dev/null @@ -1,35 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/ajv -Download http://localhost:4260/ajv-formats -Download http://localhost:4260/chai -Download http://localhost:4260/fast-deep-equal -Download http://localhost:4260/json-schema-traverse -Download http://localhost:4260/require-from-string -Download http://localhost:4260/uri-js -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/punycode -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/ajv/ajv-8.11.0.tgz -Download http://localhost:4260/ajv-formats/ajv-formats-2.1.1.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/check-error/check-error-1.0.2.tgz -Download http://localhost:4260/deep-eql/deep-eql-3.0.1.tgz -Download http://localhost:4260/fast-deep-equal/fast-deep-equal-3.1.3.tgz -Download http://localhost:4260/get-func-name/get-func-name-2.0.0.tgz -Download http://localhost:4260/json-schema-traverse/json-schema-traverse-1.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/punycode/punycode-2.1.1.tgz -Download http://localhost:4260/require-from-string/require-from-string-2.0.2.tgz -Download http://localhost:4260/type-detect/type-detect-4.0.8.tgz -Download http://localhost:4260/uri-js/uri-js-4.4.1.tgz -[UNORDERED_END] -Fini diff --git a/tests/testdata/npm/cjs_this_in_exports/main.js b/tests/testdata/npm/cjs_this_in_exports/main.js deleted file mode 100644 index 03aaabe05..000000000 --- a/tests/testdata/npm/cjs_this_in_exports/main.js +++ /dev/null @@ -1,11 +0,0 @@ -import defaultImport, { getValue } from "npm:@denotest/cjs-this-in-exports"; -import * as namespaceImport from "npm:@denotest/cjs-this-in-exports"; - -console.log(defaultImport.getValue()); -// In Node this actually fails, but it seems to work in Deno -// so I guess there's no harm in that. -console.log(namespaceImport.getValue()); - -// This will throw because it's lost its context. -// (same thing occurs with Node's cjs -> esm translation) -getValue(); diff --git a/tests/testdata/npm/cjs_this_in_exports/main.out b/tests/testdata/npm/cjs_this_in_exports/main.out deleted file mode 100644 index ba436bddc..000000000 --- a/tests/testdata/npm/cjs_this_in_exports/main.out +++ /dev/null @@ -1,5 +0,0 @@ -1 -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 diff --git a/tests/testdata/npm/cjs_yargs/main.js b/tests/testdata/npm/cjs_yargs/main.js deleted file mode 100644 index 832fd053c..000000000 --- a/tests/testdata/npm/cjs_yargs/main.js +++ /dev/null @@ -1,20 +0,0 @@ -import yargs from "npm:yargs@15.4.1"; - -const args = yargs(["serve", "8000"]) - .command("serve [port]", "start the server", (yargs) => { - return yargs - .positional("port", { - describe: "port to bind on", - default: 5000, - }); - }, (argv) => { - console.info(`start server on :${argv.port}`); - }) - .option("verbose", { - alias: "v", - type: "boolean", - description: "Run with verbose logging", - }) - .argv; - -console.log(args); diff --git a/tests/testdata/npm/cjs_yargs/main.out b/tests/testdata/npm/cjs_yargs/main.out deleted file mode 100644 index 938d7a771..000000000 --- a/tests/testdata/npm/cjs_yargs/main.out +++ /dev/null @@ -1,84 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/yargs -Download http://localhost:4260/cliui -Download http://localhost:4260/decamelize -Download http://localhost:4260/find-up -Download http://localhost:4260/get-caller-file -Download http://localhost:4260/require-directory -Download http://localhost:4260/require-main-filename -Download http://localhost:4260/set-blocking -Download http://localhost:4260/string-width -Download http://localhost:4260/which-module -Download http://localhost:4260/y18n -Download http://localhost:4260/yargs-parser -Download http://localhost:4260/strip-ansi -Download http://localhost:4260/wrap-ansi -Download http://localhost:4260/locate-path -Download http://localhost:4260/path-exists -Download http://localhost:4260/emoji-regex -Download http://localhost:4260/is-fullwidth-code-point -Download http://localhost:4260/camelcase -Download http://localhost:4260/ansi-regex -Download http://localhost:4260/ansi-styles -Download http://localhost:4260/p-locate -Download http://localhost:4260/color-convert -Download http://localhost:4260/p-limit -Download http://localhost:4260/color-name -Download http://localhost:4260/p-try -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/ansi-regex/ansi-regex-5.0.1.tgz -Initialize ansi-regex@5.0.1 -Download http://localhost:4260/ansi-styles/ansi-styles-4.3.0.tgz -Initialize ansi-styles@4.3.0 -Download http://localhost:4260/camelcase/camelcase-5.3.1.tgz -Initialize camelcase@5.3.1 -Download http://localhost:4260/cliui/cliui-6.0.0.tgz -Initialize cliui@6.0.0 -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/decamelize/decamelize-1.2.0.tgz -Initialize decamelize@1.2.0 -Download http://localhost:4260/emoji-regex/emoji-regex-8.0.0.tgz -Initialize emoji-regex@8.0.0 -Download http://localhost:4260/find-up/find-up-4.1.0.tgz -Initialize find-up@4.1.0 -Download http://localhost:4260/get-caller-file/get-caller-file-2.0.5.tgz -Initialize get-caller-file@2.0.5 -Download http://localhost:4260/is-fullwidth-code-point/is-fullwidth-code-point-3.0.0.tgz -Initialize is-fullwidth-code-point@3.0.0 -Download http://localhost:4260/locate-path/locate-path-5.0.0.tgz -Initialize locate-path@5.0.0 -Download http://localhost:4260/p-limit/p-limit-2.3.0.tgz -Initialize p-limit@2.3.0 -Download http://localhost:4260/p-locate/p-locate-4.1.0.tgz -Initialize p-locate@4.1.0 -Download http://localhost:4260/p-try/p-try-2.2.0.tgz -Initialize p-try@2.2.0 -Download http://localhost:4260/path-exists/path-exists-4.0.0.tgz -Initialize path-exists@4.0.0 -Download http://localhost:4260/require-directory/require-directory-2.1.1.tgz -Initialize require-directory@2.1.1 -Download http://localhost:4260/require-main-filename/require-main-filename-2.0.0.tgz -Initialize require-main-filename@2.0.0 -Download http://localhost:4260/set-blocking/set-blocking-2.0.0.tgz -Initialize set-blocking@2.0.0 -Download http://localhost:4260/string-width/string-width-4.2.3.tgz -Initialize string-width@4.2.3 -Download http://localhost:4260/strip-ansi/strip-ansi-6.0.1.tgz -Initialize strip-ansi@6.0.1 -Download http://localhost:4260/which-module/which-module-2.0.0.tgz -Initialize which-module@2.0.0 -Download http://localhost:4260/wrap-ansi/wrap-ansi-6.2.0.tgz -Initialize wrap-ansi@6.2.0 -Download http://localhost:4260/y18n/y18n-4.0.3.tgz -Initialize y18n@4.0.3 -Download http://localhost:4260/yargs/yargs-15.4.1.tgz -Initialize yargs@15.4.1 -Download http://localhost:4260/yargs-parser/yargs-parser-18.1.3.tgz -Initialize yargs-parser@18.1.3 -[UNORDERED_END] -start server on :8000 -[WILDCARD] diff --git a/tests/testdata/npm/compare_globals/main.out b/tests/testdata/npm/compare_globals/main.out deleted file mode 100644 index 234a68971..000000000 --- a/tests/testdata/npm/compare_globals/main.out +++ /dev/null @@ -1,30 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/@types/node -Download http://localhost:4260/undici-types -Download http://localhost:4260/@denotest/globals -[UNORDERED_END] -[UNORDERED_START] -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 -true -true -[] -setTimeout 1 false -setTimeout 2 function -setTimeout 3 function -setTimeout 4 function -setTimeout 5 undefined -window 1 false -window 2 false -false -false -self 1 true -self 2 true -false -false -bar -bar -true diff --git a/tests/testdata/npm/compare_globals/main.ts b/tests/testdata/npm/compare_globals/main.ts deleted file mode 100644 index 9482798d8..000000000 --- a/tests/testdata/npm/compare_globals/main.ts +++ /dev/null @@ -1,54 +0,0 @@ -/// - -import * as globals from "npm:@denotest/globals"; -console.log(globals.global === globals.globalThis); -// @ts-expect-error even though these are the same object, they have different types -console.log(globals.globalThis === globalThis); -console.log(globals.process.execArgv); - -type AssertTrue = never; -type _TestNoProcessGlobal = AssertTrue< - typeof globalThis extends { process: any } ? false : true ->; -type _TestHasNodeJsGlobal = NodeJS.Architecture; - -const controller = new AbortController(); -controller.abort("reason"); // in the NodeJS declaration it doesn't have a reason - -// Some globals are not the same between Node and Deno. -// @ts-expect-error incompatible types between Node and Deno -console.log("setTimeout 1", globalThis.setTimeout === globals.getSetTimeout()); - -// Super edge case where some Node code deletes a global where the -// Node code has its own global and the Deno code has the same global, -// but it's different. Basically if some Node code deletes -// one of these globals then we don't want it to suddenly inherit -// the Deno global (or touch the Deno global at all). -console.log("setTimeout 2", typeof globalThis.setTimeout); -console.log("setTimeout 3", typeof globals.getSetTimeout()); -globals.deleteSetTimeout(); -console.log("setTimeout 4", typeof globalThis.setTimeout); -console.log("setTimeout 5", typeof globals.getSetTimeout()); - -// In Deno 2 and Node.js, the window global is not defined. -console.log("window 1", "window" in globalThis); -console.log( - "window 2", - Object.getOwnPropertyDescriptor(globalThis, "window") !== undefined, -); -globals.checkWindowGlobal(); - -// In Deno 2 self global is defined, but in Node it is not. -console.log("self 1", "self" in globalThis); -console.log( - "self 2", - Object.getOwnPropertyDescriptor(globalThis, "self") !== undefined, -); -globals.checkSelfGlobal(); - -// "Non-managed" globals are shared between Node and Deno. -(globalThis as any).foo = "bar"; -console.log((globalThis as any).foo); -console.log(globals.getFoo()); - -console.log(Reflect.ownKeys(globalThis).includes("console")); // non-enumerable keys are included diff --git a/tests/testdata/npm/create_require/main.out b/tests/testdata/npm/create_require/main.out deleted file mode 100644 index 70b0415b3..000000000 --- a/tests/testdata/npm/create_require/main.out +++ /dev/null @@ -1,12 +0,0 @@ -[WILDCARD] -function -function -function -function -function -function -The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received https://example.com/ -The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received https://example.com/ -The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 1 -The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received foo -The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ./foo diff --git a/tests/testdata/npm/create_require/main.ts b/tests/testdata/npm/create_require/main.ts deleted file mode 100644 index 625c734aa..000000000 --- a/tests/testdata/npm/create_require/main.ts +++ /dev/null @@ -1 +0,0 @@ -import "npm:@denotest/create-require@1.0.0"; diff --git a/tests/testdata/npm/d_ext/main.out b/tests/testdata/npm/d_ext/main.out deleted file mode 100644 index 5c22a76a0..000000000 --- a/tests/testdata/npm/d_ext/main.out +++ /dev/null @@ -1,3 +0,0 @@ -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 diff --git a/tests/testdata/npm/d_ext/main.ts b/tests/testdata/npm/d_ext/main.ts deleted file mode 100644 index c92dbe065..000000000 --- a/tests/testdata/npm/d_ext/main.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { test } from "npm:@denotest/d-ext"; - -console.log(test); diff --git a/tests/testdata/npm/deno_cache.out b/tests/testdata/npm/deno_cache.out deleted file mode 100644 index d723293a8..000000000 --- a/tests/testdata/npm/deno_cache.out +++ /dev/null @@ -1,8 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/chalk -Download http://localhost:4260/mkdirp -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/chalk/chalk-5.0.1.tgz -Download http://localhost:4260/mkdirp/mkdirp-1.0.4.tgz -[UNORDERED_END] diff --git a/tests/testdata/npm/deno_run_no_bin_entrypoint.out b/tests/testdata/npm/deno_run_no_bin_entrypoint.out deleted file mode 100644 index 2b885ed59..000000000 --- a/tests/testdata/npm/deno_run_no_bin_entrypoint.out +++ /dev/null @@ -1 +0,0 @@ -error: Failed resolving binary export. '[WILDCARD]@denotest[WILDCARD]esm-basic[WILDCARD]package.json' did not have a bin property diff --git a/tests/testdata/npm/deno_run_no_bin_entrypoint_non_existent_subpath.out b/tests/testdata/npm/deno_run_no_bin_entrypoint_non_existent_subpath.out deleted file mode 100644 index 525fe4b4f..000000000 --- a/tests/testdata/npm/deno_run_no_bin_entrypoint_non_existent_subpath.out +++ /dev/null @@ -1,3 +0,0 @@ -error: Failed resolving binary export. '[WILDCARD]@denotest[WILDCARD]esm-basic[WILDCARD]package.json' did not have a bin property - -Fallback failed: Cannot find module 'file:///[WILDCARD]/non-existent.js' diff --git a/tests/testdata/npm/deno_run_no_ext.out b/tests/testdata/npm/deno_run_no_ext.out deleted file mode 100644 index ffe7cbd89..000000000 --- a/tests/testdata/npm/deno_run_no_ext.out +++ /dev/null @@ -1,4 +0,0 @@ -this -is -a -test diff --git a/tests/testdata/npm/deno_run_non_existent.out b/tests/testdata/npm/deno_run_non_existent.out deleted file mode 100644 index 247e650e6..000000000 --- a/tests/testdata/npm/deno_run_non_existent.out +++ /dev/null @@ -1,2 +0,0 @@ -Download http://localhost:4260/mkdirp -error: Could not find npm package 'mkdirp' matching '0.5.125'. diff --git a/tests/testdata/npm/deno_run_special_chars_in_bin_name.out b/tests/testdata/npm/deno_run_special_chars_in_bin_name.out deleted file mode 100644 index ffe7cbd89..000000000 --- a/tests/testdata/npm/deno_run_special_chars_in_bin_name.out +++ /dev/null @@ -1,4 +0,0 @@ -this -is -a -test diff --git a/tests/testdata/npm/directory_import/folder_index_js.out b/tests/testdata/npm/directory_import/folder_index_js.out deleted file mode 100644 index a700b8fdb..000000000 --- a/tests/testdata/npm/directory_import/folder_index_js.out +++ /dev/null @@ -1,7 +0,0 @@ -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/testdata/npm/directory_import/folder_index_js.ts b/tests/testdata/npm/directory_import/folder_index_js.ts deleted file mode 100644 index b0d51fcd9..000000000 --- a/tests/testdata/npm/directory_import/folder_index_js.ts +++ /dev/null @@ -1,2 +0,0 @@ -import test from "npm:@denotest/sub-folders/folder_index_js"; -console.log(test); diff --git a/tests/testdata/npm/directory_import/folder_no_index.out b/tests/testdata/npm/directory_import/folder_no_index.out deleted file mode 100644 index 844419b4c..000000000 --- a/tests/testdata/npm/directory_import/folder_no_index.out +++ /dev/null @@ -1,6 +0,0 @@ -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/testdata/npm/directory_import/folder_no_index.ts b/tests/testdata/npm/directory_import/folder_no_index.ts deleted file mode 100644 index 4c5fb7ec0..000000000 --- a/tests/testdata/npm/directory_import/folder_no_index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import test from "npm:@denotest/sub-folders/folder_no_index"; -console.log(test); diff --git a/tests/testdata/npm/dynamic_import_deno_ts_from_npm/add.ts b/tests/testdata/npm/dynamic_import_deno_ts_from_npm/add.ts deleted file mode 100644 index 3b399665d..000000000 --- a/tests/testdata/npm/dynamic_import_deno_ts_from_npm/add.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function add(a: number, b: number) { - return a + b; -} diff --git a/tests/testdata/npm/dynamic_import_deno_ts_from_npm/main.out b/tests/testdata/npm/dynamic_import_deno_ts_from_npm/main.out deleted file mode 100644 index 81d7aba8a..000000000 --- a/tests/testdata/npm/dynamic_import_deno_ts_from_npm/main.out +++ /dev/null @@ -1,2 +0,0 @@ -3 --1 diff --git a/tests/testdata/npm/dynamic_import_deno_ts_from_npm/main.ts b/tests/testdata/npm/dynamic_import_deno_ts_from_npm/main.ts deleted file mode 100644 index 4d5deec48..000000000 --- a/tests/testdata/npm/dynamic_import_deno_ts_from_npm/main.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { dynamicImport } from "npm:@denotest/dynamic-import"; - -const { add } = await dynamicImport(new URL("./add.ts", import.meta.url)); -console.log(add(1, 2)); -const { subtract } = await dynamicImport( - new URL("./subtract.mts", import.meta.url), -); -console.log(subtract(1, 2)); diff --git a/tests/testdata/npm/dynamic_import_deno_ts_from_npm/subtract.mts b/tests/testdata/npm/dynamic_import_deno_ts_from_npm/subtract.mts deleted file mode 100644 index 4bf634170..000000000 --- a/tests/testdata/npm/dynamic_import_deno_ts_from_npm/subtract.mts +++ /dev/null @@ -1,3 +0,0 @@ -export function subtract(a: number, b: number) { - return a - b; -} diff --git a/tests/testdata/npm/dynamic_import_invalid_package_name/main.out b/tests/testdata/npm/dynamic_import_invalid_package_name/main.out deleted file mode 100644 index 414d08795..000000000 --- a/tests/testdata/npm/dynamic_import_invalid_package_name/main.out +++ /dev/null @@ -1,6 +0,0 @@ -Download http://localhost:4260/ws%3A -FAILED -TypeError: npm package 'ws:' does not exist. - at async file:///[WILDCARD]/dynamic_import_invalid_package_name/main.ts:2:3 { - code: "ERR_MODULE_NOT_FOUND" -} diff --git a/tests/testdata/npm/dynamic_import_invalid_package_name/main.ts b/tests/testdata/npm/dynamic_import_invalid_package_name/main.ts deleted file mode 100644 index 368ccc282..000000000 --- a/tests/testdata/npm/dynamic_import_invalid_package_name/main.ts +++ /dev/null @@ -1,6 +0,0 @@ -try { - await import(`npm:${"ws:"}`); -} catch (err) { - console.log("FAILED"); - console.log(err); -} diff --git a/tests/testdata/npm/dynamic_import_reload_same_package/main.out b/tests/testdata/npm/dynamic_import_reload_same_package/main.out deleted file mode 100644 index b2f99b465..000000000 --- a/tests/testdata/npm/dynamic_import_reload_same_package/main.out +++ /dev/null @@ -1,5 +0,0 @@ -Download http://localhost:4260/chalk -Download http://localhost:4260/chalk/chalk-5.0.1.tgz -Starting... -Ran other. -Finished... diff --git a/tests/testdata/npm/dynamic_import_reload_same_package/main.ts b/tests/testdata/npm/dynamic_import_reload_same_package/main.ts deleted file mode 100644 index 7c7ee7d55..000000000 --- a/tests/testdata/npm/dynamic_import_reload_same_package/main.ts +++ /dev/null @@ -1,7 +0,0 @@ -import chalk from "npm:chalk@5"; - -console.log(chalk.green("Starting...")); -// non-analyzable -const importName = "./other.ts"; -await import(importName); -console.log(chalk.green("Finished...")); diff --git a/tests/testdata/npm/dynamic_import_reload_same_package/other.ts b/tests/testdata/npm/dynamic_import_reload_same_package/other.ts deleted file mode 100644 index 28e3da14f..000000000 --- a/tests/testdata/npm/dynamic_import_reload_same_package/other.ts +++ /dev/null @@ -1,3 +0,0 @@ -import chalk from "npm:chalk@5"; - -console.log(chalk.green("Ran other.")); diff --git a/tests/testdata/npm/env_var_re_export/main.js b/tests/testdata/npm/env_var_re_export/main.js deleted file mode 100644 index ed91487a0..000000000 --- a/tests/testdata/npm/env_var_re_export/main.js +++ /dev/null @@ -1,3 +0,0 @@ -import { getEnv } from "npm:@denotest/env-var-re-export"; - -console.log(getEnv()); diff --git a/tests/testdata/npm/error_version_after_subpath/main.js b/tests/testdata/npm/error_version_after_subpath/main.js deleted file mode 100644 index 77c7a017c..000000000 --- a/tests/testdata/npm/error_version_after_subpath/main.js +++ /dev/null @@ -1 +0,0 @@ -import "npm:react-dom/server@18.2.0"; diff --git a/tests/testdata/npm/error_version_after_subpath/main.out b/tests/testdata/npm/error_version_after_subpath/main.out deleted file mode 100644 index 0cdd1b6da..000000000 --- a/tests/testdata/npm/error_version_after_subpath/main.out +++ /dev/null @@ -1,2 +0,0 @@ -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 diff --git a/tests/testdata/npm/file_dts_dmts_dcts/main.out b/tests/testdata/npm/file_dts_dmts_dcts/main.out deleted file mode 100644 index 507d2c2f7..000000000 --- a/tests/testdata/npm/file_dts_dmts_dcts/main.out +++ /dev/null @@ -1,24 +0,0 @@ -Download http://localhost:4260/@denotest/file-dts-dmts-dcts -Download http://localhost:4260/@denotest/file-dts-dmts-dcts/1.0.0.tgz -Check file:///[WILDCARD]/main.ts -error: TS2322 [ERROR]: Type '5' is not assignable to type '"dts"'. -const value1: Dts1 = 5; - ~~~~~~ - at file:///[WILDCARD] - -TS2322 [ERROR]: Type '5' is not assignable to type '"mts"'. -const value2: Mts1 = 5; - ~~~~~~ - at file:///[WILDCARD] - -TS2322 [ERROR]: Type '5' is not assignable to type '"mts"'. -const value3: Mts2 = 5; - ~~~~~~ - at file:///[WILDCARD] - -TS2322 [ERROR]: Type '5' is not assignable to type '"cts"'. -const value4: Cts1 = 5; - ~~~~~~ - at file:///[WILDCARD] - -Found 4 errors. diff --git a/tests/testdata/npm/file_dts_dmts_dcts/main.ts b/tests/testdata/npm/file_dts_dmts_dcts/main.ts deleted file mode 100644 index 63686e2d3..000000000 --- a/tests/testdata/npm/file_dts_dmts_dcts/main.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Value as Dts1 } from "npm:@denotest/file-dts-dmts-dcts/js"; -import { Value as Mts1 } from "npm:@denotest/file-dts-dmts-dcts"; -import { Value as Mts2 } from "npm:@denotest/file-dts-dmts-dcts/mjs"; -import { Value as Cts1 } from "npm:@denotest/file-dts-dmts-dcts/cjs"; - -const value1: Dts1 = 5; -const value2: Mts1 = 5; -const value3: Mts2 = 5; -const value4: Cts1 = 5; diff --git a/tests/testdata/npm/import_json/main.js b/tests/testdata/npm/import_json/main.js deleted file mode 100644 index ac6cee9a8..000000000 --- a/tests/testdata/npm/import_json/main.js +++ /dev/null @@ -1,4 +0,0 @@ -import json from "npm:@denotest/binary-package@1/package.json" with { - type: "json", -}; -console.log(json); diff --git a/tests/testdata/npm/import_json/main.out b/tests/testdata/npm/import_json/main.out deleted file mode 100644 index 7db7ec4ea..000000000 --- a/tests/testdata/npm/import_json/main.out +++ /dev/null @@ -1,10 +0,0 @@ -{ - 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/testdata/npm/import_map/import_map.json b/tests/testdata/npm/import_map/import_map.json deleted file mode 100644 index 1c3baacd1..000000000 --- a/tests/testdata/npm/import_map/import_map.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "imports": { - "chalk": "npm:chalk@5", - "@denotest/": "npm:/@denotest/dual-cjs-esm/" - } -} diff --git a/tests/testdata/npm/import_map/main.js b/tests/testdata/npm/import_map/main.js deleted file mode 100644 index e354b7e92..000000000 --- a/tests/testdata/npm/import_map/main.js +++ /dev/null @@ -1,10 +0,0 @@ -import chalk from "chalk"; -import { getSubPathKind } from "@denotest/subpath/main.mjs"; - -console.log(chalk.green("chalk import map loads")); - -export function test(value) { - return chalk.red(value); -} - -console.log(getSubPathKind()); diff --git a/tests/testdata/npm/import_map/main.out b/tests/testdata/npm/import_map/main.out deleted file mode 100644 index 05f313d4e..000000000 --- a/tests/testdata/npm/import_map/main.out +++ /dev/null @@ -1,10 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/chalk -Download http://localhost:4260/@denotest/dual-cjs-esm -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/@denotest/dual-cjs-esm/1.0.0.tgz -Download http://localhost:4260/chalk/chalk-5.0.1.tgz -[UNORDERED_END] -chalk import map loads -esm diff --git a/tests/testdata/npm/imports_package_json/import_not_defined.js b/tests/testdata/npm/imports_package_json/import_not_defined.js deleted file mode 100644 index dc4d2df16..000000000 --- a/tests/testdata/npm/imports_package_json/import_not_defined.js +++ /dev/null @@ -1,3 +0,0 @@ -import data from "@denotest/imports-package-json/import-not-defined"; - -console.log(data); diff --git a/tests/testdata/npm/imports_package_json/import_not_defined.out b/tests/testdata/npm/imports_package_json/import_not_defined.out deleted file mode 100644 index 70d1145a3..000000000 --- a/tests/testdata/npm/imports_package_json/import_not_defined.out +++ /dev/null @@ -1,3 +0,0 @@ -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/testdata/npm/imports_package_json/main.js b/tests/testdata/npm/imports_package_json/main.js deleted file mode 100644 index 53090dd94..000000000 --- a/tests/testdata/npm/imports_package_json/main.js +++ /dev/null @@ -1,7 +0,0 @@ -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/testdata/npm/imports_package_json/main.out b/tests/testdata/npm/imports_package_json/main.out deleted file mode 100644 index 979e35576..000000000 --- a/tests/testdata/npm/imports_package_json/main.out +++ /dev/null @@ -1,7 +0,0 @@ -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/testdata/npm/imports_package_json/package.json b/tests/testdata/npm/imports_package_json/package.json deleted file mode 100644 index cb6a08d1a..000000000 --- a/tests/testdata/npm/imports_package_json/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "my-test", - "dependencies": { - "@denotest/imports-package-json": "1.0.0" - } -} diff --git a/tests/testdata/npm/imports_package_json/sub_path_import_not_defined.js b/tests/testdata/npm/imports_package_json/sub_path_import_not_defined.js deleted file mode 100644 index f1097aa06..000000000 --- a/tests/testdata/npm/imports_package_json/sub_path_import_not_defined.js +++ /dev/null @@ -1,3 +0,0 @@ -import data from "@denotest/imports-package-json/sub-path-import-not-defined"; - -console.log(data); diff --git a/tests/testdata/npm/imports_package_json/sub_path_import_not_defined.out b/tests/testdata/npm/imports_package_json/sub_path_import_not_defined.out deleted file mode 100644 index 7c803f2bf..000000000 --- a/tests/testdata/npm/imports_package_json/sub_path_import_not_defined.out +++ /dev/null @@ -1,3 +0,0 @@ -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/testdata/npm/info/chalk.out b/tests/testdata/npm/info/chalk.out deleted file mode 100644 index 63fa20da5..000000000 --- a/tests/testdata/npm/info/chalk.out +++ /dev/null @@ -1,9 +0,0 @@ -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/testdata/npm/info/chalk_json.out b/tests/testdata/npm/info/chalk_json.out deleted file mode 100644 index d54155270..000000000 --- a/tests/testdata/npm/info/chalk_json.out +++ /dev/null @@ -1,57 +0,0 @@ -{ - "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/testdata/npm/mixed_case_package_name/global.out b/tests/testdata/npm/mixed_case_package_name/global.out deleted file mode 100644 index fdacea385..000000000 --- a/tests/testdata/npm/mixed_case_package_name/global.out +++ /dev/null @@ -1,9 +0,0 @@ -[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/testdata/npm/mixed_case_package_name/global.ts b/tests/testdata/npm/mixed_case_package_name/global.ts deleted file mode 100644 index a721b3d78..000000000 --- a/tests/testdata/npm/mixed_case_package_name/global.ts +++ /dev/null @@ -1,2 +0,0 @@ -import value from "npm:@denotest/MixedCase"; -console.log(value); diff --git a/tests/testdata/npm/mixed_case_package_name/local.out b/tests/testdata/npm/mixed_case_package_name/local.out deleted file mode 100644 index 6ab989d80..000000000 --- a/tests/testdata/npm/mixed_case_package_name/local.out +++ /dev/null @@ -1,13 +0,0 @@ -[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/testdata/npm/mixed_case_package_name/local.ts b/tests/testdata/npm/mixed_case_package_name/local.ts deleted file mode 100644 index 6ca6cb581..000000000 --- a/tests/testdata/npm/mixed_case_package_name/local.ts +++ /dev/null @@ -1,18 +0,0 @@ -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/testdata/npm/node_modules_deno_node_modules/main.out b/tests/testdata/npm/node_modules_deno_node_modules/main.out deleted file mode 100644 index 1ebdb2dd5..000000000 --- a/tests/testdata/npm/node_modules_deno_node_modules/main.out +++ /dev/null @@ -1,2 +0,0 @@ -esm -esm diff --git a/tests/testdata/npm/node_modules_deno_node_modules/main.ts b/tests/testdata/npm/node_modules_deno_node_modules/main.ts deleted file mode 100644 index 6e4a32d8e..000000000 --- a/tests/testdata/npm/node_modules_deno_node_modules/main.ts +++ /dev/null @@ -1,7 +0,0 @@ -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/testdata/npm/nonexistent_file/main.js b/tests/testdata/npm/nonexistent_file/main.js deleted file mode 100644 index c480b0548..000000000 --- a/tests/testdata/npm/nonexistent_file/main.js +++ /dev/null @@ -1,2 +0,0 @@ -import hmacSHA512 from "npm:crypto-js/non-existent"; -console.log(hmacSHA512); diff --git a/tests/testdata/npm/nonexistent_file/main.out b/tests/testdata/npm/nonexistent_file/main.out deleted file mode 100644 index baa79b1ce..000000000 --- a/tests/testdata/npm/nonexistent_file/main.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Unable to load [WILDCARD]non-existent imported from [WILDCARD]main.js - -Caused by: -[WILDCARD] diff --git a/tests/testdata/npm/permissions_outside_package/foo/config.js b/tests/testdata/npm/permissions_outside_package/foo/config.js deleted file mode 100644 index e667790d2..000000000 --- a/tests/testdata/npm/permissions_outside_package/foo/config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - "name": "foobar", - "version": "0.0.1", -}; diff --git a/tests/testdata/npm/permissions_outside_package/foo/package.json b/tests/testdata/npm/permissions_outside_package/foo/package.json deleted file mode 100644 index cc049e6ce..000000000 --- a/tests/testdata/npm/permissions_outside_package/foo/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "foobar", - "version": "0.0.1" -} diff --git a/tests/testdata/npm/permissions_outside_package/main.out b/tests/testdata/npm/permissions_outside_package/main.out deleted file mode 100644 index 089f329c4..000000000 --- a/tests/testdata/npm/permissions_outside_package/main.out +++ /dev/null @@ -1,3 +0,0 @@ -Download http://localhost:4260/@denotest/permissions-outside-package -Download http://localhost:4260/@denotest/permissions-outside-package/1.0.0.tgz -{ name: "foobar", version: "0.0.1" } diff --git a/tests/testdata/npm/permissions_outside_package/main.ts b/tests/testdata/npm/permissions_outside_package/main.ts deleted file mode 100644 index b0b82b626..000000000 --- a/tests/testdata/npm/permissions_outside_package/main.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { loadConfigFile } from "npm:@denotest/permissions-outside-package"; - -const fileName = `${Deno.cwd()}/npm/permissions_outside_package/foo/config.js`; -const config = loadConfigFile(fileName); -console.log(config); diff --git a/tests/testdata/npm/remote_npm_specifier/main.out b/tests/testdata/npm/remote_npm_specifier/main.out deleted file mode 100644 index 9daeafb98..000000000 --- a/tests/testdata/npm/remote_npm_specifier/main.out +++ /dev/null @@ -1 +0,0 @@ -test 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 20a99b688..000000000 --- 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/tests/testdata/npm/remote_npm_specifier/remote.ts b/tests/testdata/npm/remote_npm_specifier/remote.ts deleted file mode 100644 index 923ed3ed8..000000000 --- a/tests/testdata/npm/remote_npm_specifier/remote.ts +++ /dev/null @@ -1,3 +0,0 @@ -import chalk from "npm:chalk"; - -console.log(chalk.green("test")); diff --git a/tests/testdata/npm/require_added_nm_folder/main.js b/tests/testdata/npm/require_added_nm_folder/main.js deleted file mode 100644 index 723b2023a..000000000 --- a/tests/testdata/npm/require_added_nm_folder/main.js +++ /dev/null @@ -1,10 +0,0 @@ -import { getValue } from "npm:@denotest/require-added-nm-folder"; - -Deno.mkdirSync("./node_modules/.other-package"); -Deno.writeTextFileSync("./node_modules/.other-package/package.json", "{}"); -Deno.writeTextFileSync( - "./node_modules/.other-package/index.js", - "exports.get = () => 5;", -); - -console.log(getValue()); diff --git a/tests/testdata/npm/require_added_nm_folder/main.out b/tests/testdata/npm/require_added_nm_folder/main.out deleted file mode 100644 index 7ed6ff82d..000000000 --- a/tests/testdata/npm/require_added_nm_folder/main.out +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/tests/testdata/npm/require_json/main.js b/tests/testdata/npm/require_json/main.js deleted file mode 100644 index d11e85305..000000000 --- a/tests/testdata/npm/require_json/main.js +++ /dev/null @@ -1,2 +0,0 @@ -import globals from "npm:globals@13.17.0"; -console.log(globals); diff --git a/tests/testdata/npm/require_json/main.out b/tests/testdata/npm/require_json/main.out deleted file mode 100644 index 97db68e1b..000000000 --- a/tests/testdata/npm/require_json/main.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD] - devtools: { -[WILDCARD] \ No newline at end of file diff --git a/tests/testdata/npm/require_main/main.js b/tests/testdata/npm/require_main/main.js deleted file mode 100644 index ddecd4fdb..000000000 --- a/tests/testdata/npm/require_main/main.js +++ /dev/null @@ -1,2 +0,0 @@ -import fraction from "npm:autoprefixer"; -console.log(typeof fraction); diff --git a/tests/testdata/npm/require_main/main.out b/tests/testdata/npm/require_main/main.out deleted file mode 100644 index e2dbde096..000000000 --- a/tests/testdata/npm/require_main/main.out +++ /dev/null @@ -1 +0,0 @@ -function diff --git a/tests/testdata/npm/reserved_word_exports/main.out b/tests/testdata/npm/reserved_word_exports/main.out deleted file mode 100644 index ccfd35bc8..000000000 --- a/tests/testdata/npm/reserved_word_exports/main.out +++ /dev/null @@ -1,141 +0,0 @@ -Download http://localhost:4260/@denotest/reserved-word-exports -Download http://localhost:4260/@denotest/reserved-word-exports/1.0.0.tgz -[Module: null prototype] { - abstract: "abstract", - arguments: "arguments", - async: "async", - await: "await", - boolean: "boolean", - break: "break", - byte: "byte", - case: "case", - catch: "catch", - char: "char", - class: "class", - const: "const", - continue: "continue", - debugger: "debugger", - default: { - abstract: "abstract", - arguments: "arguments", - async: "async", - await: "await", - boolean: "boolean", - break: "break", - byte: "byte", - case: "case", - catch: "catch", - char: "char", - class: "class", - const: "const", - continue: "continue", - debugger: "debugger", - default: "default", - delete: "delete", - do: "do", - double: "double", - else: "else", - enum: "enum", - eval: "eval", - export: "export", - extends: "extends", - false: "false", - final: "final", - finally: "finally", - float: "float", - for: "for", - function: "function", - get: "get", - goto: "goto", - if: "if", - implements: "implements", - import: "import", - in: "in", - instanceof: "instanceof", - int: "int", - interface: "interface", - let: "let", - long: "long", - mod: "mod", - native: "native", - new: "new", - null: "null", - package: "package", - private: "private", - protected: "protected", - public: "public", - return: "return", - set: "set", - short: "short", - static: "static", - super: "super", - switch: "switch", - synchronized: "synchronized", - this: "this", - throw: "throw", - throws: "throws", - transient: "transient", - true: "true", - try: "try", - typeof: "typeof", - var: "var", - void: "void", - volatile: "volatile", - while: "while", - with: "with", - yield: "yield" - }, - delete: "delete", - do: "do", - double: "double", - else: "else", - enum: "enum", - eval: "eval", - export: "export", - extends: "extends", - false: "false", - final: "final", - finally: "finally", - float: "float", - for: "for", - function: "function", - get: "get", - goto: "goto", - if: "if", - implements: "implements", - import: "import", - in: "in", - instanceof: "instanceof", - int: "int", - interface: "interface", - let: "let", - long: "long", - mod: "mod", - native: "native", - new: "new", - null: "null", - package: "package", - private: "private", - protected: "protected", - public: "public", - return: "return", - set: "set", - short: "short", - static: "static", - super: "super", - switch: "switch", - synchronized: "synchronized", - this: "this", - throw: "throw", - throws: "throws", - transient: "transient", - true: "true", - try: "try", - typeof: "typeof", - var: "var", - void: "void", - volatile: "volatile", - while: "while", - with: "with", - yield: "yield" -} diff --git a/tests/testdata/npm/reserved_word_exports/main.ts b/tests/testdata/npm/reserved_word_exports/main.ts deleted file mode 100644 index 33cf183d3..000000000 --- a/tests/testdata/npm/reserved_word_exports/main.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as exports from "npm:@denotest/reserved-word-exports"; - -console.log(exports); diff --git a/tests/testdata/npm/run_existing_npm_package_with_subpath/main.out b/tests/testdata/npm/run_existing_npm_package_with_subpath/main.out deleted file mode 100644 index f6ee03ef1..000000000 --- a/tests/testdata/npm/run_existing_npm_package_with_subpath/main.out +++ /dev/null @@ -1,5 +0,0 @@ -Download http://localhost:4260/@denotest/bin -Download http://localhost:4260/@denotest/bin/1.0.0.tgz -Initialize @denotest/bin@1.0.0 -dev ---help diff --git a/tests/testdata/npm/run_existing_npm_package_with_subpath/package.json b/tests/testdata/npm/run_existing_npm_package_with_subpath/package.json deleted file mode 100644 index e9a7e84ce..000000000 --- a/tests/testdata/npm/run_existing_npm_package_with_subpath/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "run-existing-npm-package", - "dependencies": { - "@denotest/bin": "1.0.0" - } -} diff --git a/tests/testdata/npm/sub_paths/main.jsx b/tests/testdata/npm/sub_paths/main.jsx deleted file mode 100644 index 0c712b9ff..000000000 --- a/tests/testdata/npm/sub_paths/main.jsx +++ /dev/null @@ -1,8 +0,0 @@ -import React from "npm:react@18.2.0"; -import { renderToString } from "npm:react-dom@18.2.0/server"; - -function App({ name }) { - return
Hello {name}!
; -} - -console.log(renderToString()); diff --git a/tests/testdata/npm/sub_paths/main.out b/tests/testdata/npm/sub_paths/main.out deleted file mode 100644 index f034585a7..000000000 --- a/tests/testdata/npm/sub_paths/main.out +++ /dev/null @@ -1 +0,0 @@ -
Hello World!
diff --git a/tests/testdata/npm/tarball_with_global_header/main.js b/tests/testdata/npm/tarball_with_global_header/main.js deleted file mode 100644 index d1bb40fbc..000000000 --- a/tests/testdata/npm/tarball_with_global_header/main.js +++ /dev/null @@ -1,3 +0,0 @@ -import { Client } from "npm:ssh2"; - -console.log(Client); diff --git a/tests/testdata/npm/tarball_with_global_header/main.out b/tests/testdata/npm/tarball_with_global_header/main.out deleted file mode 100644 index ff211087b..000000000 --- a/tests/testdata/npm/tarball_with_global_header/main.out +++ /dev/null @@ -1 +0,0 @@ -[class Client extends EventEmitter] diff --git a/tests/testdata/npm/translate_cjs_to_esm/main.js b/tests/testdata/npm/translate_cjs_to_esm/main.js deleted file mode 100644 index 04a86fbf1..000000000 --- a/tests/testdata/npm/translate_cjs_to_esm/main.js +++ /dev/null @@ -1,6 +0,0 @@ -import fsx from "npm:fs-extra@10.1.0"; -import { createApp } from "npm:vue"; -import "npm:@denotest/cjs-with-file-stem"; - -console.log(fsx.access); -console.log(createApp); diff --git a/tests/testdata/npm/translate_cjs_to_esm/main.out b/tests/testdata/npm/translate_cjs_to_esm/main.out deleted file mode 100644 index c21a965b8..000000000 --- a/tests/testdata/npm/translate_cjs_to_esm/main.out +++ /dev/null @@ -1,4 +0,0 @@ -hello -world -[Function: access] -[Function: createApp] diff --git a/tests/testdata/npm/types_ambient_module/import_map.json b/tests/testdata/npm/types_ambient_module/import_map.json deleted file mode 100644 index f61d99b47..000000000 --- a/tests/testdata/npm/types_ambient_module/import_map.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "imports": { - "types-ambient": "npm:@denotest/types-ambient" - } -} diff --git a/tests/testdata/npm/types_ambient_module/main.out b/tests/testdata/npm/types_ambient_module/main.out deleted file mode 100644 index c84130707..000000000 --- a/tests/testdata/npm/types_ambient_module/main.out +++ /dev/null @@ -1,21 +0,0 @@ -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/testdata/npm/types_ambient_module/main.ts b/tests/testdata/npm/types_ambient_module/main.ts deleted file mode 100644 index 8f77cabe8..000000000 --- a/tests/testdata/npm/types_ambient_module/main.ts +++ /dev/null @@ -1,7 +0,0 @@ -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/testdata/npm/types_ambient_module/main_import_map.out b/tests/testdata/npm/types_ambient_module/main_import_map.out deleted file mode 100644 index 548f9b479..000000000 --- a/tests/testdata/npm/types_ambient_module/main_import_map.out +++ /dev/null @@ -1,9 +0,0 @@ -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/testdata/npm/types_ambient_module/main_import_map.ts b/tests/testdata/npm/types_ambient_module/main_import_map.ts deleted file mode 100644 index 2694c94b7..000000000 --- a/tests/testdata/npm/types_ambient_module/main_import_map.ts +++ /dev/null @@ -1,4 +0,0 @@ -import * as mod from "npm:@denotest/types-ambient"; - -console.log(mod.Test); -console.log(mod.Test2); // should error diff --git a/tests/testdata/npm/types_entry_value_not_exists/main.out b/tests/testdata/npm/types_entry_value_not_exists/main.out deleted file mode 100644 index 017a17ea2..000000000 --- a/tests/testdata/npm/types_entry_value_not_exists/main.out +++ /dev/null @@ -1,7 +0,0 @@ -Download http://localhost:4260/@denotest/types-entry-value-not-exists -Download http://localhost:4260/@denotest/types-entry-value-not-exists/1.0.0.tgz -Check file://[WILDCARD]/types_entry_value_not_exists/main.ts -error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. -const result: string = getValue(); - ~~~~~~ - at file:///[WILDCARD]/main.ts:4:7 diff --git a/tests/testdata/npm/types_entry_value_not_exists/main.ts b/tests/testdata/npm/types_entry_value_not_exists/main.ts deleted file mode 100644 index 04374ef87..000000000 --- a/tests/testdata/npm/types_entry_value_not_exists/main.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { getValue } from "npm:@denotest/types-entry-value-not-exists"; - -// should error here -const result: string = getValue(); -console.log(result); diff --git a/tests/testdata/npm/types_exports_import_types/main.out b/tests/testdata/npm/types_exports_import_types/main.out deleted file mode 100644 index 10f9425ca..000000000 --- a/tests/testdata/npm/types_exports_import_types/main.out +++ /dev/null @@ -1,7 +0,0 @@ -Download http://localhost:4260/@denotest/types-exports-import-types -Download http://localhost:4260/@denotest/types-exports-import-types/1.0.0.tgz -Check file://[WILDCARD]/types_exports_import_types/main.ts -error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. -const result: string = getValue(); - ~~~~~~ - at file:///[WILDCARD]/main.ts:4:7 diff --git a/tests/testdata/npm/types_exports_import_types/main.ts b/tests/testdata/npm/types_exports_import_types/main.ts deleted file mode 100644 index 3ae3e92a3..000000000 --- a/tests/testdata/npm/types_exports_import_types/main.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { getValue } from "npm:@denotest/types-exports-import-types"; - -// should error here -const result: string = getValue(); -console.log(result); diff --git a/tests/testdata/npm/types_no_types_entry/main.out b/tests/testdata/npm/types_no_types_entry/main.out deleted file mode 100644 index 53e872eaf..000000000 --- a/tests/testdata/npm/types_no_types_entry/main.out +++ /dev/null @@ -1,13 +0,0 @@ -[UNORDERED_START] -Download http://localhost:4260/@denotest/types-no-types-entry -Download http://localhost:4260/@denotest/types-entry-value-not-exists -[UNORDERED_END] -[UNORDERED_START] -Download http://localhost:4260/@denotest/types-entry-value-not-exists/1.0.0.tgz -Download http://localhost:4260/@denotest/types-no-types-entry/1.0.0.tgz -[UNORDERED_END] -Check file://[WILDCARD]/types_no_types_entry/main.ts -error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. -const result: string = getValue(); - ~~~~~~ - at file:///[WILDCARD]/main.ts:4:7 diff --git a/tests/testdata/npm/types_no_types_entry/main.ts b/tests/testdata/npm/types_no_types_entry/main.ts deleted file mode 100644 index eef53b681..000000000 --- a/tests/testdata/npm/types_no_types_entry/main.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { getValue } from "npm:@denotest/types-no-types-entry"; - -// should error here -const result: string = getValue(); -console.log(result); diff --git a/tests/testdata/npm/typescript_file_in_package/main.out b/tests/testdata/npm/typescript_file_in_package/main.out deleted file mode 100644 index 3c3b97190..000000000 --- a/tests/testdata/npm/typescript_file_in_package/main.out +++ /dev/null @@ -1,6 +0,0 @@ -Download http://localhost:4260/@denotest/typescript-file -Download http://localhost:4260/@denotest/typescript-file/1.0.0.tgz -error: Could not resolve 'npm:@denotest/typescript-file@1.0.0'. - -Caused by: - TypeScript files are not supported in npm packages: file:///[WILDCARD]/@denotest/typescript-file/1.0.0/index.ts diff --git a/tests/testdata/npm/typescript_file_in_package/main.ts b/tests/testdata/npm/typescript_file_in_package/main.ts deleted file mode 100644 index aefc38ebe..000000000 --- a/tests/testdata/npm/typescript_file_in_package/main.ts +++ /dev/null @@ -1,5 +0,0 @@ -// We don't support typescript files in npm packages because we don't -// want to encourage people distributing npm packages that aren't JavaScript. -import { getValue } from "npm:@denotest/typescript-file"; - -console.log(getValue()); -- cgit v1.2.3