Skip to main content

Test on LocalHost

Create a localhost server and run tests.

Usage

Programmatically

import run from "https://deno.land/x/test_on_localhost@0.2.2/run.ts";

const { success, code } = await run({
  hostname: "0.0.0.0",
  port: 8080,
  list: ["test/foo.ts", "test/bar.ts"],
});

if (success) {
  console.log("all tests passed.");
} else {
  console.log("some tests failed.");
  console.log("status", status);
  Deno.exit(status);
}

Command-Line

File cli.ts can be used as your test runner cli.

deno -A https://deno.land/x/test_on_localhost@0.2.2/cli.ts \
  --host 0.0.0.0 \
  --port 8080 \
  test/foo.ts test/bar.ts

Real-world Examples

License

MIT © Hoàng Văn Khải