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
228
228
at least `minimum` number of times when the test is complete, then the test will
229
229
fail.
230
230
231
-
If `fn` is not provided, `common.noop` will be used.
231
+
If `fn` is not provided, an empty function will be used.
232
232
233
233
### mustNotCall([msg])
234
234
*`msg`[<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) default = 'function should not have been called'
@@ -243,19 +243,6 @@ Returns a function that triggers an `AssertionError` if it is invoked. `msg` is
243
243
244
244
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.
245
245
246
-
### noop
247
-
248
-
A non-op `Function` that can be used for a variety of scenarios.
0 commit comments