rabblerouser / core

Pluggable, extensible membership database for community organising
GNU Affero General Public License v3.0
17 stars 10 forks source link

Guard idiomatic Chai expressions from ESLint `no-unused-expressions` #177

Open bfinney-thoughtworks opened 6 years ago

bfinney-thoughtworks commented 6 years ago

For bugs:

Expected behaviour:

The ESLint tests should pass for all code, with no warnings.

Actual behaviour:

The test case code is flagged by ESLint with these warnings:

/app/backend/spec/unit/lib/inputValidatorSpec.js
   25:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
   32:7  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
   43:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
   54:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
   72:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
   84:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  100:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  111:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  125:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  138:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  155:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  165:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  172:7  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  182:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  190:7  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  194:7  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  207:9  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions

/app/backend/spec/unit/lib/memberValidatorSpec.js
  23:7  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions
  28:7  warning  Expected an assignment or function call and instead saw an expression  no-unused-expressions

✖ 19 problems (0 errors, 19 warnings)

These are because the idiomatic Chai usage of expect(foo).to-be-true, etc., is an expression which appears unused.

bfinney-thoughtworks commented 6 years ago

I have created merge request https://github.com/rabblerouser/core/pull/178 to resolve this.