Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(report): allow override of report timestamp dir structure #103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <optional>`

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 <optional>`

You can provide an influxdb endpoint and store test results in it. E.g.
Expand Down Expand Up @@ -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);


Expand Down
3 changes: 2 additions & 1 deletion lib/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a user supplied configuration, we may want to wrap this in a try/catch or otherwise figure out how to handle the case where the value provided is invalid.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also interested in what issues arise if we pass in a "valid" but unexpected value like foo. Will we run into errors if multiple tests/runs try to write to the same folder?

Perhaps we don't have to handle all these cases and users will be able determine the errors are due to their custom config value 🤷‍♂️

let fullReportPath = `${reportOutput}/${tsDirName}`;
this.config.set('output:reports', fullReportPath);
log(`reportDir: ${fullReportPath}`);
Expand Down
71 changes: 42 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"yargs": "^15.0.1"
},
"devDependencies": {
"chromedriver": "^83.0.0",
"chromedriver": "^85.0.1",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can change this to:

"chromedriver": "latest",

so we don't have to keep updating this value

"eslint": "^6.0.1",
"eslint-plugin-es6-recommended": "^0.1.2"
}
Expand Down