Skip to content

Commit 108cdce

Browse files
authored
Merge pull request #1 from chefferson/timestamp-and-gitignore
Minor improvements to output csvs and gitignore
2 parents adb4b7b + 45c47cb commit 108cdce

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules/
22
.env
3-
results.csv
3+
results.csv
4+
.DS_Store
5+
results*.csv

index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ LoaderTests.prototype.runTest = function (testName, testidx){
5858
})
5959
}
6060

61-
LoaderTests.prototype.getTestResults = async function (testName, testidx, resultidx){
61+
LoaderTests.prototype.getTestResults = async function (testName, testidx, resultidx, datetime){
6262
var testName = testName;
6363
var resultidx = resultidx;
6464
const config = {
@@ -71,7 +71,7 @@ LoaderTests.prototype.getTestResults = async function (testName, testidx, result
7171
await axios(config)
7272
.then(response => {
7373
response.data['test_name'] = testName;
74-
this.write2CSV();
74+
this.write2CSV(datetime);
7575
this._testResults.push(response.data);
7676
})
7777
.catch(error => {
@@ -80,8 +80,8 @@ LoaderTests.prototype.getTestResults = async function (testName, testidx, result
8080
});
8181
}
8282

83-
LoaderTests.prototype.write2CSV = async function () {
84-
const writeCSVStream = fs.createWriteStream('results.csv');
83+
LoaderTests.prototype.write2CSV = async function (datetime) {
84+
const writeCSVStream = fs.createWriteStream(`results_${datetime}.csv`);
8585
await converter.json2csv(this._testResults, (err, csv) => {
8686
if (err) {
8787
console.log('Writing from json2csv has an error: ', err);
@@ -104,8 +104,9 @@ async function run() {
104104
}
105105
console.log('All tests ran...');
106106
console.log('Fetching data and writing to CSV file...');
107+
const datetime = Date.now();
107108
await newRun._testSuite.forEach(value => {
108-
newRun.getTestResults(value.testName, value.testidx, value.resultidx)
109+
newRun.getTestResults(value.testName, value.testidx, value.resultidx, datetime)
109110
});
110111
console.log('results.csv file should be created / updated soon');
111112
} catch (err) {

0 commit comments

Comments
 (0)