Skip to content

Commit

Permalink
refactor: removed config file feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Nederhoff committed Dec 9, 2018
1 parent f6d2b99 commit f24f206
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,6 @@
/* eslint import/no-dynamic-require: 0 */

const fs = require('fs');
const path = require('path');

const dirname = path.dirname(__dirname);

// default values for config
const config = {
fileName: 'report.html',
outputPath: '../../',
};

if (process.env.NODE_ENV === 'test') {
config.outputPath = './';
}

// add values for config from config file tcr-html.config.js
if (fs.existsSync(`${dirname}/../../tcr-html.config.js`)) {
const newConfig = require(`${dirname}/../../tcr-html.config.js`);
config.fileName = newConfig.fileName ? newConfig.fileName : config.fileName;
config.outputPath = newConfig.outputPath ? newConfig.outputPath : config.outputPath;
}

module.exports = () => ({
noColors: true,
Expand Down Expand Up @@ -263,11 +243,5 @@ module.exports = () => ({
`;

this.write(html);

try {
fs.writeFileSync(`${config.outputPath}/${config.fileName}`, html);
} catch (e) {
console.log('Cannot write file ', e);
}
},
});

0 comments on commit f24f206

Please sign in to comment.