You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change removes `common.noop` from the Node.js internal testing
common module.
Over the last few weeks, I've grown to dislike the `common.noop`
abstraction.
First, new (and experienced) contributors are unaware of it and so it
results in a large number of low-value nits on PRs. It also increases
the number of things newcomers and infrequent contributors have to be
aware of to be effective on the project.
Second, it is confusing. Is it a singleton/property or a getter? Which
should be expected? This can lead to subtle and hard-to-find bugs. (To
my knowledge, none have landed on master. But I also think it's only a
matter of time.)
Third, the abstraction is low-value in my opinion. What does it really
get us? A case could me made that it is without value at all.
Lastly, and this is minor, but the abstraction is wordier than not using
the abstraction. `common.noop` doesn't save anything over `() => {}`.
So, I propose removing it.
PR-URL: #12822
Backport-PR-URL: #14174
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Returns a function that calls `fn`. If the returned function has not been called
202
202
at least `minimum` number of times when the test is complete, then the test will
203
203
fail.
204
204
205
-
If `fn` is not provided, `common.noop` will be used.
205
+
If `fn` is not provided, an empty function will be used.
206
206
207
207
### mustNotCall([msg])
208
208
*`msg`[<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) default = 'function should not have been called'
@@ -217,19 +217,6 @@ Returns a function that triggers an `AssertionError` if it is invoked. `msg` is
217
217
218
218
Returns `true` if the exit code `exitCode` and/or signal name `signal` represent the exit code and/or signal name of a node process that aborted, `false` otherwise.
219
219
220
-
### noop
221
-
222
-
A non-op `Function` that can be used for a variety of scenarios.
0 commit comments