Skip to content

Commit

Permalink
Relax no-synchronous-tests to allow non literals from concise arrows
Browse files Browse the repository at this point in the history
  • Loading branch information
lo1tuma committed Oct 25, 2019
1 parent 8b3841c commit 1ddaced
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 1ddaced

Please sign in to comment.