eslint-ava-rule-tester

5.0.1 • Public • Published

eslint-ava-rule-tester

ESLint's RuleTester for AVA

Allows you to run ESLint's RuleTester with AVA while still getting the nice report it provides by default.

Install

npm install --save-dev eslint-ava-rule-tester

Usage

Apart from how it is instantiated, the API is the same as ESLint's RuleTester. For information on how to test your rule, please follow the official documentation.

import test from 'ava';
import AvaRuleTester from 'eslint-ava-rule-tester';
import rule from '../rules/my-awesome-rule.js';

const ruleTester = new AvaRuleTester(test, {
  languageOptions: {
    ecmaVersion: 2024,
  },
});

ruleTester.run('my-awesome-rule', rule, {
  valid: [
    '...',
  ],
  invalid: [
    {
      code: 'console.lgo',
      errors: [{ message: 'console.log was mistyped', column: 1, line: 1 }],
      output: 'console.log', // Optional, use this when your rule fixes the errors
    },
  ],
});

Run ava --verbose to get a better overview of which tests failed.

License

MIT © Jeroen Engels

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
5.0.1210latest

Version History

VersionDownloads (Last 7 Days)Published
5.0.1210
5.0.00
4.2.09
4.1.01
4.0.0112
3.0.04
2.0.29
2.0.10
2.0.00
0.1.11
0.1.00
0.0.10
0.0.00

Package Sidebar

Install

npm i eslint-ava-rule-tester

Weekly Downloads

346

Version

5.0.1

License

MIT

Unpacked Size

4.65 kB

Total Files

4

Last publish

Collaborators

  • jfmengels
  • sindresorhus
  • graingert