Skip to content

Commit

Permalink
fixes#3605 Write report for multiple environments (#3606)
Browse files Browse the repository at this point in the history
  • Loading branch information
swrdfish committed Feb 17, 2023
1 parent ee01ee6 commit b398ee1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
10 changes: 8 additions & 2 deletions lib/reporter/reporters/json.js
Expand Up @@ -44,9 +44,15 @@ class JsonReporter extends BaseReporter {
module.exports = (function() {
return {
write(results, options) {
const reporter = new JsonReporter(results, options);
const envs = Object.keys(results.modulesWithEnv);
const promises = envs.map(env => {
const envResult = {...results, modules: results.modulesWithEnv[env]};
const reporter = new JsonReporter(envResult, options);

return reporter.write();
return reporter.write();
});

return Promise.all(promises);
}
};
})();
11 changes: 9 additions & 2 deletions lib/reporter/reporters/junit.js
Expand Up @@ -92,9 +92,16 @@ class JUnitReporter extends BaseReporter {
module.exports = (function() {
return {
write(results, options, callback) {
const reporter = new JUnitReporter(results, options);

reporter.write()
const envs = Object.keys(results.modulesWithEnv);
const promises = envs.map(env => {
const envResult = {...results, modules: results.modulesWithEnv[env]};
const reporter = new JUnitReporter(envResult, options);

return reporter.write();
});

Promise.all(promises)
.then(_ => {
callback();
})
Expand Down

0 comments on commit b398ee1

Please sign in to comment.