Skip to content

Commit

Permalink
chore: Add test that all rules are documented
Browse files Browse the repository at this point in the history
  • Loading branch information
mskelton committed Apr 9, 2024
1 parent f53b4e2 commit 37ec903
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/rules/rules.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { readdir } from 'node:fs/promises'
import fs from 'node:fs/promises'
import path from 'node:path'
import { expect, test } from 'vitest'
import plugin from '../../src/index'

test('has all rules', async () => {
const files = await readdir('src/rules')
test('exports all rules', async () => {
const files = await fs.readdir('src/rules')
const { rules } = plugin.configs['flat/recommended'].plugins.playwright
const ruleKeys = Object.keys(rules).sort()
const fileKeys = files
Expand All @@ -13,3 +14,16 @@ test('has all rules', async () => {

expect(ruleKeys).toEqual(fileKeys)
})

test('has all rules in the README', async () => {
const readme = await fs.readFile(
path.resolve(__dirname, '../../README.md'),
'utf-8',
)

const { rules } = plugin.configs['flat/recommended'].plugins.playwright

for (const rule of Object.keys(rules)) {
expect(readme).toContain(`[${rule}]`)
}
})

0 comments on commit 37ec903

Please sign in to comment.