Registry / testing / eslint-ava-rule-tester

eslint-ava-rule-tester

JSON →
library5.0.1jsnpmunverified

ESLint RuleTester runner for AVA test framework. Wraps ESLint's RuleTester to produce per-test reports in AVA format. Current stable version 5.0.1, pure ESM, requires Node.js >=18 and ESLint >=8.7.0. Supports all RuleTester features including valid/invalid cases, fix output, and error options. Releases: v5 breaking change to ESM-only; v4 dropped Node <7 and upgraded to ESLint v6; v2 added support for AVA 0.19. Key differentiator: provides granular test results instead of a single pass/fail for the entire rule suite.

npm install eslint-ava-rule-tester
INSTALL
IMPORT
SIG · ESLINT-AVA-RULE-TE
E
eslint-ava-rule-tester
testingjavascriptv5.0.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import AvaRuleTester from 'eslint-ava-rule-tester';
✗ const AvaRuleTester = require('eslint-ava-rule-tester');
ESM-only since v5; CommonJS require will fail. Use dynamic import or upgrade.
AvaRuleTester
✓ import AvaRuleTester from 'eslint-ava-rule-tester';
✗ import { AvaRuleTester } from 'eslint-ava-rule-tester';
Default export only; named import not available.
type inference
✓ import type AvaRuleTester from 'eslint-ava-rule-tester';
✗ import { type AvaRuleTester } from 'eslint-ava-rule-tester';
TypeScript users can use import type for type-only import.

Shows how to create an AvaRuleTester instance, passing the AVA test function and ESLint config, then run valid and invalid test cases.

import test from 'ava'; import AvaRuleTester from 'eslint-ava-rule-tester'; import myRule from '../eslint-rules/my-rule.js'; const ruleTester = new AvaRuleTester(test, { languageOptions: { ecmaVersion: 2024, }, }); ruleTester.run('my-rule', myRule, { valid: [ 'valid code', ], invalid: [ { code: 'invalid code', errors: [{ message: 'Error message' }], }, ], });
Debug
Known issues
breakingv5.0.0 is pure ESM and requires Node.js >=18. CommonJS require() will not work.
fix
Use import syntax and ensure Node.js version is >=18. If you must use CJS, upgrade to a dynamic import or pin to v4.x.
affects: >=5.0.0
breakingv4.0.0 dropped support for Node.js <7 and requires ESLint v6 as peer dependency.
fix
Upgrade Node.js to at least v8 and ESLint to v6 or higher.
affects: >=4.0.0 <5.0.0
breakingv2.0.1 requires AVA >=0.19 which enforces at least one assertion per test.
fix
Ensure AVA version is at least 0.19.0.
affects: >=2.0.1
breakingv5.0.0 changed the internal implementation to subclass RuleTester instead of modifying it. This may affect custom extensions.
fix
If you were relying on prototype modifications to RuleTester, adapt to use the provided subclass instead.
affects: >=5.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported.
Trying to use require() with ESM-only package (v5+).
fix
Switch to import or use dynamic import: const AvaRuleTester = await import('eslint-ava-rule-tester');
TypeError: Class extends value undefined is not a constructor or null
Missing or incompatible peer dependency, typically eslint is not installed or version is too low.
fix
Install eslint >=8.7.0 as a dev dependency.
Cannot find module 'eslint-ava-rule-tester'
Package not installed or not in node_modules.
fix
Run npm install --save-dev eslint-ava-rule-tester
Upgrade
Version history
5.0.1latest on npm
Audit
Dependencies
eslintrequiredpeer dependency; provides RuleTester class
Agent activity
6 hits · last 30 days
node
4
Resources
eslint-ava-rule-tester — npm install eslint-ava-rule-tester · libregistry