Skip to content

Commit

Permalink
Support this for additionalCustomNames
Browse files Browse the repository at this point in the history
  • Loading branch information
thatsmydoing committed Jul 14, 2022
1 parent a2c42a2 commit 2f965f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/util/ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ function getPropertyName(property) {
}

function getNodeName(node) {
if (node.type === 'ThisExpression') {
return 'this';
}
if (node.type === 'MemberExpression') {
return `${getNodeName(node.object)}.${getPropertyName(node.property)}`;
}
Expand Down
9 changes: 9 additions & 0 deletions test/rules/no-exclusive-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ ruleTester.run('no-exclusive-tests', rules['no-exclusive-tests'], {
}
},
errors: [ { message: expectedErrorMessage, column: 7, line: 1 } ]
},
{
code: 'this.it.only()',
settings: {
mocha: {
additionalCustomNames: [ { name: 'this.it', type: 'testCase', interfaces: [ 'BDD' ] } ]
}
},
errors: [ { message: expectedErrorMessage, column: 9, line: 1 } ]
}
]
});

0 comments on commit 2f965f1

Please sign in to comment.