diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/013_dynamic_import.ts | 17 | ||||
-rw-r--r-- | tests/013_dynamic_import.ts.out | 1 | ||||
-rw-r--r-- | tests/async_error.ts.out | 5 | ||||
-rw-r--r-- | tests/error_001.ts.out | 5 | ||||
-rw-r--r-- | tests/error_002.ts.out | 7 | ||||
-rw-r--r-- | tests/error_003_typescript.ts | 2 | ||||
-rw-r--r-- | tests/error_003_typescript.ts.out | 10 | ||||
-rw-r--r-- | tests/error_004_missing_module.ts | 1 | ||||
-rw-r--r-- | tests/error_004_missing_module.ts.out | 12 |
9 files changed, 50 insertions, 10 deletions
diff --git a/tests/013_dynamic_import.ts b/tests/013_dynamic_import.ts new file mode 100644 index 000000000..0812623f6 --- /dev/null +++ b/tests/013_dynamic_import.ts @@ -0,0 +1,17 @@ +(async () => { + const { + returnsHi, + returnsFoo2, + printHello3 + } = await import("./subdir/mod1.ts"); + + printHello3(); + + if (returnsHi() !== "Hi") { + throw Error("Unexpected"); + } + + if (returnsFoo2() !== "Foo") { + throw Error("Unexpected"); + } +})(); diff --git a/tests/013_dynamic_import.ts.out b/tests/013_dynamic_import.ts.out new file mode 100644 index 000000000..e965047ad --- /dev/null +++ b/tests/013_dynamic_import.ts.out @@ -0,0 +1 @@ +Hello diff --git a/tests/async_error.ts.out b/tests/async_error.ts.out index c98c79bfc..f282f6c3e 100644 --- a/tests/async_error.ts.out +++ b/tests/async_error.ts.out @@ -3,8 +3,7 @@ before error Error: error at foo ([WILDCARD]tests/async_error.ts:4:9) at eval ([WILDCARD]tests/async_error.ts:7:1) - at eval (<anonymous>) - at execute (deno/js/runtime.ts:[WILDCARD]) - at FileModule.compileAndRun (deno/js/runtime.ts:[WILDCARD]) + at DenoCompiler.eval [as _globalEval] (<anonymous>) + at DenoCompiler.run (deno/js/compiler.ts:[WILDCARD]) at denoMain (deno/js/main.ts:[WILDCARD]) at deno_main.js:1:1 diff --git a/tests/error_001.ts.out b/tests/error_001.ts.out index 237af9d57..04d9abb96 100644 --- a/tests/error_001.ts.out +++ b/tests/error_001.ts.out @@ -2,8 +2,7 @@ Error: bad at foo (file://[WILDCARD]tests/error_001.ts:2:9) at bar (file://[WILDCARD]tests/error_001.ts:6:3) at eval (file://[WILDCARD]tests/error_001.ts:9:1) - at eval (<anonymous>) - at execute (deno/js/runtime.ts:[WILDCARD]) - at FileModule.compileAndRun (deno/js/runtime.ts:[WILDCARD]) + at DenoCompiler.eval [as _globalEval] (<anonymous>) + at DenoCompiler.run (deno/js/compiler.ts:[WILDCARD]) at denoMain (deno/js/main.ts:[WILDCARD]) at deno_main.js:1:1 diff --git a/tests/error_002.ts.out b/tests/error_002.ts.out index f245ab7c0..20eb0c842 100644 --- a/tests/error_002.ts.out +++ b/tests/error_002.ts.out @@ -2,10 +2,9 @@ Error: exception from mod1 at Object.throwsError (file://[WILDCARD]tests/subdir/mod1.ts:16:9) at foo (file://[WILDCARD]tests/error_002.ts:4:3) at eval (file://[WILDCARD]tests/error_002.ts:7:1) - at localDefine (deno/js/runtime.ts:[WILDCARD]) + at localDefine (deno/js/compiler.ts:[WILDCARD]) at eval ([WILDCARD]tests/error_002.ts, <anonymous>) - at eval (<anonymous>) - at execute (deno/js/runtime.ts:[WILDCARD]) - at FileModule.compileAndRun (deno/js/runtime.ts:[WILDCARD]) + at DenoCompiler.eval [as _globalEval] (<anonymous>) + at DenoCompiler.run (deno/js/compiler.ts:[WILDCARD]) at denoMain (deno/js/main.ts:[WILDCARD]) at deno_main.js:1:1 diff --git a/tests/error_003_typescript.ts b/tests/error_003_typescript.ts new file mode 100644 index 000000000..ebd9fcbe6 --- /dev/null +++ b/tests/error_003_typescript.ts @@ -0,0 +1,2 @@ +// console.log intentionally misspelled to trigger TypeScript error +consol.log("hello world!"); diff --git a/tests/error_003_typescript.ts.out b/tests/error_003_typescript.ts.out new file mode 100644 index 000000000..f04be363b --- /dev/null +++ b/tests/error_003_typescript.ts.out @@ -0,0 +1,10 @@ +[96m[WILDCARD]tests/error_003_typescript.ts[WILDCARD] - [91merror[0m[90m TS2552: [0mCannot find name 'consol'. Did you mean 'console'? + +[30;47m[WILDCARD][0m consol.log("hello world!"); +[30;47m [0m [91m~~~~~~[0m + + [96m$asset$/globals.d.ts[WILDCARD] + [30;47m[WILDCARD][0m const console: Console; + [30;47m [0m [96m ~~~~~~~[0m + 'console' is declared here. + diff --git a/tests/error_004_missing_module.ts b/tests/error_004_missing_module.ts new file mode 100644 index 000000000..48623320b --- /dev/null +++ b/tests/error_004_missing_module.ts @@ -0,0 +1 @@ +import * as badModule from "bad-module.ts"; diff --git a/tests/error_004_missing_module.ts.out b/tests/error_004_missing_module.ts.out new file mode 100644 index 000000000..dda14d25e --- /dev/null +++ b/tests/error_004_missing_module.ts.out @@ -0,0 +1,12 @@ +Error: Cannot resolve module "bad-module.ts" from "[WILDCARD]error_004_missing_module.ts". + os.codeFetch message: [WILDCARD] (os error 2) + at throwResolutionError (deno/js/compiler.ts:[WILDCARD]) + at DenoCompiler.resolveModule (deno/js/compiler.ts:[WILDCARD]) + at DenoCompiler.resolveModuleName (deno/js/compiler.ts:[WILDCARD]) + at moduleNames.map.name (deno/js/compiler.ts:[WILDCARD]) + at Array.map (<anonymous>) + at DenoCompiler.resolveModuleNames (deno/js/compiler.ts:[WILDCARD]) + at Object.compilerHost.resolveModuleNames (deno/third_party/node_modules/typescript/lib/typescript.js:[WILDCARD]) + at resolveModuleNamesWorker (deno/third_party/node_modules/typescript/lib/typescript.js:[WILDCARD]) + at resolveModuleNamesReusingOldState (deno/third_party/node_modules/typescript/lib/typescript.js:[WILDCARD]) + at processImportedModules (deno/third_party/node_modules/typescript/lib/typescript.js:[WILDCARD]) |