Skip to content

Commit

Permalink
use loadFiles in bench
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed May 4, 2019
1 parent 059acbc commit 2f8fb03
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions test/bench.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
#!/usr/bin/env node

const path = require('path');
const fs = require('fs');
const htmlDiffer = require('./helpers/html-differ.js');
const {loadFiles} = require('./helpers/load.js');

let marked = require('../');

function load() {
const folder = path.resolve(__dirname, './specs/commonmark');
const files = fs.readdirSync(folder);
return files.reduce((arr, file) => {
if (file.match(/\.json$/)) {
return arr.concat(require(`${folder}/${file}`));
}
return arr;
}, []);
const dir = path.resolve(__dirname, './specs/commonmark');
const sections = loadFiles(dir);
let specs = [];

for (const section in sections) {
specs = specs.concat(sections[section].specs);
}

return specs;
}

function runBench(options) {
Expand Down

0 comments on commit 2f8fb03

Please sign in to comment.