diff options
Diffstat (limited to 'cli/tests')
31 files changed, 98 insertions, 55 deletions
diff --git a/cli/tests/020_json_modules.ts.out b/cli/tests/020_json_modules.ts.out index 8c07af203..a89bd2ad6 100644 --- a/cli/tests/020_json_modules.ts.out +++ b/cli/tests/020_json_modules.ts.out @@ -1,3 +1,5 @@ [WILDCARD] -error: TypeError: Cannot resolve extension for "[WILDCARD]config.json" with mediaType "Json". +error: An unsupported media type was attempted to be imported as a module. + Specifier: [WILDCARD]cli/tests/subdir/config.json + MediaType: Json [WILDCARD]
\ No newline at end of file diff --git a/cli/tests/023_no_ext b/cli/tests/023_no_ext new file mode 100644 index 000000000..0dcfb6209 --- /dev/null +++ b/cli/tests/023_no_ext @@ -0,0 +1,2 @@ +import * as mod4 from "./subdir/mod4.js"; +console.log(mod4.isMod4); diff --git a/cli/tests/023_no_ext.out b/cli/tests/023_no_ext.out new file mode 100644 index 000000000..27ba77dda --- /dev/null +++ b/cli/tests/023_no_ext.out @@ -0,0 +1 @@ +true diff --git a/cli/tests/023_no_ext_with_headers b/cli/tests/023_no_ext_with_headers deleted file mode 100644 index 87951d835..000000000 --- a/cli/tests/023_no_ext_with_headers +++ /dev/null @@ -1 +0,0 @@ -console.log("HELLO"); diff --git a/cli/tests/023_no_ext_with_headers.out b/cli/tests/023_no_ext_with_headers.out deleted file mode 100644 index e427984d4..000000000 --- a/cli/tests/023_no_ext_with_headers.out +++ /dev/null @@ -1 +0,0 @@ -HELLO diff --git a/cli/tests/bundle/fixture14.out b/cli/tests/bundle/fixture14.out index 06e93a7cc..c1a14cebe 100644 --- a/cli/tests/bundle/fixture14.out +++ b/cli/tests/bundle/fixture14.out @@ -12,12 +12,12 @@ const lib = function() { }; }(); const c = function() { - const c1; + const c1 = []; return { c: c1 }; }(); - const mod; + const mod = []; return { mod }; diff --git a/cli/tests/config.ts b/cli/tests/config.ts index e08061e77..6b1cb7322 100644 --- a/cli/tests/config.ts +++ b/cli/tests/config.ts @@ -1,5 +1,17 @@ -const map = new Map<string, { foo: string }>(); +/* eslint-disable */ +function b() { + return function ( + _target: any, + _propertyKey: string, + _descriptor: PropertyDescriptor, + ) { + console.log("b"); + }; +} -if (map.get("bar").foo) { - console.log("here"); +class A { + @b() + a() { + console.log("a"); + } } diff --git a/cli/tests/config.ts.out b/cli/tests/config.ts.out index 9840dba2e..99b4a7ea4 100644 --- a/cli/tests/config.ts.out +++ b/cli/tests/config.ts.out @@ -1,7 +1,7 @@ [WILDCARD]Unsupported compiler options in "[WILDCARD]config.tsconfig.json". The following options were ignored: module, target -error: TS2532 [ERROR]: Object is possibly 'undefined'. -if (map.get("bar").foo) { - ~~~~~~~~~~~~~~ - at [WILDCARD]tests/config.ts:3:5 +error: TS1219 [ERROR]: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning. + a() { + ^ + at file:///[WILDCARD]cli/tests/config.ts:[WILDCARD] diff --git a/cli/tests/config.tsconfig.json b/cli/tests/config.tsconfig.json index 074d7ac0b..dcabb50a4 100644 --- a/cli/tests/config.tsconfig.json +++ b/cli/tests/config.tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { + "experimentalDecorators": false, "module": "amd", - "strict": true, "target": "es5" } } diff --git a/cli/tests/disallow_http_from_https_js.out b/cli/tests/disallow_http_from_https_js.out index e4e421159..405859e4d 100644 --- a/cli/tests/disallow_http_from_https_js.out +++ b/cli/tests/disallow_http_from_https_js.out @@ -1,2 +1,3 @@ -error: Modules loaded over https:// are not allowed to import modules over http:// -Imported from "https://localhost:5545/cli/tests/disallow_http_from_https.js:2" +error: Modules imported via https are not allowed to import http modules. + Importing: http://localhost:4545/cli/tests/001_hello.js + at https://localhost:5545/cli/tests/disallow_http_from_https.js:2:0 diff --git a/cli/tests/disallow_http_from_https_ts.out b/cli/tests/disallow_http_from_https_ts.out index 55e10b733..b63ba0c67 100644 --- a/cli/tests/disallow_http_from_https_ts.out +++ b/cli/tests/disallow_http_from_https_ts.out @@ -1,2 +1,3 @@ -error: Modules loaded over https:// are not allowed to import modules over http:// -Imported from "https://localhost:5545/cli/tests/disallow_http_from_https.ts:2" +error: Modules imported via https are not allowed to import http modules. + Importing: http://localhost:4545/cli/tests/001_hello.js + at https://localhost:5545/cli/tests/disallow_http_from_https.ts:2:0 diff --git a/cli/tests/error_004_missing_module.ts.out b/cli/tests/error_004_missing_module.ts.out index 121555868..68032afb4 100644 --- a/cli/tests/error_004_missing_module.ts.out +++ b/cli/tests/error_004_missing_module.ts.out @@ -1,2 +1,2 @@ -[WILDCARD]error: Cannot resolve module "[WILDCARD]/bad-module.ts" from "[WILDCARD]/error_004_missing_module.ts" -Imported from "[WILDCARD]/error_004_missing_module.ts:2" +[WILDCARD]error: Cannot resolve module "file:///[WILDCARD]cli/tests/bad-module.ts" from "file:///[WILDCARD]cli/tests/error_004_missing_module.ts" + at file:///[WILDCARD]cli/tests/error_004_missing_module.ts:2:0 diff --git a/cli/tests/error_005_missing_dynamic_import.ts.out b/cli/tests/error_005_missing_dynamic_import.ts.out index 8a64175ec..346e8cd6f 100644 --- a/cli/tests/error_005_missing_dynamic_import.ts.out +++ b/cli/tests/error_005_missing_dynamic_import.ts.out @@ -1 +1 @@ -error: Uncaught TypeError: Cannot resolve module "[WILDCARD]/bad-module.ts" from "[WILDCARD]/error_005_missing_dynamic_import.ts" +error: Cannot resolve module "[WILDCARD]/bad-module.ts" from "[WILDCARD]/error_005_missing_dynamic_import.ts" diff --git a/cli/tests/error_006_import_ext_failure.ts.out b/cli/tests/error_006_import_ext_failure.ts.out index 9e1c99970..01f8af07e 100644 --- a/cli/tests/error_006_import_ext_failure.ts.out +++ b/cli/tests/error_006_import_ext_failure.ts.out @@ -1,2 +1,2 @@ [WILDCARD]error: Cannot resolve module "[WILDCARD]/non-existent" from "[WILDCARD]/error_006_import_ext_failure.ts" -Imported from "[WILDCARD]/error_006_import_ext_failure.ts:1" + at file:///[WILDCARD]cli/tests/error_006_import_ext_failure.ts:1:0 diff --git a/cli/tests/error_011_bad_module_specifier.ts b/cli/tests/error_011_bad_module_specifier.ts index e74d6b821..a9ccc4523 100644 --- a/cli/tests/error_011_bad_module_specifier.ts +++ b/cli/tests/error_011_bad_module_specifier.ts @@ -1,2 +1,4 @@ // eslint-disable-next-line import * as badModule from "bad-module.ts"; + +console.log(badModule); diff --git a/cli/tests/error_015_dynamic_import_permissions.out b/cli/tests/error_015_dynamic_import_permissions.out index 7078ac61c..9b47ebe9d 100644 --- a/cli/tests/error_015_dynamic_import_permissions.out +++ b/cli/tests/error_015_dynamic_import_permissions.out @@ -1 +1 @@ -error: Uncaught TypeError: network access to "http://localhost:4545/cli/tests/subdir/mod4.js", run again with the --allow-net flag +error: network access to "http://localhost:4545/cli/tests/subdir/mod4.js", run again with the --allow-net flag diff --git a/cli/tests/error_016_dynamic_import_permissions2.out b/cli/tests/error_016_dynamic_import_permissions2.out index 2babfbf9f..f54b4a7fe 100644 --- a/cli/tests/error_016_dynamic_import_permissions2.out +++ b/cli/tests/error_016_dynamic_import_permissions2.out @@ -1,3 +1,4 @@ [WILDCARD] -error: Uncaught TypeError: read access to "[WILDCARD]passwd", run again with the --allow-read flag -Imported from "[WILDCARD]evil_remote_import.js:3" +error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. + Importing: file:///c:/etc/passwd + at http://localhost:4545/cli/tests/subdir/evil_remote_import.js:3:0 diff --git a/cli/tests/error_local_static_import_from_remote.js.out b/cli/tests/error_local_static_import_from_remote.js.out index 1a2dcb2e3..071ca36d4 100644 --- a/cli/tests/error_local_static_import_from_remote.js.out +++ b/cli/tests/error_local_static_import_from_remote.js.out @@ -1,3 +1,4 @@ [WILDCARD] -error: Remote modules are not allowed to statically import local modules. Use dynamic import instead. -Imported from "[WILDCARD]error_local_static_import_from_remote.js:1" +error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. + Importing: file:///some/dir/file.js + at http://localhost:4545/cli/tests/error_local_static_import_from_remote.js:1:0 diff --git a/cli/tests/error_local_static_import_from_remote.ts.out b/cli/tests/error_local_static_import_from_remote.ts.out index a2f2e1bbf..38f4c02bc 100644 --- a/cli/tests/error_local_static_import_from_remote.ts.out +++ b/cli/tests/error_local_static_import_from_remote.ts.out @@ -1,3 +1,4 @@ [WILDCARD] -error: Remote modules are not allowed to statically import local modules. Use dynamic import instead. -Imported from "[WILDCARD]error_local_static_import_from_remote.ts:1" +error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. + Importing: file:///some/dir/file.ts + at http://localhost:4545/cli/tests/error_local_static_import_from_remote.ts:1:0 diff --git a/cli/tests/fix_exotic_specifiers.ts b/cli/tests/fix_exotic_specifiers.ts new file mode 100644 index 000000000..101667b2a --- /dev/null +++ b/cli/tests/fix_exotic_specifiers.ts @@ -0,0 +1,3 @@ +import clone from "https://jspm.dev/lodash@4/clone"; + +console.log(clone); diff --git a/cli/tests/fix_exotic_specifiers.ts.out b/cli/tests/fix_exotic_specifiers.ts.out new file mode 100644 index 000000000..7afdb808d --- /dev/null +++ b/cli/tests/fix_exotic_specifiers.ts.out @@ -0,0 +1 @@ +[Function: clone] diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 047440a70..b9264aa0f 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1807,9 +1807,9 @@ itest!(_022_info_flag_script { http_server: true, }); -itest!(_023_no_ext_with_headers { - args: "run --reload 023_no_ext_with_headers", - output: "023_no_ext_with_headers.out", +itest!(_023_no_ext { + args: "run --reload 023_no_ext", + output: "023_no_ext.out", }); // TODO(lucacasonato): remove --unstable when permissions goes stable @@ -2018,7 +2018,7 @@ itest!(_044_bad_resource { }); itest!(_045_proxy { - args: "run --allow-net --allow-env --allow-run --allow-read --reload --quiet 045_proxy_test.ts", + args: "run -L debug --allow-net --allow-env --allow-run --allow-read --reload --quiet 045_proxy_test.ts", output: "045_proxy_test.ts.out", http_server: true, }); @@ -2764,6 +2764,11 @@ itest!(tsx_imports { output: "tsx_imports.ts.out", }); +itest!(fix_exotic_specifiers { + args: "run --quiet --reload fix_exotic_specifiers.ts", + output: "fix_exotic_specifiers.ts.out", +}); + itest!(fix_js_import_js { args: "run --quiet --reload fix_js_import_js.ts", output: "fix_js_import_js.ts.out", diff --git a/cli/tests/lock_check_err.out b/cli/tests/lock_check_err.out index 87f0242f7..c12f4af34 100644 --- a/cli/tests/lock_check_err.out +++ b/cli/tests/lock_check_err.out @@ -1,2 +1,3 @@ -[WILDCARD]Subresource integrity check failed --lock=lock_check_err.json -http://127.0.0.1:4545/cli/tests/003_relative_import.ts +[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. + Specifier: http://127.0.0.1:4545/cli/tests/003_relative_import.ts + Lock file: lock_check_err.json diff --git a/cli/tests/lock_check_err2.out b/cli/tests/lock_check_err2.out index 6b81c9713..d3ccfc46e 100644 --- a/cli/tests/lock_check_err2.out +++ b/cli/tests/lock_check_err2.out @@ -1,2 +1,3 @@ -[WILDCARD]Subresource integrity check failed --lock=lock_check_err2.json -http://localhost:4545/cli/tests/subdir/mt_text_ecmascript.j3.js +[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. + Specifier: http://localhost:4545/cli/tests/subdir/mt_text_ecmascript.j3.js + Lock file: lock_check_err2.json diff --git a/cli/tests/lock_dynamic_imports.out b/cli/tests/lock_dynamic_imports.out index 57bc053b9..3bf6342c8 100644 --- a/cli/tests/lock_dynamic_imports.out +++ b/cli/tests/lock_dynamic_imports.out @@ -1,3 +1,4 @@ [WILDCARD] -Subresource integrity check failed --lock=lock_dynamic_imports.json -http://127.0.0.1:4545/cli/tests/subdir/subdir2/mod2.ts +The source code is invalid, as it does not match the expected hash in the lock file. + Specifier: http://127.0.0.1:4545/cli/tests/subdir/subdir2/mod2.ts + Lock file: lock_dynamic_imports.json diff --git a/cli/tests/module_graph/file_tests-importjson.ts b/cli/tests/module_graph/file_tests-importjson.ts new file mode 100644 index 000000000..c2bc2bca7 --- /dev/null +++ b/cli/tests/module_graph/file_tests-importjson.ts @@ -0,0 +1,3 @@ +import * as config from "./some.json"; + +console.log(config); diff --git a/cli/tests/module_graph/file_tests-some.json b/cli/tests/module_graph/file_tests-some.json new file mode 100644 index 000000000..567c4ba21 --- /dev/null +++ b/cli/tests/module_graph/file_tests-some.json @@ -0,0 +1,5 @@ +{ + "config": { + "debug": true + } +} diff --git a/cli/tests/performance_stats.out b/cli/tests/performance_stats.out index 0fe7ba7f0..141829ee6 100644 --- a/cli/tests/performance_stats.out +++ b/cli/tests/performance_stats.out @@ -1,14 +1,16 @@ [WILDCARD] -DEBUG RS - [WILDCARD] - Files: [WILDCARD] -DEBUG RS - [WILDCARD] - Nodes: [WILDCARD] -DEBUG RS - [WILDCARD] - Identifiers: [WILDCARD] -DEBUG RS - [WILDCARD] - Symbols: [WILDCARD] -DEBUG RS - [WILDCARD] - Types: [WILDCARD] -DEBUG RS - [WILDCARD] - Instantiations: [WILDCARD] -DEBUG RS - [WILDCARD] - Parse time: [WILDCARD] -DEBUG RS - [WILDCARD] - Bind time: [WILDCARD] -DEBUG RS - [WILDCARD] - Check time: [WILDCARD] -DEBUG RS - [WILDCARD] - Emit time: [WILDCARD] -DEBUG RS - [WILDCARD] - Total TS time: [WILDCARD] -DEBUG RS - [WILDCARD] - Compile time: [WILDCARD] +DEBUG RS - [WILDCARD] - Compilation statistics: + Files: [WILDCARD] + Nodes: [WILDCARD] + Identifiers: [WILDCARD] + Symbols: [WILDCARD] + Types: [WILDCARD] + Instantiations: [WILDCARD] + Parse time: [WILDCARD] + Bind time: [WILDCARD] + Check time: [WILDCARD] + Emit time: [WILDCARD] + Total TS time: [WILDCARD] + Compile time: [WILDCARD] + [WILDCARD] diff --git a/cli/tests/single_compile_with_reload.ts.out b/cli/tests/single_compile_with_reload.ts.out index 88c3f97ab..4ffaa6e77 100644 --- a/cli/tests/single_compile_with_reload.ts.out +++ b/cli/tests/single_compile_with_reload.ts.out @@ -1,5 +1,4 @@ Check [WILDCARD]single_compile_with_reload.ts -Check [WILDCARD]single_compile_with_reload_dyn.ts Hello 1 2 diff --git a/cli/tests/ts_type_only_import.ts.out b/cli/tests/ts_type_only_import.ts.out index d7120966f..f808ed21a 100644 --- a/cli/tests/ts_type_only_import.ts.out +++ b/cli/tests/ts_type_only_import.ts.out @@ -1,4 +1,4 @@ Check [WILDCARD]ts_type_only_import.ts -Warning Failed to get compiled source code of "[WILDCARD]ts_type_only_import.d.ts". -Reason: [WILDCARD] (os error 2) -If the source file provides only type exports, prefer to use "import type" or "export type" syntax instead. +warning: Compiled module not found "[WILDCARD]ts_type_only_import.d.ts" + From: [WILDCARD]ts_type_only_import.ts + If the source module contains only types, use `import type` and `export type` to import it instead. diff --git a/cli/tests/unsupported_dynamic_import_scheme.out b/cli/tests/unsupported_dynamic_import_scheme.out index 2a1a4e01f..0161b7a99 100644 --- a/cli/tests/unsupported_dynamic_import_scheme.out +++ b/cli/tests/unsupported_dynamic_import_scheme.out @@ -1,4 +1,4 @@ -error: Uncaught TypeError: Unsupported scheme "xxx" for module "xxx:". Supported schemes: [ +error: Unsupported scheme "xxx" for module "xxx:". Supported schemes: [ "http", "https", "file", |