From 24d01feb630a3fc1fb3190da24ffe57f28552f3b Mon Sep 17 00:00:00 2001 From: "Bruhn, Daniel" Date: Fri, 18 Sep 2020 14:33:52 -0700 Subject: [PATCH] feat(report): allow override of report timestamp dir structure --- README.md | 10 +++++++++- lib/flow.js | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5f87dd9..81711d1 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,14 @@ directory/filename settings for those reporters, as nemo will take care of that Recommended to set this as `path:report`, which will create a `report` directory beneath your base directory. See `Reporting` below. +### `output.pathTimestampFormat ` + +This setting overrides the timestamp format of the report directory structure. The default is `MM-DD-YYYY/HH-mm-ss`, which creates nested directories like "09-18-2020/14-09-57" for the test run which occurred on September 18, 2020 at 2:09:57pm in your local time zone. + +Setting `pathTimestampFormat` to `YYYY-MM-DD_HH-mm-s`, for example, creates a single directory for each test run using a modified ISO 8601 format (such as "2020-09-18_14-09-57"). + +The possible formats are provided by [Moment.js](https://momentjs.com/docs/#/displaying/format/). + ### `output.storage ` You can provide an influxdb endpoint and store test results in it. E.g. @@ -194,7 +202,7 @@ any environment variables you want in the test process. ### `base.zeroExitCode` --if set to true, nemo will always exit with zero code +-if set to true, nemo will always exit with zero code -if set to false, or don't set any value, the exitCode is Math.min(output.totals.fail, 255); diff --git a/lib/flow.js b/lib/flow.js index fd7c37a..8bf77e4 100644 --- a/lib/flow.js +++ b/lib/flow.js @@ -47,7 +47,8 @@ const reportDir = function reportDir(cb) { log('reportDir: output:reports not defined'); return cb(null, this); } - let tsDirName = moment().format('MM-DD-YYYY/HH-mm-ss'); + const pathTimestampFormat = this.config.get('output:pathTimestampFormat') || 'MM-DD-YYYY/HH-mm-ss'; + let tsDirName = moment().format(pathTimestampFormat); let fullReportPath = `${reportOutput}/${tsDirName}`; this.config.set('output:reports', fullReportPath); log(`reportDir: ${fullReportPath}`);