Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fintechstudios/eslint-plugin-chai-as-promised

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fintechstudios/eslint-plugin-chai-as-promised - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

13

CHANGELOG.md

@@ -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;
});
```

7

lib/rules/no-await-in-condition.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc