From d601ce169df9e879d80bbbea288f97873d460f3c Mon Sep 17 00:00:00 2001 From: Jonatan Nilsson Date: Mon, 11 Oct 2021 01:36:36 +0000 Subject: [PATCH] add slight debug stuff to figure out why circleci tests are failing --- .circleci/config.yml | 1 + api/server.mjs | 5 +++++ test/media/api.test.mjs | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ae67965..5c403c4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,6 +13,7 @@ jobs: name: Install dependencies command: | npm install + npm list --all - run: name: Run tests command: | diff --git a/api/server.mjs b/api/server.mjs index 57b1dc7..68af27c 100644 --- a/api/server.mjs +++ b/api/server.mjs @@ -16,6 +16,11 @@ app.before(function(ctx) { }) app.after(function(ctx) { + console.log({ + path: ctx.url, + status: ctx.status, + ms: Math.round(ended), + }, 'Request finished') let ended = performance.now() - ctx.__started let logger = ctx.log.info if (ctx.status >= 400) { diff --git a/test/media/api.test.mjs b/test/media/api.test.mjs index ef94aba..f756b00 100644 --- a/test/media/api.test.mjs +++ b/test/media/api.test.mjs @@ -41,9 +41,10 @@ t.describe('Media (API)', () => { assert.match(err.message, /[Mm]issing/) await new Promise(function(res) { - setTimeout(res, 10) + setTimeout(res, 100) }) + console.log(server.log.warn) assert.strictEqual(server.log.error.callCount, 0) assert.strictEqual(server.log.warn.callCount, 2) assert.strictEqual(typeof(server.log.warn.firstCall[0]), 'string') @@ -69,7 +70,7 @@ t.describe('Media (API)', () => { assert.match(err.message, /[Ii]nvalid/) await new Promise(function(res) { - setTimeout(res, 10) + setTimeout(res, 100) }) assert.strictEqual(server.log.error.callCount, 1)