diff --git a/index.js b/index.js
index e47f0c7..f576ce1 100644
--- a/index.js
+++ b/index.js
@@ -4,6 +4,7 @@ const through = require('through2');
const dargs = require('dargs');
const resolveCwd = require('resolve-cwd');
const execa = require('execa');
+const fs = require('fs');
const BINARY = require.resolve('ava/cli.js');
@@ -50,6 +51,11 @@ module.exports = options => {
subprocess.stderr.pipe(process.stderr);
}
+ if (options.outputFile) {
+ const fileStream = fs.createWriteStream(options.outputFile);
+ subprocess.stdout.pipe(fileStream);
+ }
+
try {
await subprocess;
callback();
diff --git a/readme.md b/readme.md
index 9ea71a2..7563dbf 100644
--- a/readme.md
+++ b/readme.md
@@ -45,3 +45,10 @@ Type: `boolean`
Default: `false`
Run AVA with [`nyc`](https://github.com/istanbuljs/nyc). You must have `nyc` as a devDependency. `nyc` [options](https://github.com/istanbuljs/nyc#configuring-nyc) can be defined in package.json.
+
+#### outputFile
+
+Type: `string`
+Default: `undefined`
+
+Store a copy of the stdout of AVA as a file. Example: `tests/output/tapOutput.txt`