Skip to content

Commit

Permalink
feat(bench): prefer lowercase title for bench (#263)
Browse files Browse the repository at this point in the history
* Update types.ts

* Update prefer-lowercase-title.ts

* feat: prefer lowercase title for bench
  • Loading branch information
Jannchie committed Oct 3, 2023
1 parent 0527e6c commit 1d42a33
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/rules/prefer-lowercase-title.ts
Expand Up @@ -9,6 +9,7 @@ export type MessageIds = 'lowerCaseTitle';
type IgnorableFunctionExpressions =
| TestCaseName.it
| TestCaseName.test
| TestCaseName.bench
| DescribeAlias.describe;

const hasStringAsFirstArgument = (
Expand Down
1 change: 1 addition & 0 deletions src/utils/parseVitestFnCall.ts
Expand Up @@ -7,6 +7,7 @@ const ValidVitestFnCallChains = [
'afterEach',
'beforeAll',
'beforeEach',
'bench',
'describe',
'describe.each',
'describe.only',
Expand Down
1 change: 1 addition & 0 deletions src/utils/types.ts
Expand Up @@ -12,6 +12,7 @@ export enum TestCaseName {
'test' = 'test',
'xit' = 'xit',
'xtest' = 'xtest',
'bench' = 'bench',
}

export enum HookName {
Expand Down
14 changes: 13 additions & 1 deletion tests/prefer-lowercase-title.test.ts
Expand Up @@ -52,6 +52,18 @@ ruleTester.run(RULE_NAME, rule, {
lowercaseFirstCharacterOnly: false
}
]
}
},
{
code: 'bench(`Foo MM mm`, function () {})',
output: 'bench(`foo MM mm`, function () {})',
errors: [
{
messageId: 'lowerCaseTitle',
data: {
method: TestCaseName.bench
}
}
]
},
]
})

0 comments on commit 1d42a33

Please sign in to comment.