Skip to content

Commit 1d42a33

Browse files
authoredOct 3, 2023
feat(bench): prefer lowercase title for bench (#263)
* Update types.ts * Update prefer-lowercase-title.ts * feat: prefer lowercase title for bench
1 parent 0527e6c commit 1d42a33

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed
 

‎src/rules/prefer-lowercase-title.ts

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export type MessageIds = 'lowerCaseTitle';
99
type IgnorableFunctionExpressions =
1010
| TestCaseName.it
1111
| TestCaseName.test
12+
| TestCaseName.bench
1213
| DescribeAlias.describe;
1314

1415
const hasStringAsFirstArgument = (

‎src/utils/parseVitestFnCall.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const ValidVitestFnCallChains = [
77
'afterEach',
88
'beforeAll',
99
'beforeEach',
10+
'bench',
1011
'describe',
1112
'describe.each',
1213
'describe.only',

‎src/utils/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export enum TestCaseName {
1212
'test' = 'test',
1313
'xit' = 'xit',
1414
'xtest' = 'xtest',
15+
'bench' = 'bench',
1516
}
1617

1718
export enum HookName {

‎tests/prefer-lowercase-title.test.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ ruleTester.run(RULE_NAME, rule, {
5252
lowercaseFirstCharacterOnly: false
5353
}
5454
]
55-
}
55+
},
56+
{
57+
code: 'bench(`Foo MM mm`, function () {})',
58+
output: 'bench(`foo MM mm`, function () {})',
59+
errors: [
60+
{
61+
messageId: 'lowerCaseTitle',
62+
data: {
63+
method: TestCaseName.bench
64+
}
65+
}
66+
]
67+
},
5668
]
5769
})

0 commit comments

Comments
 (0)
Please sign in to comment.