Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/a11ytester / src / utils.js
Size: Mime:
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
};