mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
24 lines
531 B
JavaScript
24 lines
531 B
JavaScript
/* eslint-env node */
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
module.exports = results => {
|
|
if (!results.success) {
|
|
throw new Error('Balance reporter requires all tests to succeed.');
|
|
}
|
|
|
|
const cwd = process.cwd();
|
|
const testValues = {};
|
|
|
|
for (const test of results.testResults) {
|
|
testValues[test.testFilePath.replace(cwd, '')] = test.perfStats.runtime;
|
|
}
|
|
|
|
fs.writeFileSync(
|
|
path.resolve(__dirname, 'jest-balance.json'),
|
|
JSON.stringify(testValues)
|
|
);
|
|
|
|
return results;
|
|
};
|