summaryrefslogtreecommitdiff
path: root/cli/tests/compiler_api_test.ts
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2020-06-12 20:23:38 +0100
committerGitHub <noreply@github.com>2020-06-12 15:23:38 -0400
commit1fff6f55c3ba98a10018c6d374795e612061e9b6 (patch)
tree12074b6d44736b11513d857e437f9e30a6bf65a4 /cli/tests/compiler_api_test.ts
parent26bf56afdaf16634ffbaa23684faf3a44cc10f62 (diff)
refactor: Don't destructure the Deno namespace (#6268)
Diffstat (limited to 'cli/tests/compiler_api_test.ts')
-rw-r--r--cli/tests/compiler_api_test.ts50
1 files changed, 24 insertions, 26 deletions
diff --git a/cli/tests/compiler_api_test.ts b/cli/tests/compiler_api_test.ts
index cdc2be6d2..967220cb4 100644
--- a/cli/tests/compiler_api_test.ts
+++ b/cli/tests/compiler_api_test.ts
@@ -1,10 +1,8 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-
import { assert, assertEquals } from "../../std/testing/asserts.ts";
-const { compile, transpileOnly, bundle, test } = Deno;
-test("compilerApiCompileSources", async function () {
- const [diagnostics, actual] = await compile("/foo.ts", {
+Deno.test("compilerApiCompileSources", async function () {
+ const [diagnostics, actual] = await Deno.compile("/foo.ts", {
"/foo.ts": `import * as bar from "./bar.ts";\n\nconsole.log(bar);\n`,
"/bar.ts": `export const bar = "bar";\n`,
});
@@ -18,8 +16,8 @@ test("compilerApiCompileSources", async function () {
]);
});
-test("compilerApiCompileNoSources", async function () {
- const [diagnostics, actual] = await compile("./subdir/mod1.ts");
+Deno.test("compilerApiCompileNoSources", async function () {
+ const [diagnostics, actual] = await Deno.compile("./subdir/mod1.ts");
assert(diagnostics == null);
assert(actual);
const keys = Object.keys(actual);
@@ -28,8 +26,8 @@ test("compilerApiCompileNoSources", async function () {
assert(keys[1].endsWith("print_hello.js"));
});
-test("compilerApiCompileOptions", async function () {
- const [diagnostics, actual] = await compile(
+Deno.test("compilerApiCompileOptions", async function () {
+ const [diagnostics, actual] = await Deno.compile(
"/foo.ts",
{
"/foo.ts": `export const foo = "foo";`,
@@ -45,8 +43,8 @@ test("compilerApiCompileOptions", async function () {
assert(actual["/foo.js"].startsWith("define("));
});
-test("compilerApiCompileLib", async function () {
- const [diagnostics, actual] = await compile(
+Deno.test("compilerApiCompileLib", async function () {
+ const [diagnostics, actual] = await Deno.compile(
"/foo.ts",
{
"/foo.ts": `console.log(document.getElementById("foo"));
@@ -61,8 +59,8 @@ test("compilerApiCompileLib", async function () {
assertEquals(Object.keys(actual), ["/foo.js.map", "/foo.js"]);
});
-test("compilerApiCompileTypes", async function () {
- const [diagnostics, actual] = await compile(
+Deno.test("compilerApiCompileTypes", async function () {
+ const [diagnostics, actual] = await Deno.compile(
"/foo.ts",
{
"/foo.ts": `console.log(Foo.bar);`,
@@ -76,8 +74,8 @@ test("compilerApiCompileTypes", async function () {
assertEquals(Object.keys(actual), ["/foo.js.map", "/foo.js"]);
});
-test("transpileOnlyApi", async function () {
- const actual = await transpileOnly({
+Deno.test("transpileOnlyApi", async function () {
+ const actual = await Deno.transpileOnly({
"foo.ts": `export enum Foo { Foo, Bar, Baz };\n`,
});
assert(actual);
@@ -86,8 +84,8 @@ test("transpileOnlyApi", async function () {
assert(actual["foo.ts"].map);
});
-test("transpileOnlyApiConfig", async function () {
- const actual = await transpileOnly(
+Deno.test("transpileOnlyApiConfig", async function () {
+ const actual = await Deno.transpileOnly(
{
"foo.ts": `export enum Foo { Foo, Bar, Baz };\n`,
},
@@ -102,8 +100,8 @@ test("transpileOnlyApiConfig", async function () {
assert(actual["foo.ts"].map == null);
});
-test("bundleApiSources", async function () {
- const [diagnostics, actual] = await bundle("/foo.ts", {
+Deno.test("bundleApiSources", async function () {
+ const [diagnostics, actual] = await Deno.bundle("/foo.ts", {
"/foo.ts": `export * from "./bar.ts";\n`,
"/bar.ts": `export const bar = "bar";\n`,
});
@@ -112,15 +110,15 @@ test("bundleApiSources", async function () {
assert(actual.includes(`__exp["bar"]`));
});
-test("bundleApiNoSources", async function () {
- const [diagnostics, actual] = await bundle("./subdir/mod1.ts");
+Deno.test("bundleApiNoSources", async function () {
+ const [diagnostics, actual] = await Deno.bundle("./subdir/mod1.ts");
assert(diagnostics == null);
assert(actual.includes(`__instantiate("mod1")`));
assert(actual.includes(`__exp["printHello3"]`));
});
-test("bundleApiConfig", async function () {
- const [diagnostics, actual] = await bundle(
+Deno.test("bundleApiConfig", async function () {
+ const [diagnostics, actual] = await Deno.bundle(
"/foo.ts",
{
"/foo.ts": `// random comment\nexport * from "./bar.ts";\n`,
@@ -134,8 +132,8 @@ test("bundleApiConfig", async function () {
assert(!actual.includes(`random`));
});
-test("bundleApiJsModules", async function () {
- const [diagnostics, actual] = await bundle("/foo.js", {
+Deno.test("bundleApiJsModules", async function () {
+ const [diagnostics, actual] = await Deno.bundle("/foo.js", {
"/foo.js": `export * from "./bar.js";\n`,
"/bar.js": `export const bar = "bar";\n`,
});
@@ -143,8 +141,8 @@ test("bundleApiJsModules", async function () {
assert(actual.includes(`System.register("bar",`));
});
-test("diagnosticsTest", async function () {
- const [diagnostics] = await compile("/foo.ts", {
+Deno.test("diagnosticsTest", async function () {
+ const [diagnostics] = await Deno.compile("/foo.ts", {
"/foo.ts": `document.getElementById("foo");`,
});
assert(Array.isArray(diagnostics));