From 8957ad6543d7b5e01a9312bf601ce1fda01f361d Mon Sep 17 00:00:00 2001 From: qpismont Date: Thu, 4 Jan 2024 23:01:46 +0100 Subject: [PATCH] fix lint include + add woodpecker CI --- .woodpecker/.lint.yml | 10 ++++++++++ .woodpecker/.test.yml | 9 +++++++++ deno.json | 3 +++ src/adaptors/nats.ts | 2 +- tests/service.test.ts | 20 ++++++++++++++++---- 5 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 .woodpecker/.lint.yml create mode 100644 .woodpecker/.test.yml diff --git a/.woodpecker/.lint.yml b/.woodpecker/.lint.yml new file mode 100644 index 0000000..8169fe4 --- /dev/null +++ b/.woodpecker/.lint.yml @@ -0,0 +1,10 @@ +pipeline: + lint: + image: denoland/deno:${DENO_VERSION} + commands: + - deno ta + - cargo clippy + +matrix: + DENO_VERSION: + - 1.39.1 \ No newline at end of file diff --git a/.woodpecker/.test.yml b/.woodpecker/.test.yml new file mode 100644 index 0000000..f355353 --- /dev/null +++ b/.woodpecker/.test.yml @@ -0,0 +1,9 @@ +pipeline: + test: + image: denoland/deno:${DENO_VERSION} + commands: + - deno task test + +matrix: + DENO_VERSION: + - 1.39.1 \ No newline at end of file diff --git a/deno.json b/deno.json index ff3d471..a6d8cc5 100644 --- a/deno.json +++ b/deno.json @@ -9,5 +9,8 @@ "test": "deno test --allow-net --parallel", "build": "deno run -A scripts/build_npm.ts 0.1.0", "publish": "cd npm && npm publish" + }, + "lint": { + "include": ["src/"] } } diff --git a/src/adaptors/nats.ts b/src/adaptors/nats.ts index 244b1dd..7c94953 100644 --- a/src/adaptors/nats.ts +++ b/src/adaptors/nats.ts @@ -52,6 +52,6 @@ export default class NatsAdaptor implements Adaptor { } async stop(): Promise { - this.nc?.drain(); + await this.nc?.drain(); } } diff --git a/tests/service.test.ts b/tests/service.test.ts index 3e2c8c5..18d2547 100644 --- a/tests/service.test.ts +++ b/tests/service.test.ts @@ -20,7 +20,11 @@ afterEach(async () => { await srv.stop(); }); -it("request success", async () => { +it("request success", { + sanitizeExit: false, + sanitizeOps: false, + sanitizeResources: false, +}, async () => { const dataExpected = "hello success"; const statusCodeExpected = 200; @@ -41,7 +45,11 @@ it("request success", async () => { assertEquals(res.statusCode, statusCodeExpected); }); -it("request error", async () => { +it("request error", { + sanitizeExit: false, + sanitizeOps: false, + sanitizeResources: false, +}, async () => { const dataExpected = "hello error"; const statusCodeExpected = 500; @@ -56,11 +64,15 @@ it("request error", async () => { service: serviceName, subject: subject, data: dataExpected, - }); + }, z.string()); }); }); -it("request adaptor not found", async () => { +it("request adaptor not found", { + sanitizeExit: false, + sanitizeOps: false, + sanitizeResources: false, +}, async () => { const dataExpected = "hello success"; const statusCodeExpected = 200;