Skip to content

Commit

Permalink
Fixing issue with asynchronously writing test files
Browse files Browse the repository at this point in the history
  • Loading branch information
PrabhuKathiresan committed Jan 24, 2019
1 parent 4304809 commit 593c853
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 593c853

Please sign in to comment.