Skip to content

Commit

Permalink
Merge pull request #216 from lo1tuma/gh-100
Browse files Browse the repository at this point in the history
Relax no-synchronous-tests to allow non literals from concise arrows
  • Loading branch information
lo1tuma authored Oct 28, 2019
2 parents 951ac00 + 1ddaced commit 913015a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/no-synchronous-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function doesReturnPromise(functionExpression) {

if (bodyStatement.type === 'BlockStatement') {
returnStatement = findPromiseReturnStatement(functionExpression.body.body);
} else if (bodyStatement.type === 'CallExpression') {
} else if (bodyStatement.type !== 'Literal') {
// allow arrow statements calling a promise with implicit return.
returnStatement = bodyStatement;
}
Expand Down
4 changes: 4 additions & 0 deletions test/rules/no-synchronous-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ ruleTester.run('no-synchronous-tests', rules['no-synchronous-tests'], {
code: 'it("", () => promise() );',
parserOptions: { ecmaVersion: 6 }
},
{
code: 'it("", () => promise );',
parserOptions: { ecmaVersion: 6 }
},
{
code: 'it("", () => promise.then() );',
parserOptions: { ecmaVersion: 6 }
Expand Down

0 comments on commit 913015a

Please sign in to comment.