Mocha arrow-function and unnamed function errors.
See original GitHub issueHello community I am receiving errors whenever I am using using describe(function(){})
in my code.
How can I get rid of these errors?
Here is my .eslintrc.yml.
extends: airbnb-base
plugins:
- standard
- promise
env:
node: true
mocha: true
rules:
indent: ["error", 2]
semi: ["error", "always", {omitLastInOneLineBlock: true}]
no-eval: ["error"]
no-trailing-spaces: ["error"]
one-var-declaration-per-line: ["error", "initializations"]
no-irregular-whitespace: ["error"]
no-var: ["error"]
no-empty: ["error"]
linebreak-style: ["error", "unix"]
eol-last: ["error", "always"]
no-console: ["warn", {"allow": ["warn", "error", "info"]}]
no-use-before-define: ["error", { "functions": false }]
no-unused-vars: ["error", {"argsIgnorePattern":"^next"}]
Tried to add mocha-plugin like so:
plugins:
- mocha
rules:
mocha/no-arrow-function: "error"
but it still gives me errors.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12
Top Results From Across the Web
What does `this` point at in the following js arrow functions in ...
log are arrow functions and as I've said above, if you use an arrow function then you cannot access the object that Mocha...
Read more >Two situations where to avoid Arrow Functions
Passing arrow functions (aka “lambdas”) to Mocha is discouraged. Lambdas lexically bind this and cannot access the Mocha context. Let's give it ...
Read more >Tests, closures and arrow functions - Gleb Bahmutov
Imagine a Mocha test file like this spec.js12345describe('my tests', ... What happens when you use arrow function as a test callback?
Read more >Mocha - the fun, simple, flexible JavaScript test framework
Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun. Mocha tests run ......
Read more >Synchronous code, arrow functions and hooks - mocha
You can invoke any hook with an optional description, this makes it easier to pinpoint errors in your tests. If you give a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone stumbling here in 2019, I followed ljharb’s advice and added the following
.eslintrc
config in my test directoryAs i said even if I name a function I am still receiving error with
prefer-arrow-callback