September 2018
Intermediate to advanced
764 pages
20h 6m
English
We have already encountered the func-names and prefer-arrow-callback rules before when we wrote our E2E tests with cucumber-js. Back then, we needed to keep using function expressions instead of arrow functions because cucumber-js uses this inside each function to maintain context between different steps of the same scenario. If we'd used arrow functions, this would be bound, in our case, to the global context, and we'd have to go back to using file-scope variables to maintain state between steps.
As it turns out, Mocha also uses this to maintain a "context". However, in Mocha's vocabulary, a "context" is not used to persist state between steps; rather, a Mocha context provides the following methods, ...
Read now
Unlock full access