summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/015_duplicate_parallel_import.js2
-rw-r--r--cli/tests/045_proxy_test.ts12
-rw-r--r--cli/tests/053_import_compression/main.ts4
-rw-r--r--cli/tests/057_revoke_permissions.ts2
-rw-r--r--cli/tests/cafile_ts_fetch.ts4
-rw-r--r--cli/tests/compiler_api_test.ts32
-rw-r--r--cli/tests/complex_permissions_test.ts14
-rw-r--r--cli/tests/error_003_typescript.ts12
-rw-r--r--cli/tests/lib_ref.ts4
-rw-r--r--cli/tests/lib_runtime_api.ts4
-rw-r--r--cli/tests/lock_write_fetch.ts10
-rw-r--r--cli/tests/permission_test.ts6
-rw-r--r--cli/tests/subdir/bench_worker.ts4
-rw-r--r--cli/tests/subdir/nested_worker.js8
-rw-r--r--cli/tests/subdir/sibling_worker.js2
-rw-r--r--cli/tests/subdir/test_worker.js4
-rw-r--r--cli/tests/subdir/test_worker.ts2
-rw-r--r--cli/tests/subdir/test_worker_basic.js4
-rw-r--r--cli/tests/workers_test.ts26
19 files changed, 78 insertions, 78 deletions
diff --git a/cli/tests/015_duplicate_parallel_import.js b/cli/tests/015_duplicate_parallel_import.js
index 37033cfa2..172eeaf53 100644
--- a/cli/tests/015_duplicate_parallel_import.js
+++ b/cli/tests/015_duplicate_parallel_import.js
@@ -5,7 +5,7 @@ const promises = new Array(100)
.fill(null)
.map(() => import("./subdir/mod1.ts"));
-Promise.all(promises).then(imports => {
+Promise.all(promises).then((imports) => {
const mod = imports.reduce((first, cur) => {
if (typeof first !== "object") {
throw new Error("Expected an object.");
diff --git a/cli/tests/045_proxy_test.ts b/cli/tests/045_proxy_test.ts
index 98293c2a0..6f8b45fd1 100644
--- a/cli/tests/045_proxy_test.ts
+++ b/cli/tests/045_proxy_test.ts
@@ -17,7 +17,7 @@ async function proxyRequest(req: ServerRequest): Promise<void> {
console.log(`Proxy request to: ${req.url}`);
const resp = await fetch(req.url, {
method: req.method,
- headers: req.headers
+ headers: req.headers,
});
req.respond(resp);
}
@@ -27,8 +27,8 @@ async function testFetch(): Promise<void> {
cmd: [Deno.execPath(), "--reload", "--allow-net", "045_proxy_client.ts"],
stdout: "piped",
env: {
- HTTP_PROXY: `http://${addr}`
- }
+ HTTP_PROXY: `http://${addr}`,
+ },
});
const status = await c.status();
@@ -42,12 +42,12 @@ async function testModuleDownload(): Promise<void> {
Deno.execPath(),
"--reload",
"fetch",
- "http://localhost:4545/std/examples/colors.ts"
+ "http://localhost:4545/std/examples/colors.ts",
],
stdout: "piped",
env: {
- HTTP_PROXY: `http://${addr}`
- }
+ HTTP_PROXY: `http://${addr}`,
+ },
});
const httpStatus = await http.status();
diff --git a/cli/tests/053_import_compression/main.ts b/cli/tests/053_import_compression/main.ts
index b6f7e2c9a..d18363b7d 100644
--- a/cli/tests/053_import_compression/main.ts
+++ b/cli/tests/053_import_compression/main.ts
@@ -4,10 +4,10 @@ import "http://127.0.0.1:4545/cli/tests/053_import_compression/brotli";
console.log(
await fetch(
"http://127.0.0.1:4545/cli/tests/053_import_compression/gziped"
- ).then(res => res.text())
+ ).then((res) => res.text())
);
console.log(
await fetch(
"http://127.0.0.1:4545/cli/tests/053_import_compression/brotli"
- ).then(res => res.text())
+ ).then((res) => res.text())
);
diff --git a/cli/tests/057_revoke_permissions.ts b/cli/tests/057_revoke_permissions.ts
index 4481dbfd9..d93ae3538 100644
--- a/cli/tests/057_revoke_permissions.ts
+++ b/cli/tests/057_revoke_permissions.ts
@@ -7,7 +7,7 @@ const knownPermissions: Deno.PermissionName[] = [
"net",
"env",
"plugin",
- "hrtime"
+ "hrtime",
];
export function assert(cond: unknown): asserts cond {
diff --git a/cli/tests/cafile_ts_fetch.ts b/cli/tests/cafile_ts_fetch.ts
index be158bf70..14f39ef97 100644
--- a/cli/tests/cafile_ts_fetch.ts
+++ b/cli/tests/cafile_ts_fetch.ts
@@ -1,3 +1,3 @@
fetch("https://localhost:5545/cli/tests/cafile_ts_fetch.ts.out")
- .then(r => r.text())
- .then(t => console.log(t.trimEnd()));
+ .then((r) => r.text())
+ .then((t) => console.log(t.trimEnd()));
diff --git a/cli/tests/compiler_api_test.ts b/cli/tests/compiler_api_test.ts
index 540ac6680..4886e03b8 100644
--- a/cli/tests/compiler_api_test.ts
+++ b/cli/tests/compiler_api_test.ts
@@ -6,7 +6,7 @@ const { compile, transpileOnly, bundle, test } = Deno;
test(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`
+ "/bar.ts": `export const bar = "bar";\n`,
});
assert(diagnostics == null);
assert(actual);
@@ -14,7 +14,7 @@ test(async function compilerApiCompileSources() {
"/bar.js.map",
"/bar.js",
"/foo.js.map",
- "/foo.js"
+ "/foo.js",
]);
});
@@ -32,11 +32,11 @@ test(async function compilerApiCompileOptions() {
const [diagnostics, actual] = await compile(
"/foo.ts",
{
- "/foo.ts": `export const foo = "foo";`
+ "/foo.ts": `export const foo = "foo";`,
},
{
module: "amd",
- sourceMap: false
+ sourceMap: false,
}
);
assert(diagnostics == null);
@@ -50,10 +50,10 @@ test(async function compilerApiCompileLib() {
"/foo.ts",
{
"/foo.ts": `console.log(document.getElementById("foo"));
- console.log(Deno.args);`
+ console.log(Deno.args);`,
},
{
- lib: ["dom", "es2018", "deno.ns"]
+ lib: ["dom", "es2018", "deno.ns"],
}
);
assert(diagnostics == null);
@@ -65,10 +65,10 @@ test(async function compilerApiCompileTypes() {
const [diagnostics, actual] = await compile(
"/foo.ts",
{
- "/foo.ts": `console.log(Foo.bar);`
+ "/foo.ts": `console.log(Foo.bar);`,
},
{
- types: ["./subdir/foo_types.d.ts"]
+ types: ["./subdir/foo_types.d.ts"],
}
);
assert(diagnostics == null);
@@ -78,7 +78,7 @@ test(async function compilerApiCompileTypes() {
test(async function transpileOnlyApi() {
const actual = await transpileOnly({
- "foo.ts": `export enum Foo { Foo, Bar, Baz };\n`
+ "foo.ts": `export enum Foo { Foo, Bar, Baz };\n`,
});
assert(actual);
assertEquals(Object.keys(actual), ["foo.ts"]);
@@ -89,11 +89,11 @@ test(async function transpileOnlyApi() {
test(async function transpileOnlyApiConfig() {
const actual = await transpileOnly(
{
- "foo.ts": `export enum Foo { Foo, Bar, Baz };\n`
+ "foo.ts": `export enum Foo { Foo, Bar, Baz };\n`,
},
{
sourceMap: false,
- module: "amd"
+ module: "amd",
}
);
assert(actual);
@@ -105,7 +105,7 @@ test(async function transpileOnlyApiConfig() {
test(async function bundleApiSources() {
const [diagnostics, actual] = await bundle("/foo.ts", {
"/foo.ts": `export * from "./bar.ts";\n`,
- "/bar.ts": `export const bar = "bar";\n`
+ "/bar.ts": `export const bar = "bar";\n`,
});
assert(diagnostics == null);
assert(actual.includes(`__instantiate("foo")`));
@@ -124,10 +124,10 @@ test(async function bundleApiConfig() {
"/foo.ts",
{
"/foo.ts": `// random comment\nexport * from "./bar.ts";\n`,
- "/bar.ts": `export const bar = "bar";\n`
+ "/bar.ts": `export const bar = "bar";\n`,
},
{
- removeComments: true
+ removeComments: true,
}
);
assert(diagnostics == null);
@@ -137,7 +137,7 @@ test(async function bundleApiConfig() {
test(async function bundleApiJsModules() {
const [diagnostics, actual] = await bundle("/foo.js", {
"/foo.js": `export * from "./bar.js";\n`,
- "/bar.js": `export const bar = "bar";\n`
+ "/bar.js": `export const bar = "bar";\n`,
});
assert(diagnostics == null);
assert(actual.includes(`System.register("bar",`));
@@ -145,7 +145,7 @@ test(async function bundleApiJsModules() {
test(async function diagnosticsTest() {
const [diagnostics] = await compile("/foo.ts", {
- "/foo.ts": `document.getElementById("foo");`
+ "/foo.ts": `document.getElementById("foo");`,
});
assert(Array.isArray(diagnostics));
assert(diagnostics.length === 1);
diff --git a/cli/tests/complex_permissions_test.ts b/cli/tests/complex_permissions_test.ts
index 401c8cd81..55b4ead35 100644
--- a/cli/tests/complex_permissions_test.ts
+++ b/cli/tests/complex_permissions_test.ts
@@ -4,23 +4,23 @@ const { args, readFileSync, writeFileSync, exit } = Deno;
const name = args[0];
const test: { [key: string]: Function } = {
read(files: string[]): void {
- files.forEach(file => readFileSync(file));
+ files.forEach((file) => readFileSync(file));
},
write(files: string[]): void {
- files.forEach(file =>
+ files.forEach((file) =>
writeFileSync(file, new Uint8Array(0), { append: true })
);
},
netFetch(hosts: string[]): void {
- hosts.forEach(host => fetch(host));
+ hosts.forEach((host) => fetch(host));
},
netListen(endpoints: string[]): void {
- endpoints.forEach(endpoint => {
+ endpoints.forEach((endpoint) => {
const [hostname, port] = endpoint.split(":");
const listener = Deno.listen({
transport: "tcp",
hostname,
- port: parseInt(port, 10)
+ port: parseInt(port, 10),
});
listener.close();
});
@@ -31,11 +31,11 @@ const test: { [key: string]: Function } = {
const listener = await Deno.connect({
transport: "tcp",
hostname,
- port: parseInt(port, 10)
+ port: parseInt(port, 10),
});
listener.close();
}
- }
+ },
};
if (!test[name]) {
diff --git a/cli/tests/error_003_typescript.ts b/cli/tests/error_003_typescript.ts
index 4ce86bb83..e06e466e7 100644
--- a/cli/tests/error_003_typescript.ts
+++ b/cli/tests/error_003_typescript.ts
@@ -4,17 +4,17 @@ let x = {
b: {
c() {
return { d: "hello" };
- }
- }
- }
+ },
+ },
+ },
};
let y = {
a: {
b: {
c() {
return { d: 1234 };
- }
- }
- }
+ },
+ },
+ },
};
x = y;
diff --git a/cli/tests/lib_ref.ts b/cli/tests/lib_ref.ts
index 9fc84ea3e..1b9f243c8 100644
--- a/cli/tests/lib_ref.ts
+++ b/cli/tests/lib_ref.ts
@@ -1,11 +1,11 @@
const [errors, program] = await Deno.compile(
"main.ts",
{
- "main.ts": `/// <reference lib="dom" />\n\ndocument.getElementById("foo");\nDeno.args;`
+ "main.ts": `/// <reference lib="dom" />\n\ndocument.getElementById("foo");\nDeno.args;`,
},
{
target: "es2018",
- lib: ["es2018", "deno.ns"]
+ lib: ["es2018", "deno.ns"],
}
);
diff --git a/cli/tests/lib_runtime_api.ts b/cli/tests/lib_runtime_api.ts
index 848b523a1..5d76ea1c5 100644
--- a/cli/tests/lib_runtime_api.ts
+++ b/cli/tests/lib_runtime_api.ts
@@ -1,10 +1,10 @@
const [errors, program] = await Deno.compile(
"main.ts",
{
- "main.ts": `document.getElementById("foo");`
+ "main.ts": `document.getElementById("foo");`,
},
{
- lib: ["dom", "esnext"]
+ lib: ["dom", "esnext"],
}
);
diff --git a/cli/tests/lock_write_fetch.ts b/cli/tests/lock_write_fetch.ts
index 206a2f864..2e9735313 100644
--- a/cli/tests/lock_write_fetch.ts
+++ b/cli/tests/lock_write_fetch.ts
@@ -11,8 +11,8 @@ const fetchProc = Deno.run({
"--reload",
"--lock=lock_write_fetch.json",
"--lock-write",
- "https_import.ts"
- ]
+ "https_import.ts",
+ ],
});
const fetchCode = (await fetchProc.status()).code;
@@ -25,8 +25,8 @@ const fetchCheckProc = Deno.run({
Deno.execPath(),
"fetch",
"--lock=lock_write_fetch.json",
- "https_import.ts"
- ]
+ "https_import.ts",
+ ],
});
const fetchCheckProcCode = (await fetchCheckProc.status()).code;
@@ -35,7 +35,7 @@ console.log(`fetch check code: ${fetchCheckProcCode}`);
const runProc = Deno.run({
stdout: "null",
stderr: "null",
- cmd: [Deno.execPath(), "--lock=lock_write_fetch.json", "https_import.ts"]
+ cmd: [Deno.execPath(), "--lock=lock_write_fetch.json", "https_import.ts"],
});
const runCode = (await runProc.status()).code;
diff --git a/cli/tests/permission_test.ts b/cli/tests/permission_test.ts
index 33c3859cb..1e6abae21 100644
--- a/cli/tests/permission_test.ts
+++ b/cli/tests/permission_test.ts
@@ -21,10 +21,10 @@ const test: { [key: string]: Function } = {
cmd: [
"python",
"-c",
- "import sys; sys.stdout.write('hello'); sys.stdout.flush()"
- ]
+ "import sys; sys.stdout.write('hello'); sys.stdout.flush()",
+ ],
});
- }
+ },
};
if (!test[name]) {
diff --git a/cli/tests/subdir/bench_worker.ts b/cli/tests/subdir/bench_worker.ts
index 619a35fa2..7e85eed03 100644
--- a/cli/tests/subdir/bench_worker.ts
+++ b/cli/tests/subdir/bench_worker.ts
@@ -1,10 +1,10 @@
-onmessage = function(e): void {
+onmessage = function (e): void {
const { cmdId, action, data } = e.data;
switch (action) {
case 0: // Static response
postMessage({
cmdId,
- data: "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n"
+ data: "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n",
});
break;
case 1: // Respond with request data
diff --git a/cli/tests/subdir/nested_worker.js b/cli/tests/subdir/nested_worker.js
index a4eed723a..f5ac23a19 100644
--- a/cli/tests/subdir/nested_worker.js
+++ b/cli/tests/subdir/nested_worker.js
@@ -1,18 +1,18 @@
// Specifier should be resolved relative to current file
const jsWorker = new Worker("./sibling_worker.js", {
type: "module",
- name: "sibling"
+ name: "sibling",
});
-jsWorker.onerror = _e => {
+jsWorker.onerror = (_e) => {
postMessage({ type: "error" });
};
-jsWorker.onmessage = e => {
+jsWorker.onmessage = (e) => {
postMessage({ type: "msg", text: e });
close();
};
-onmessage = function(e) {
+onmessage = function (e) {
jsWorker.postMessage(e.data);
};
diff --git a/cli/tests/subdir/sibling_worker.js b/cli/tests/subdir/sibling_worker.js
index 0e91141ce..99707e5d6 100644
--- a/cli/tests/subdir/sibling_worker.js
+++ b/cli/tests/subdir/sibling_worker.js
@@ -1,4 +1,4 @@
-onmessage = e => {
+onmessage = (e) => {
postMessage(e.data);
close();
};
diff --git a/cli/tests/subdir/test_worker.js b/cli/tests/subdir/test_worker.js
index 9c1e555b5..02cd86eac 100644
--- a/cli/tests/subdir/test_worker.js
+++ b/cli/tests/subdir/test_worker.js
@@ -4,7 +4,7 @@ if (self.name !== "jsWorker") {
throw Error(`Bad worker name: ${self.name}, expected jsWorker`);
}
-onmessage = function(e) {
+onmessage = function (e) {
if (thrown === false) {
thrown = true;
throw new SyntaxError("[test error]");
@@ -14,6 +14,6 @@ onmessage = function(e) {
close();
};
-onerror = function() {
+onerror = function () {
return false;
};
diff --git a/cli/tests/subdir/test_worker.ts b/cli/tests/subdir/test_worker.ts
index 1f924c073..ca79dcfe4 100644
--- a/cli/tests/subdir/test_worker.ts
+++ b/cli/tests/subdir/test_worker.ts
@@ -2,7 +2,7 @@ if (self.name !== "tsWorker") {
throw Error(`Invalid worker name: ${self.name}, expected tsWorker`);
}
-onmessage = function(e): void {
+onmessage = function (e): void {
postMessage(e.data);
close();
};
diff --git a/cli/tests/subdir/test_worker_basic.js b/cli/tests/subdir/test_worker_basic.js
index aef1658c0..aea360872 100644
--- a/cli/tests/subdir/test_worker_basic.js
+++ b/cli/tests/subdir/test_worker_basic.js
@@ -5,11 +5,11 @@ if (self.name !== "jsWorker") {
throw Error(`Bad worker name: ${self.name}, expected jsWorker`);
}
-onmessage = function(e) {
+onmessage = function (e) {
postMessage(e.data);
close();
};
-onerror = function() {
+onerror = function () {
return false;
};
diff --git a/cli/tests/workers_test.ts b/cli/tests/workers_test.ts
index 84eeabf12..42bd96d96 100644
--- a/cli/tests/workers_test.ts
+++ b/cli/tests/workers_test.ts
@@ -31,15 +31,15 @@ Deno.test({
name: "workersBasic",
// FIXME(bartlomieju):
disableOpSanitizer: true,
- fn: async function(): Promise<void> {
+ fn: async function (): Promise<void> {
const promise = createResolvable();
const jsWorker = new Worker("../tests/subdir/test_worker.js", {
type: "module",
- name: "jsWorker"
+ name: "jsWorker",
});
const tsWorker = new Worker("../tests/subdir/test_worker.ts", {
type: "module",
- name: "tsWorker"
+ name: "tsWorker",
});
tsWorker.onmessage = (e): void => {
@@ -59,19 +59,19 @@ Deno.test({
jsWorker.postMessage("Hello World");
await promise;
- }
+ },
});
Deno.test({
name: "nestedWorker",
// FIXME(bartlomieju):
disableOpSanitizer: true,
- fn: async function(): Promise<void> {
+ fn: async function (): Promise<void> {
const promise = createResolvable();
const nestedWorker = new Worker("../tests/subdir/nested_worker.js", {
type: "module",
- name: "nested"
+ name: "nested",
});
nestedWorker.onmessage = (e): void => {
@@ -81,17 +81,17 @@ Deno.test({
nestedWorker.postMessage("Hello World");
await promise;
- }
+ },
});
Deno.test({
name: "workerThrowsWhenExecuting",
// FIXME(bartlomieju):
disableOpSanitizer: true,
- fn: async function(): Promise<void> {
+ fn: async function (): Promise<void> {
const promise = createResolvable();
const throwingWorker = new Worker("../tests/subdir/throwing_worker.js", {
- type: "module"
+ type: "module",
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -102,18 +102,18 @@ Deno.test({
};
await promise;
- }
+ },
});
Deno.test({
name: "workerCanUseFetch",
// FIXME(bartlomieju):
disableOpSanitizer: true,
- fn: async function(): Promise<void> {
+ fn: async function (): Promise<void> {
const promise = createResolvable();
const fetchingWorker = new Worker("../tests/subdir/fetching_worker.js", {
- type: "module"
+ type: "module",
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -129,5 +129,5 @@ Deno.test({
};
await promise;
- }
+ },
});