Skip to content

Commit

Permalink
feat: output version in aggregates
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsenta committed Aug 3, 2023
1 parent 7d7b329 commit d7e8ed3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions aggregate-into-table.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const fs = require("fs");

const TestMetadata = "TestMetadata";

// retrieve the list of input files from the command line
const files = process.argv.slice(2);

// read all input files (json)
const inputs = files.map((file) => {
return JSON.parse(fs.readFileSync(file, 'utf8'));
}
);
});

// merge all the unique keys from all the inputs
let keys = new Set();
Expand All @@ -17,12 +18,13 @@ inputs.forEach((input) => {
});
});
keys = Array.from(keys).sort();
keys.delete(TestMetadata); // Extract TestMetadata which is a special case

// generate a table
const columns = [];

// add the leading column ("gateway", "key1", "key2", ... "keyN")
const leading = ["gateway"];
// add the leading column ("gateway", "version", "key1", "key2", ... "keyN")
const leading = ["gateway", "version"];
keys.forEach((key) => {
// Skip the "Test" prefix
const niceKey = key.replace(/^Test/, '');
Expand Down Expand Up @@ -53,7 +55,13 @@ inputs.forEach((input, index) => {
// clean name (remove path and extension)
let name = files[index].replace(/\.json$/, '').replace(/^.*\//, '');

const col = [name];
// extract TestMetadata & version
const metadata = input[TestMetadata];
const version = metadata['version'];

const col = [name, version];

// extract results
keys.forEach((key) => {
col.push(cellRender(input[key] || null));
});
Expand Down

0 comments on commit d7e8ed3

Please sign in to comment.