summaryrefslogtreecommitdiff
path: root/cli/js/compiler_api_test.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-03-04 17:31:14 +0100
committerGitHub <noreply@github.com>2020-03-04 17:31:14 +0100
commit8d96dffa410a149d0fff6115bd97f41fc1fe7459 (patch)
treeb00dc7a78e5030b68741de8bf9dde83b9fa07364 /cli/js/compiler_api_test.ts
parent30682cf74fa039d3493c74101dca2dbb3a8d49b6 (diff)
refactor: rewrite testPerm into unitTest (#4231)
Rewrite "testPerm" helper function used for testing of internal runtime code. It's been renamed to "unitTest" and provides API that is extensible in the future by accepting optional "UnitTestOptions" argument. "test" helper was also removed and replaced by overloaded version of "unitTest" that takes only function argument. "UnitTestOptions" currently supports "perms" and "skip" options, where former works exactly as first argument to "testPerm" did, while the latter allows to conditionally skip tests.
Diffstat (limited to 'cli/js/compiler_api_test.ts')
-rw-r--r--cli/js/compiler_api_test.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/cli/js/compiler_api_test.ts b/cli/js/compiler_api_test.ts
index 762e7378c..3b0449f9a 100644
--- a/cli/js/compiler_api_test.ts
+++ b/cli/js/compiler_api_test.ts
@@ -1,10 +1,10 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { assert, assertEquals, test } from "./test_util.ts";
+import { assert, assertEquals, unitTest } from "./test_util.ts";
const { compile, transpileOnly, bundle } = Deno;
-test(async function compilerApiCompileSources() {
+unitTest(async function compilerApiCompileSources() {
const [diagnostics, actual] = await compile("/foo.ts", {
"/foo.ts": `import * as bar from "./bar.ts";\n\nconsole.log(bar);\n`,
"/bar.ts": `export const bar = "bar";\n`
@@ -19,7 +19,7 @@ test(async function compilerApiCompileSources() {
]);
});
-test(async function compilerApiCompileNoSources() {
+unitTest(async function compilerApiCompileNoSources() {
const [diagnostics, actual] = await compile("./cli/tests/subdir/mod1.ts");
assert(diagnostics == null);
assert(actual);
@@ -29,7 +29,7 @@ test(async function compilerApiCompileNoSources() {
assert(keys[1].endsWith("print_hello.js"));
});
-test(async function compilerApiCompileOptions() {
+unitTest(async function compilerApiCompileOptions() {
const [diagnostics, actual] = await compile(
"/foo.ts",
{
@@ -46,7 +46,7 @@ test(async function compilerApiCompileOptions() {
assert(actual["/foo.js"].startsWith("define("));
});
-test(async function compilerApiCompileLib() {
+unitTest(async function compilerApiCompileLib() {
const [diagnostics, actual] = await compile(
"/foo.ts",
{
@@ -62,7 +62,7 @@ test(async function compilerApiCompileLib() {
assertEquals(Object.keys(actual), ["/foo.js.map", "/foo.js"]);
});
-test(async function compilerApiCompileTypes() {
+unitTest(async function compilerApiCompileTypes() {
const [diagnostics, actual] = await compile(
"/foo.ts",
{
@@ -77,7 +77,7 @@ test(async function compilerApiCompileTypes() {
assertEquals(Object.keys(actual), ["/foo.js.map", "/foo.js"]);
});
-test(async function transpileOnlyApi() {
+unitTest(async function transpileOnlyApi() {
const actual = await transpileOnly({
"foo.ts": `export enum Foo { Foo, Bar, Baz };\n`
});
@@ -87,7 +87,7 @@ test(async function transpileOnlyApi() {
assert(actual["foo.ts"].map);
});
-test(async function transpileOnlyApiConfig() {
+unitTest(async function transpileOnlyApiConfig() {
const actual = await transpileOnly(
{
"foo.ts": `export enum Foo { Foo, Bar, Baz };\n`
@@ -103,7 +103,7 @@ test(async function transpileOnlyApiConfig() {
assert(actual["foo.ts"].map == null);
});
-test(async function bundleApiSources() {
+unitTest(async function bundleApiSources() {
const [diagnostics, actual] = await bundle("/foo.ts", {
"/foo.ts": `export * from "./bar.ts";\n`,
"/bar.ts": `export const bar = "bar";\n`
@@ -113,14 +113,14 @@ test(async function bundleApiSources() {
assert(actual.includes(`__exp["bar"]`));
});
-test(async function bundleApiNoSources() {
+unitTest(async function bundleApiNoSources() {
const [diagnostics, actual] = await bundle("./cli/tests/subdir/mod1.ts");
assert(diagnostics == null);
assert(actual.includes(`__instantiate("mod1")`));
assert(actual.includes(`__exp["printHello3"]`));
});
-test(async function bundleApiConfig() {
+unitTest(async function bundleApiConfig() {
const [diagnostics, actual] = await bundle(
"/foo.ts",
{
@@ -135,7 +135,7 @@ test(async function bundleApiConfig() {
assert(!actual.includes(`random`));
});
-test(async function bundleApiJsModules() {
+unitTest(async function bundleApiJsModules() {
const [diagnostics, actual] = await bundle("/foo.js", {
"/foo.js": `export * from "./bar.js";\n`,
"/bar.js": `export const bar = "bar";\n`
@@ -144,7 +144,7 @@ test(async function bundleApiJsModules() {
assert(actual.includes(`System.register("bar",`));
});
-test(async function diagnosticsTest() {
+unitTest(async function diagnosticsTest() {
const [diagnostics] = await compile("/foo.ts", {
"/foo.ts": `document.getElementById("foo");`
});