Skip to content

Commit

Permalink
refactor: use jsr for test
Browse files Browse the repository at this point in the history
  • Loading branch information
sylc committed Apr 21, 2024
1 parent 768b6ac commit 85621f0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const run = async () => {
}
// list processes
const pList = await procList();
const pickedProcesses: string[] = await Checkbox.prompt({
const pickedProcesses: string[] = await Checkbox.prompt<string>({
message: "Pick processes to kill",
options: pList.map((item) => ({
name: `${item.pid} | ${item.proc} | ${item.cmd}`,
Expand Down
15 changes: 15 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions deps_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ export {
assertEquals,
assertNotEquals,
assertStringIncludes,
} from "https://deno.land/std@0.170.0/testing/asserts.ts";
export { delay } from "https://deno.land/std@0.170.0/async/mod.ts";
export { serve } from "https://deno.land/std@0.170.0/http/server.ts";
} from "jsr:@std/assert@0.223.0";
export { delay } from "jsr:@std/async@0.223.0/delay";
7 changes: 4 additions & 3 deletions src/tests/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* webserver.ts
*/
import { delay, serve } from "../../deps_test.ts";
import { delay } from "../../deps_test.ts";

const rawPort: string | number = Deno.args[0] ?? 8080;
const port = Number(rawPort);
Expand All @@ -14,8 +14,9 @@ const handler = (request: Request): Response => {
};

console.log(`HTTP webserver running. Access it at: http://localhost:${port}/`);
delay(25000).then(() => {
delay(55000).then(() => {
console.log("test server timed out");
Deno.exit(5);
});

await serve(handler, { port });
Deno.serve({ port }, handler);

0 comments on commit 85621f0

Please sign in to comment.