Skip to content

Commit 94c6dc7

Browse files
committed
upload rich metadata for each test
1 parent 43816ae commit 94c6dc7

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

packages/flowtest-cli/bin/index.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,27 @@ const argv = yargs(hideBin(process.argv))
9393
} else {
9494
console.log(chalk.bold('Flow Run: ') + chalk.red(` ✕ `) + chalk.dim(result.status));
9595
}
96-
logger.add(LogLevel.INFO, `Total time: ${Date.now() - startTime} ms`);
97-
console.log(chalk.bold('Total Time: ') + chalk.dim(`${Date.now() - startTime} ms`));
96+
const time = Date.now() - startTime;
97+
logger.add(LogLevel.INFO, `Total time: ${time} ms`);
98+
console.log(chalk.bold('Total Time: ') + chalk.dim(`${time} ms`));
9899
//console.log(logger.get());
99100

100101
if (argv.scan) {
101102
const data = {
102-
version: 1,
103-
name: argv.file.toString(),
104-
scan: logger.get(),
103+
scan_metadata: {
104+
version: 1,
105+
name: argv.file.toString(),
106+
status: result.status,
107+
time,
108+
},
109+
scan: bytesToBase64(new TextEncoder().encode(JSON.stringify(logger.get()))),
105110
};
106111
try {
107-
const response = await axiosClient.post(
108-
'/upload',
109-
bytesToBase64(new TextEncoder().encode(JSON.stringify(data))),
110-
);
112+
const response = await axiosClient.post('/upload', data, {
113+
headers: {
114+
'Content-Type': 'application/json',
115+
},
116+
});
111117
console.log(chalk.bold('Flow Scan: ') + chalk.dim(`${baseUrl}/scan/${response.data.data[0].id}`));
112118
} catch (error) {
113119
if (error?.response) {

0 commit comments

Comments
 (0)