From 3a195d161ea20a4ab6f74869630278bc93c19fc7 Mon Sep 17 00:00:00 2001 From: Brandon Mills Date: Fri, 1 Jan 2021 17:28:36 -0500 Subject: [PATCH] Do not use Function.prototype.bind on it.only --- designs/2020-rule-tester-only/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designs/2020-rule-tester-only/README.md b/designs/2020-rule-tester-only/README.md index e638ba4f..7326fa12 100644 --- a/designs/2020-rule-tester-only/README.md +++ b/designs/2020-rule-tester-only/README.md @@ -46,8 +46,8 @@ To allow using `RuleTester` with a custom test framework other than Mocha, paral 1. Add an `itOnly` `set` accessor that sets `RuleTester[IT_ONLY]`. 1. Add an `itOnly` `get` accessor. 1. If `RuleTester[IT_ONLY]` is set, return it. - 2. If global `it` and `it.only` are functions, return `Function.bind.call(it.only, it)`. - 3. Throw an error: + 2. If global `it` and `it.only` are functions, return `it.only`. *Note: Do not return `Function.bind.call(it.only, it)` because this does not work with Mocha. If `this` is important, we could return a wrapper function.* + 1. Throw an error: 1. If either `RuleTester[DESCRIBE]` or `RuleTester[IT]` is customized, recommend setting a custom `RuleTester.itOnly`. 2. If global `it` is a function, the current test framework does not support `only`. 3. Otherwise recommend installing a test framework like Mocha so that `only` can be used.