Repository URL to install this package:
|
Version:
0.0.8 ▾
|
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
// const { a11yBuildPath, reportsPath, screenCapturePath } = require('./constants');
const { reportsPath } = require('./config').get();
/**
* Creates the directories for the reports.
*/
function setupReportDirectory() {
execSync(`mkdir -p ${path.resolve(process.cwd(), reportsPath)}`);
}
/**
* Removes reports and captures from the reports directory.
*/
function cleanupReportDirectory() {
fs.readdirSync(reportsPath)
.filter(f => f.startsWith('report-') || f.startsWith('capture-'))
.forEach(f => fs.unlinkSync(path.resolve(reportsPath, f)));
}
module.exports = {
setupReportDirectory,
cleanupReportDirectory
};