Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

markdown-it-testgen

markdown-it1.8kMIT0.1.6

Tests generator for markdown-it markdown parser

markdown-it

readme

markdown-it-testgen

Build Status NPM version

This package parses fixtures in commonmark spec format and generates tests for markdown-it parser and plugins.

npm install markdown-it-testgen

Fixture format

Each fixture can have optional metadata in yaml format:

---
desc: Batch description # file name used if not exists.
skip: true              # mark batch as pending
---

Then tests should follow in this format:

optional header
.
source
data
.
parsed
data
.


header2
.
src
.
result
.

If header missed - line number will be used instead.

API

module.exports(path, options, md)

  • path - file or directory name
  • options (not mandatory)
    • header - Default false. Set true to use heaters for test names
    • sep - array of allowed separators for samples, [ '.' ] by default
    • assert - custom assertion package, require('chai').assert by default.
  • md - markdown-it instance to parse and compare samples

module.exports.load(path, options, iterator)

For each loaded file - parse and pass data to iterator functions. Currently used for tests only.

License

MIT

changelog

0.1.6 / 2019-07-09

  • Maintenance release.
  • Deps bump.
  • Remove outdated node versions from travis.

0.1.5 / 2019-03-12

  • Maintenance release.
  • Drop lodash use.
  • Pin dev deps.
  • Add latest node to travis.
  • Cleanup package.json.

0.1.4 / 2015-01-12

  • Fixed swapped params in error reports.

0.1.3 / 2015-01-12

  • Added option to pass custom assertion object.
  • Use chai assertions by default.

0.1.2 / 2014-12-24

  • One more maintenance release :)

0.1.1 / 2014-12-22

  • Maintenance release.

0.1.0 / 2014-12-21

  • First release.