How to use textlint-tester - 2 common examples

To help you get started, we’ve selected a few textlint-tester examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github textlint-rule / textlint-rule-no-dead-link / test / no-dead-link.js View on Github external
/* eslint-disable max-len */
import TextlintTester from 'textlint-tester';
import fs from 'fs';
import path from 'path';
import rule from '../src/no-dead-link';

const tester = new TextlintTester();

tester.run('no-dead-link', rule, {
  valid: [
    'should ignore non-http url [email address](mailto:mail.example.com) by default',
    'should ignore non-http url [ftp](ftp://example.com) by default',
    'should ignore non-http url [websockets](ws://example.com) by default',
    'should be able to check a link in Markdown: [example](https://example.com/)',
    'should be able to check a link in Markdown: [example](https://dev.mysql.com/downloads/mysql/)',
    'should be able to check a URL in Markdown: https://example.com/',
    'should success with retrying on error: [npm results for textlint](https://www.npmjs.com/search?q=textlint)',
    'should treat 200 OK as alive: https://httpstat.us/200',
    'should treat 200 OK. It require User-Agent: Navigate to [MySQL distribution](https://dev.mysql.com/downloads/mysql/) to install MySQL `5.7`.',
    'should treat 200 OK. It require User-Agent: https://tools.ietf.org/html/rfc6749',
    {
      text:
        'should be able to check a URL in a plain text: https://example.com/',
github textlint-rule / textlint-rule-write-good / test / write-good.js View on Github external
import TextlintTester from 'textlint-tester';
import rule from '../src/write-good';

const tester = new TextlintTester();

tester.run('write-good', rule, {
  valid: [
    'Hello, world!',
    'This sentence contains no mistakes.',
    {
      text: 'The cat was stolen.',
      options: {
        passive: false,
      },
    },
  ],
  invalid: [
    {
      text: 'So the cat was stolen.',
      errors: [

textlint-tester

testing tool for textlint rule.

MIT
Latest version published 1 month ago

Package Health Score

89 / 100
Full package analysis

Popular textlint-tester functions