summaryrefslogtreecommitdiff
path: root/std/http/testdata
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2020-09-14 18:58:43 +0800
committerGitHub <noreply@github.com>2020-09-14 12:58:43 +0200
commitbee36a4de8516aa222bbb2b6650974bdd7cb57f4 (patch)
tree68abd673e6fa3e1fbcf68772e79eb904680e4d16 /std/http/testdata
parentf874b83aa06c183400bbe04bc35e87acbaad9699 (diff)
test(std/http): make tests runnable from any directory (#7441)
This makes std/http tests runnable from any directory by spawning test processes in the module directory resolved from import.meta.url and resolving test data relative to the same module directory.
Diffstat (limited to 'std/http/testdata')
-rw-r--r--std/http/testdata/file_server_as_library.ts6
-rw-r--r--std/http/testdata/simple_https_server.ts6
2 files changed, 6 insertions, 6 deletions
diff --git a/std/http/testdata/file_server_as_library.ts b/std/http/testdata/file_server_as_library.ts
index ab5fdcaab..cd4bf68db 100644
--- a/std/http/testdata/file_server_as_library.ts
+++ b/std/http/testdata/file_server_as_library.ts
@@ -3,10 +3,10 @@ import { serveFile } from "../file_server.ts";
const server = serve({ port: 8000 });
-console.log('Server running...');
+console.log("Server running...");
for await (const req of server) {
- serveFile(req, './http/testdata/hello.html').then(response => {
+ serveFile(req, "./testdata/hello.html").then((response) => {
req.respond(response);
});
-} \ No newline at end of file
+}
diff --git a/std/http/testdata/simple_https_server.ts b/std/http/testdata/simple_https_server.ts
index 9330b4172..de6111bbf 100644
--- a/std/http/testdata/simple_https_server.ts
+++ b/std/http/testdata/simple_https_server.ts
@@ -5,12 +5,12 @@ import { serveTLS } from "../server.ts";
const tlsOptions = {
hostname: "localhost",
port: 4503,
- certFile: "./http/testdata/tls/localhost.crt",
- keyFile: "./http/testdata/tls/localhost.key"
+ certFile: "./testdata/tls/localhost.crt",
+ keyFile: "./testdata/tls/localhost.key",
};
const s = serveTLS(tlsOptions);
console.log(
- `Simple HTTPS server listening on ${tlsOptions.hostname}:${tlsOptions.port}`
+ `Simple HTTPS server listening on ${tlsOptions.hostname}:${tlsOptions.port}`,
);
const body = new TextEncoder().encode("Hello HTTPS");
for await (const req of s) {