Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jfmengels/eslint-ava-rule-tester
ESLint's RuleTester for AVA
https://github.com/jfmengels/eslint-ava-rule-tester
Last synced: 11 days ago
JSON representation
ESLint's RuleTester for AVA
- Host: GitHub
- URL: https://github.com/jfmengels/eslint-ava-rule-tester
- Owner: jfmengels
- License: mit
- Created: 2016-05-11T21:51:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-01-07T12:56:13.000Z (10 months ago)
- Last Synced: 2024-04-14T11:09:09.898Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 339 KB
- Stars: 13
- Watchers: 4
- Forks: 4
- Open Issues: 12
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
- awesome-ava - eslint-ava-rule-tester - Test [ESLint](https://github.com/eslint/eslint) plugins with AVA. (Packages)
README
# 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
```sh
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](https://eslint.org/docs/latest/extend/plugins#testing).
```js
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](https://github.com/jfmengels)
[AVA]: https://github.com/sindresorhus/ava
[ESLint]: https://github.com/eslint/eslint
[RuleTester]: (https://eslint.org/docs/latest/integrate/nodejs-api#ruletester)