This package parses fixtures in commonmark spec format and generates tests for markdown-it parser and plugins.
npm install markdown-it-testgen
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.
- path - file or directory name
- options (not mandatory)
- header - Default
false
. Settrue
to use heaters for test names - sep - array of allowed separators for samples, [ '.' ] by default
- assert - custom assertion package,
require('chai').assert
by default.
- header - Default
- md -
markdown-it
instance to parse and compare samples
For each loaded file - parse and pass data to iterator functions. Currently used for tests only.