/readme-tester

A library to test READMEs

Primary LanguageJavaScriptMIT LicenseMIT

readme-tester

A library to test READMEs (or any markdown files actually)

stability-experimental circleci Dependency Status Dev Dependency Status

Install

To install

npm i git://github.com/orangemug/readme-tester.git

Usage

So say you have a README markdown file like so

# fail
Testing, testing, 1, 2, 3

    npm i fail


## Usage
To use it

```js
var fail = require("fail");
var out = fail(2)
assert(out, 5);
```

All the code in js code tags will concatinated and executed. The following will be added to the top by default

var assert = require("assert");

Any errors thrown in the markdown code will cause an error. To test your README.md just run the following

var readmeTester = require("readme-tester");

readmeTester(__dirname+"/test/examples/fail/README.md", function(err, assertions) {
  assert(err);
});

Actually this markdown document /test/index.js is also tested by itself, which in turn runs readme-tester in the markdown above... very meta!

CLI

There is also a CLI

$ readme-tester --help
Test a README.

Usage: readme-tester <path to markdown file>

Options:
  -h, --help  Show help                                                [boolean]

Examples:
  readme-tester ./path/to/README.md

Example usage

$ readme-tester ./test/examples/success
## :exit => 1

License

MIT