Skip to content

Commit

Permalink
πŸ— Fix folder creation for test reports (#33419)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimha committed Mar 22, 2021
1 parent f6a2f18 commit eb741b8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions build-system/tasks/e2e/mocha-custom-json-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
'use strict';

const fs = require('fs').promises;
const fs = require('fs-extra');
const {
EVENT_TEST_PASS,
EVENT_TEST_FAIL,
Expand All @@ -29,19 +29,18 @@ const {inherits} = require('mocha').utils;

/**
*
* @param {string} output
* @param {!Object} output
* @param {string} filename
* @return {Promise<void>}
*/
async function writeOutput(output, filename) {
try {
await fs.mkdir('result-reports');
await fs.writeFile(filename, JSON.stringify(output, null, 4));
await fs.outputJson(filename, output, {spaces: 4});
} catch (error) {
process.stdout.write(
Base.color(
'fail',
`Could not write test result report to file '${filename}'`
`Could not write test result report to file '${filename}': ${error}`
)
);
}
Expand Down

0 comments on commit eb741b8

Please sign in to comment.