@textlint/ast-tester
TypeScript icon, indicating that this package has built-in type declarations

14.0.4 • Public • Published

@textlint/ast-tester

Compliance tests for textlint's AST(Abstract Syntax Tree).

It check compliance of AST at minimum.

If you have created Processor plugin for textlint, you can use it for testing the plugin.

Installation

npm install -D @textlint/ast-tester

Usage

test(textlintAST): void

if the AST is invalid, then throw Error

isTxtAST(textlintAST): boolean

if the AST is valid, then return true.

import {test, isTxtAST} from "@textlint/ast-tester";
import yourParse from "your-parser";
// recommenced: test much pattern test
const AST = yourParse("This is text");
test(AST);// if the AST is invalid, then throw Error

isTxtAST(AST);// true or false

Tests

npm test

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

Dependencies (2)

Dev Dependencies (6)

Package Sidebar

Install

npm i @textlint/ast-tester

Weekly Downloads

55,799

Version

14.0.4

License

MIT

Unpacked Size

128 kB

Total Files

23

Last publish

Collaborators

  • textlint-user
  • azu
  • 0x6b