This repository has been archived by the owner on Aug 16, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doctest runner for Node (also fix name and version)
- Loading branch information
Showing
2 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env node | ||
|
||
var path = require('path'); | ||
var fs = require('fs'); | ||
var root = path.join(path.dirname(fs.realpathSync(__filename)), '..'); | ||
|
||
var doctest = require(root + '/doctest'); | ||
|
||
var runner = new doctest.Runner({Reporter: doctest.ConsoleReporter}); | ||
var parser = new doctest.TextParser.fromFile(runner, process.argv[2]); | ||
parser.parse(); | ||
runner.run(); | ||
var reporter = runner.reporter; | ||
console.log('Successes:', reporter.successes); | ||
console.log('Failures:', reporter.failures); | ||
if ((! reporter.successes) || reporter.failures) { | ||
// Set exit code to number of failures (if any). It gives a nice failures | ||
// summary when running under make. E.g.: `make: *** [doctest] Error 2` | ||
process.exit(reporter.failures || 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters