Skip to content

Replace () => arrow lambdas with function () for Mocha #3631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2021

Conversation

andyleejordan
Copy link
Member

The former lexically binds this and so prevents access to Mocha's test context, hence its documentation advises the use of function () instead. This allows access to the context for skipping, parameterization, etc.

Part of #3596.

@andyleejordan andyleejordan added Issue-Enhancement A feature request (enhancement). Area-Test labels Oct 21, 2021
@andyleejordan andyleejordan requested a review from rjmholt October 21, 2021 23:49
@andyleejordan andyleejordan changed the title Replace () => arrow lambds with function () for MochaJS Replace () => arrow lambds with function () for Mocha Oct 21, 2021
@andyleejordan
Copy link
Member Author

Oops:

only-arrow-functions non-arrow functions are forbidden

Will have to fix the lint rule because this is Mocha's recommended practice (and necessary for the next step of proper parameterization).

@andyleejordan andyleejordan marked this pull request as draft October 22, 2021 00:00
The former lexically binds `this` and so prevents access to Mocha's test
context, hence its documentation advises the use of `function ()`
instead. This allows access to the context for skipping,
parameterization, etc.

Note that this requires disabling the TSLint rule which disagrees with
Mocha's recommendation.
@andyleejordan andyleejordan marked this pull request as ready for review October 22, 2021 00:12
@andyleejordan andyleejordan changed the title Replace () => arrow lambds with function () for Mocha Replace () => arrow lambdas with function () for Mocha Oct 22, 2021
@andyleejordan andyleejordan enabled auto-merge (squash) October 22, 2021 00:13
@andyleejordan andyleejordan merged commit eae36d0 into master Oct 25, 2021
@andyleejordan andyleejordan deleted the andschwa/mocha branch October 25, 2021 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Test Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants