From c4e7fb2ee1a899f0d4b133cfa6b84d35eca81b8a Mon Sep 17 00:00:00 2001 From: numtel Date: Thu, 26 Sep 2024 16:19:35 -0700 Subject: [PATCH] Add MockStatusReporter to library --- README.md | 1 + index.js | 14 ++++++++++++++ package.json | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cc80c6c..c6ef194 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ Function Name | Arguments | Note `async zipDirectory` | | Create a zip file of a directory. If specified, `logger` must have a `log(msg)` method. `mkdirpSync` | `targetDir` (string) | Recreation of shell command `mkdir -p` `async deleteS3Keys` | `keys` (Array[string]) | Delete some files in the `BLOB_BUCKET` from S3 +`class MockStatusReporter` | *none* | For testing, logs are available as array on `logs` property ## Barebones Example diff --git a/index.js b/index.js index 714bbd9..862b080 100644 --- a/index.js +++ b/index.js @@ -205,3 +205,17 @@ export async function deleteS3Keys(keys) { throw error; } } + +export class MockStatusReporter { + constructor() { + this.logs = []; + } + + log(msg, data) { + this.logs.push({ + msg, + data, + time: process.uptime(), + }); + } +} diff --git a/package.json b/package.json index b5f57af..a31d3b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "circuitscan-pipeline-runner", - "version": "0.0.6", + "version": "0.0.7", "main": "index.js", "type": "module", "dependencies": {