pghalliday/grunt-mocha-test

Use CaptureFile to append to file instead of truncate?

vageeshb opened this issue · 0 comments

Currently, the task opens the file in write mode, which clears the content of an existing file.

 fd = fs.openSync(captureFile, 'w');

My use-case involves using this plugin to continuously test the code and use the JSON reporter for monitoring logs for mocha output. I propose to:

  • Either, provide an option for write vs append, like:
options: {
  captureFile: 'result.txt',
  captureFileMode: 'a'
}
  • Or, always open the file in append mode (might not be useful for other reporters), like:
 fd = fs.openSync(captureFile, 'a');

Feedback will be appreciated