Skip to content

Commit 2d0ef11

Browse files
authored
fix(expect-expect): include numbers when matching assert function names with wildcards (#1134)
1 parent a19bcf4 commit 2d0ef11

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/rules/__tests__/expect-expect.test.ts

+8
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,14 @@ ruleTester.run('expect-expect', rule, {
187187

188188
ruleTester.run('wildcards', rule, {
189189
valid: [
190+
{
191+
code: "test('should pass *', () => expect404ToBeLoaded());",
192+
options: [{ assertFunctionNames: ['expect*'] }],
193+
},
194+
{
195+
code: "test('should pass *', () => expect.toHaveStatus404());",
196+
options: [{ assertFunctionNames: ['expect.**'] }],
197+
},
190198
{
191199
code: "test('should pass', () => tester.foo().expect(123));",
192200
options: [{ assertFunctionNames: ['tester.*.expect'] }],

src/rules/expect-expect.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ function matchesAssertFunctionName(
2828
`^${p
2929
.split('.')
3030
.map(x => {
31-
if (x === '**') return '[a-z\\.]*';
31+
if (x === '**') return '[a-z\\d\\.]*';
3232
33-
return x.replace(/\*/gu, '[a-z]*');
33+
return x.replace(/\*/gu, '[a-z\\d]*');
3434
})
3535
.join('\\.')}(\\.|$)`,
3636
'ui',

0 commit comments

Comments
 (0)