From 046bbb26913f9da58b0d23ae331e9dab9dc19e59 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Wed, 19 Feb 2020 16:34:11 +1100 Subject: Support loading additional TS lib files (#3863) Fixes #3726 This PR provides support for referencing other lib files (like lib.dom.d.ts that are not used by default in Deno. --- cli/tests/integration_tests.rs | 10 ++++++++++ cli/tests/lib_ref.ts | 13 +++++++++++++ cli/tests/lib_ref.ts.out | 2 ++ cli/tests/lib_runtime_api.ts | 12 ++++++++++++ cli/tests/lib_runtime_api.ts.out | 2 ++ 5 files changed, 39 insertions(+) create mode 100644 cli/tests/lib_ref.ts create mode 100644 cli/tests/lib_ref.ts.out create mode 100644 cli/tests/lib_runtime_api.ts create mode 100644 cli/tests/lib_runtime_api.ts.out (limited to 'cli/tests') diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 38c870200..ebb0349c5 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -833,6 +833,16 @@ itest!(import_meta { output: "import_meta.ts.out", }); +itest!(lib_ref { + args: "run --reload lib_ref.ts", + output: "lib_ref.ts.out", +}); + +itest!(lib_runtime_api { + args: "run --reload lib_runtime_api.ts", + output: "lib_runtime_api.ts.out", +}); + itest!(seed_random { args: "run --seed=100 seed_random.js", output: "seed_random.js.out", diff --git a/cli/tests/lib_ref.ts b/cli/tests/lib_ref.ts new file mode 100644 index 000000000..9fc84ea3e --- /dev/null +++ b/cli/tests/lib_ref.ts @@ -0,0 +1,13 @@ +const [errors, program] = await Deno.compile( + "main.ts", + { + "main.ts": `/// \n\ndocument.getElementById("foo");\nDeno.args;` + }, + { + target: "es2018", + lib: ["es2018", "deno.ns"] + } +); + +console.log(errors); +console.log(Object.keys(program)); diff --git a/cli/tests/lib_ref.ts.out b/cli/tests/lib_ref.ts.out new file mode 100644 index 000000000..6ff3616b7 --- /dev/null +++ b/cli/tests/lib_ref.ts.out @@ -0,0 +1,2 @@ +null +[ "main.js.map", "main.js" ] diff --git a/cli/tests/lib_runtime_api.ts b/cli/tests/lib_runtime_api.ts new file mode 100644 index 000000000..848b523a1 --- /dev/null +++ b/cli/tests/lib_runtime_api.ts @@ -0,0 +1,12 @@ +const [errors, program] = await Deno.compile( + "main.ts", + { + "main.ts": `document.getElementById("foo");` + }, + { + lib: ["dom", "esnext"] + } +); + +console.log(errors); +console.log(Object.keys(program)); diff --git a/cli/tests/lib_runtime_api.ts.out b/cli/tests/lib_runtime_api.ts.out new file mode 100644 index 000000000..6ff3616b7 --- /dev/null +++ b/cli/tests/lib_runtime_api.ts.out @@ -0,0 +1,2 @@ +null +[ "main.js.map", "main.js" ] -- cgit v1.2.3