Skip to content

Commit

Permalink
fix: test extend in valid title
Browse files Browse the repository at this point in the history
  • Loading branch information
veritem committed Dec 27, 2024
1 parent 1e86d8d commit 80e45be
Show file tree
Hide file tree
Showing 3 changed files with 214 additions and 209 deletions.
17 changes: 10 additions & 7 deletions src/rules/valid-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ type Options = {
allowArguments?: boolean
disallowedWords?: string[]
mustNotMatch?:
| Partial<Record<MatcherGroups, string | MatcherAndMessage>>
| MatcherAndMessage
| string
| Partial<Record<MatcherGroups, string | MatcherAndMessage>>
| MatcherAndMessage
| string
mustMatch?:
| Partial<Record<MatcherGroups, string | MatcherAndMessage>>
| MatcherAndMessage
| string
| Partial<Record<MatcherGroups, string | MatcherAndMessage>>
| MatcherAndMessage
| string
}[]

type CompiledMatcherAndMessage = [matcher: RegExp, message?: string]
Expand Down Expand Up @@ -91,7 +91,7 @@ const compileMatcherPatterns = (matchers:
| Partial<Record<MatcherGroups, string | MatcherAndMessage>>
| MatcherAndMessage
| string): Record<MatcherGroups, CompiledMatcherAndMessage | null> &
Record<string, CompiledMatcherAndMessage | null> => {
Record<string, CompiledMatcherAndMessage | null> => {
if (typeof matchers === 'string' || Array.isArray(matchers)) {
const compiledMatcher = compileMatcherPattern(matchers)

Expand Down Expand Up @@ -197,6 +197,9 @@ export default createEslintRule<Options, MESSAGE_IDS>({

if (vitestFnCall?.type !== 'describe' && vitestFnCall?.type !== 'test' && vitestFnCall?.type !== 'it') return

// check if extend keyword have been used
if (vitestFnCall.members.some(m => m.type == AST_NODE_TYPES.Identifier && m.name == "extend")) return

const [argument] = node.arguments

if (settings.typecheck) {
Expand Down
Loading

0 comments on commit 80e45be

Please sign in to comment.