Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd31fdb7

Browse files
authored
fix: detect expectations in chains with underscores (#607)
1 parent2abdad0 commitd31fdb7

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

‎src/rules/expect-expect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function matchesAssertFunctionName(
2222
.split('.')
2323
.map((x)=>{
2424
if(x==='**')
25-
return'[a-z\\d\\.]*'
25+
return'[_a-z\\d\\.]*'
2626
2727
returnx.replace(/\*/gu,'[a-z\\d]*')
2828
})

‎tests/expect-expect.test.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import{AST_NODE_TYPES}from'@typescript-eslint/utils'
2-
importrule,{RULE_NAME}from'../src/rules/expect-expect'
3-
import{ruleTester}from'./ruleTester'
1+
import{AST_NODE_TYPES}from'@typescript-eslint/utils';
2+
3+
importrule,{RULE_NAME}from'../src/rules/expect-expect';
4+
import{ruleTester}from'./ruleTester';
45

56
ruleTester.run(RULE_NAME,rule,{
67
valid:[
@@ -42,7 +43,15 @@ it('example', async () => {
4243
const result = Promise.reject<string>('error');
4344
4445
await expect(result.then((it) => it.toUpperCase())).rejects.toThrow();
45-
});`
46+
});`,
47+
{
48+
code:`it("should pass", () => { anyChain.of.calls.expect(true) })`,
49+
options:[{assertFunctionNames:['**.expect']}]
50+
},
51+
{
52+
code:`it("should pass", () => { any_chain.of.calls.expect(true) })`,
53+
options:[{assertFunctionNames:['**.expect']}]
54+
}
4655
],
4756
invalid:[
4857
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp