Skip to content

Commit

Permalink
Merge pull request #19 from PrabhuKathiresan/master
Browse files Browse the repository at this point in the history
Fixing issue with asynchronously writing test files
  • Loading branch information
noahdietz authored Jan 24, 2019
2 parents 4304809 + 593c853 commit ba868a4
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 151 deletions.
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ function generate(specPath, options) {
fs.mkdirSync(options.writeTo)
}

compiled.forEach(function (testObj, ndx, arr) {
fs.writeFile(join(options.writeTo, testObj.filename),
testObj.contents, function (err) {
if (err !== null) {
console.error(err)
}
})
})
try {
for (var i = 0; i < compiled.length; i++) {
const testObj = compiled[i];
fs.writeFileSync(join(options.writeTo, testObj.filename), testObj.contents)
}
} catch (err) {
console.log(err);
}
}

return {'generated': compiled}
Expand Down
Loading

0 comments on commit ba868a4

Please sign in to comment.