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
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
"jsr:@cliffy/keycode@1.0.0-rc.4": "jsr:@cliffy/keycode@1.0.0-rc.4",
"jsr:@cliffy/prompt@1.0.0-rc.4": "jsr:@cliffy/prompt@1.0.0-rc.4",
"jsr:@cliffy/table@1.0.0-rc.4": "jsr:@cliffy/table@1.0.0-rc.4",
"jsr:@std/assert@0.223.0": "jsr:@std/assert@0.223.0",
"jsr:@std/assert@^0.221.0": "jsr:@std/assert@0.221.0",
"jsr:@std/async@0.223.0": "jsr:@std/async@0.223.0",
"jsr:@std/console@0.221": "jsr:@std/console@0.221.0",
"jsr:@std/encoding@0.221": "jsr:@std/encoding@0.221.0",
"jsr:@std/fmt@0.221": "jsr:@std/fmt@0.221.0",
"jsr:@std/fmt@^0.223.0": "jsr:@std/fmt@0.223.0",
"jsr:@std/io@0.221": "jsr:@std/io@0.221.0",
"jsr:@std/path@0.221": "jsr:@std/path@0.221.0",
"jsr:@std/text@0.221": "jsr:@std/text@0.221.0"
Expand Down Expand Up @@ -58,6 +61,15 @@
"@std/assert@0.221.0": {
"integrity": "a5f1aa6e7909dbea271754fd4ab3f4e687aeff4873b4cef9a320af813adb489a"
},
"@std/assert@0.223.0": {
"integrity": "eb8d6d879d76e1cc431205bd346ed4d88dc051c6366365b1af47034b0670be24",
"dependencies": [
"jsr:@std/fmt@^0.223.0"
]
},
"@std/async@0.223.0": {
"integrity": "b42f635d89fb8f9e0e7dc258fbc8f33233e4977f61e0b20da08a8b51fd7b2c5d"
},
"@std/console@0.221.0": {
"integrity": "8f2afc1f3f14f5d6039c0c767f057e4aa1897d2210e167c4667cb155cafb9d11"
},
Expand All @@ -67,6 +79,9 @@
"@std/fmt@0.221.0": {
"integrity": "379fed69bdd9731110f26b9085aeb740606b20428ce6af31ef6bd45ef8efa62a"
},
"@std/fmt@0.223.0": {
"integrity": "6deb37794127dfc7d7bded2586b9fc6f5d50e62a8134846608baf71ffc1a5208"
},
"@std/io@0.221.0": {
"integrity": "faf7f8700d46ab527fa05cc6167f4b97701a06c413024431c6b4d207caa010da"
},
Expand Down
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.