Skip to content

Commit

Permalink
Merge pull request #329 from thatsmydoing/custom-this
Browse files Browse the repository at this point in the history
Support this for additionalCustomNames
  • Loading branch information
lo1tuma committed Jul 20, 2022
2 parents a2c42a2 + 2f965f1 commit 9fd40ea
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
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
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 9fd40ea

Please sign in to comment.