aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@protonmail.com>2022-04-06 02:04:06 +0000
committerKevin J Hoerr <kjhoerr@protonmail.com>2022-04-06 02:04:06 +0000
commitda1945e6163c4c5bd8a2fa121c8347ccea83ef0a (patch)
tree0ad80c1f938a398ab971ed9047f5bda214dcba56
parentb4a0c697af48fcd4aeb10302a0e507e4e826803e (diff)
downloadao-coverage-da1945e6163c4c5bd8a2fa121c8347ccea83ef0a.tar.gz
ao-coverage-da1945e6163c4c5bd8a2fa121c8347ccea83ef0a.tar.bz2
ao-coverage-da1945e6163c4c5bd8a2fa121c8347ccea83ef0a.zip
Silence logs in unit tests
-rw-r--r--.drone.yml16
-rw-r--r--Dockerfile2
-rw-r--r--src/routes.test.ts11
3 files changed, 22 insertions, 7 deletions
diff --git a/.drone.yml b/.drone.yml
index 1b4f607..0f3218d 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -3,7 +3,7 @@ type: kubernetes
name: default
steps:
-- name: test
+- name: Test
image: node:lts
environment:
FORMAT: cobertura
@@ -18,7 +18,8 @@ steps:
- yarn run lint
- yarn run test:coverage
- curl --proto '=https' --tlsv1.2 -sSf https://cov.submelon.dev/sh | sh
-- name: build cache
+
+- name: Build cache
image: plugins/docker
settings:
repo: "${DRONE_REPO}"
@@ -33,9 +34,9 @@ steps:
when:
event:
exclude:
- - tag
- pull_request
-- name: publish (no tag)
+
+- name: Publish (no tag)
image: plugins/docker
settings:
repo: "${DRONE_REPO}"
@@ -53,7 +54,8 @@ steps:
exclude:
- tag
- pull_request
-- name: publish (with tag)
+
+- name: Publish (with tag)
image: plugins/docker
settings:
repo: "${DRONE_REPO}"
@@ -61,6 +63,7 @@ steps:
- "${DRONE_COMMIT_SHA}"
- "${DRONE_TAG##v}"
- latest
+ cache_from: "${DRONE_REPO}:cache"
target: release
username:
from_secret: docker_username
@@ -72,7 +75,8 @@ steps:
- tag
exclude:
- pull_request
-- name: deploy
+
+- name: Deploy
image: kjhoerr/drone-kubectl:latest
settings:
kubernetes_server:
diff --git a/Dockerfile b/Dockerfile
index c9d783f..ff498d2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,7 +8,7 @@ COPY package*.json ./
COPY yarn.lock ./
COPY .yarnrc.yml ./
COPY .yarn ./.yarn
-RUN yarn install
+RUN yarn install --immutable --immutable-cache
# Stage 3. TS compilation
FROM dependencies AS build
diff --git a/src/routes.test.ts b/src/routes.test.ts
index 8560f56..1a6032a 100644
--- a/src/routes.test.ts
+++ b/src/routes.test.ts
@@ -12,6 +12,17 @@ import winston from "winston";
dotenv.config();
+jest.mock("./util/logger", () => ({
+ __esModule: true,
+ default: () => ({
+ format: winston.format.combine(
+ winston.format.splat(),
+ winston.format.simple()
+ ),
+ transports: [new winston.transports.Console({ silent: true })],
+ }),
+}));
+
test("Environment variable HOST_DIR must be defined", () => {
expect(process.env.HOST_DIR).not.toBeUndefined();
});