1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-30 22:08:02 +00:00

deno lint, deno test

This commit is contained in:
Nebel 2021-11-26 12:10:09 +09:00
parent 58d3e74c02
commit 998590ba13
6 changed files with 29 additions and 4 deletions

9
deno/add.test.ts Normal file
View file

@ -0,0 +1,9 @@
import { assertStrictEquals } from "testing/asserts.ts";
import { add } from "./add.ts";
Deno.test({
name: "add",
fn() {
assertStrictEquals(add(1, 2), 3);
},
});

1
deno/add.ts Normal file
View file

@ -0,0 +1 @@
export const add = (a: number, b: number) => a + b;

View file

@ -1,4 +1,4 @@
import { Handler, ServeInit, serve } from "http/server.ts";
import { Handler, serve, ServeInit } from "http/server.ts";
const handler: Handler = () => new Response("Hello World\n");
const options: ServeInit = { addr: "localhost:8080" };

8
deno/deno.json Normal file
View file

@ -0,0 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json",
"lint": {
"rules": {
"include": ["default-param-last", "eqeqeq"]
}
}
}

View file

@ -1,5 +1,6 @@
{
"imports": {
"http/": "https://deno.land/std@0.115.1/http/"
"http/": "https://deno.land/std@0.115.1/http/",
"testing/": "https://deno.land/std@0.116.0/testing/"
}
}

View file

@ -1,6 +1,12 @@
# yaml-language-server: $schema=https://deno.land/x/denon@2.4.10/schema.json
importmap: importmap.json
scripts:
start:
cmd: "deno run app.ts"
cmd: "deno run --import-map=importmap.json app.ts"
allow: [net]
test:
cmd: "deno test --import-map=importmap.json"
lint:
cmd: "deno lint --config=deno.json ."
fmt:
cmd: "deno fmt --config=deno.json ."