-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Remove indexOf
usage from tests in favor of includes
#12586
Comments
I have no strong opinions, +0. |
(BTW, how about new |
cc @nodejs/lts @nodejs/testing |
Since it's not a problem with ES6, I think more like |
IMHO that should be done. Reasons: readability and [NaN]. |
Maybe a "good first contribution" or "code-and-lean" like #12376 |
Obviously doesn't make sense for the cases where you actually use the index, but otherwise SGTM. |
@gibfahn see new desc |
I'm not sure we should make these changes until v4 is officially no longer supported at all, just in case we make some improvements to tests and want to backport them. |
BTW, v4 supports |
@vsemozhetbyt I dunno, personally I'd rather just avoid it altogether (string or array) to avoid any confusion. |
+1 to what @mscdex said. Also I think |
From what I understand from what @MylesBorins wrote in #12499 (comment), there will be no backporting of any improvements, just bug fixes. Those will probably come with new test-cases, that will need to be re-written to |
@refack I said improvements to tests, not feature additions to core that are backported. Sometimes tests themselves are refactored (e.g. what code and learn is doing now with adding |
Since this is the first time a big version enters maintenance, I think you are raising an interesting issue that should be discussed in a wider context then this thread. spinning-off nodejs/Release#203 |
PR-URL: #13852 Refs: #12586 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]>
PR-URL: nodejs#13852 Refs: nodejs#12586 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]>
Start the transition to Array.prototype.includes() and String.prototype.includes(). This commit refactors most of the comparisons of Array.prototype.indexOf() and String.prototype.indexOf() return values with -1 to the former methods in tests. PR-URL: #12604 Refs: #12586 Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
PR-URL: #13852 Refs: #12586 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]>
PR-URL: #13852 Refs: #12586 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]>
PR-URL: #13852 Refs: #12586 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]>
Hello @refack , could you please update a little bit the list? because I think that the current state is the following, but I would like your oppinion: indexOf that shouldn't be changed
pending
|
Refs: #12586 PR-URL: #14630 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]>
Refs: #12586 PR-URL: #14630 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]>
PR-URL: #13215 Refs: #12586 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
PR-URL: #13852 Refs: #12586 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]>
PR-URL: #13852 Refs: #12586 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]>
PR-URL: #13215 Refs: #12586 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
PR-URL: #13852 Refs: #12586 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]>
actually for the case in cc @refack |
This has already been backported to LTS, removing the label. |
This is pretty outdated. We had all errors migrated and now there are a couple new files that contain I am closing this as resolved for now. If we get lots of those in, we can reopen the issue / create a new one. |
Start the transition to Array.prototype.includes() and String.prototype.includes(). This commit refactors most of the comparisons of Array.prototype.indexOf() and String.prototype.indexOf() return values with -1 to the former methods in tests. PR-URL: nodejs#12604 Refs: nodejs#12586 Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
Start the transition to Array.prototype.includes() and String.prototype.includes(). This commit refactors most of the comparisons of Array.prototype.indexOf() and String.prototype.indexOf() return values with -1 to the former methods in tests. Backport-PR-URL: #19447 PR-URL: #12604 Refs: #12586 Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
Since v4 entered maintenance, do you think we can eliminate most of the 433 instances of
indexOf
from/test/*.js
?Note: The prefered alternative is
assert.strictEqual(foo.includes(bar), true)
Each hit should be evaluated whether it's an
includes
surrogate, or a realindexOf
use:test\addons\repl-domain-abort
test\async-hooks
test\common
test\disabled
test\doctool
test\internet
test\parallel
test\pummel
and a special treat
The text was updated successfully, but these errors were encountered: