@fintechstudios/eslint-plugin-chai-as-promised
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -0,1 +1,14 @@ | ||
# [3.0.1](https://github.com/fintechstudios/eslint-plugin-chai-as-promised/compare/v3.0.0...v3.0.1) (2020-03-23) | ||
#### Fixes | ||
* no-await-in-condition: better detection of await expression (#14) | ||
# [3.0.0](https://github.com/fintechstudios/eslint-plugin-chai-as-promised/compare/v2.0.0...v3.0.0) (2020-03-23) | ||
### Features | ||
* no-await-in-condition: new rule to report use of await within chai-as-promised conditions (#10) | ||
### BREAKING CHANGES | ||
* Adds new rule to `recommended` | ||
# [2.0.0](https://github.com/fintechstudios/eslint-plugin-chai-as-promised/compare/v1.0.0...v2.0.0) (2020-02-25) | ||
@@ -2,0 +15,0 @@ |
@@ -53,2 +53,7 @@ # Must not use await within chai-as-promised expressions (no-await-in-condition) | ||
}); | ||
it('should ...', async function() { | ||
// This is ok since the chain is not a `chai-as-promised` one | ||
return expect(await promise).to.be.true; | ||
}); | ||
``` |
@@ -17,5 +17,6 @@ 'use strict'; | ||
if (chaiAsPromisedCall && | ||
chaiCall && esquery(chaiCall.parent, '.arguments[type="AwaitExpression"]') | ||
) { | ||
if (chaiAsPromisedCall && chaiCall && esquery( | ||
chaiCall.parent, | ||
':matches(.arguments[type="AwaitExpression"], .object[type="AwaitExpression"])' | ||
).length) { | ||
context.report({ | ||
@@ -22,0 +23,0 @@ node: chaiAsPromisedCall, |
@@ -36,2 +36,3 @@ 'use strict'; | ||
'expect(promise).to.have.property(\'flavors\').with.lengthOf(3)', | ||
'expect(await promise).to.be.true', | ||
'promise.should.be.a(\'string\')', | ||
@@ -41,2 +42,3 @@ 'promise.should.equal(\'bar\')', | ||
'promise.should.have.property(\'flavors\').with.lengthOf(3)', | ||
'(await promise).should.be.a(\'string\')', | ||
'assert.typeOf(promise, \'string\')', | ||
@@ -46,3 +48,6 @@ 'assert.equal(promise, \'bar\')', | ||
'assert.property(promise, \'flavors\')', | ||
'assert.lengthOf(promise.flavors, 3)' | ||
'assert.lengthOf(promise.flavors, 3)', | ||
'assert.equal(await promise, \'bar\')', | ||
`expect(func()).to.be.rejectedWith(Error, 'No good!') | ||
` | ||
] | ||
@@ -49,0 +54,0 @@ ).map(function (code) { |
{ | ||
"name": "@fintechstudios/eslint-plugin-chai-as-promised", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Prevent common problems when using chai-as-promised", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23615
360