Closed gsnedders closed 3 years ago
I think this is a good idea. My main concern is that different browsers may stringify the functions differently and end up with different test names. Do we have any insight into how likely that is?
Do we have any insight into how likely that is?
@othermaciej said they were "pretty interoperable in practice (or at least good enough for this purpose)"
Just want to confirm that this won't apply to single-page tests as they don't meet the criteria of "simple arrow func", right?
It won't because they don't. I don't know what we could do for single page tests, given that the use case there is typically more complex event-based things.
Single page tests can continue to use the title for the test name.
About how interoperable Function.prototype.toString
is. Here are test results for test262 for JSC, V8, SpinderMonkey:
I think the only relevant test is arrow-function.js
, which passes in those 3 JS engines. The test doesn't test handling of newlines, but testing manually it seems consistent.
Do we have any insight into how likely that is?
@othermaciej said they were "pretty interoperable in practice (or at least good enough for this purpose)"
Adding to this, the latest ECMAScript spec defines what happens pretty exactly for functions that have source text.
The current spec language comes from this proposal, which explicitly lists the goal:
So I think it's safe to count on interoperability here (or at least, it's likely to improve rather than get worse).
Yay, nobody objected! 🎉
Rendered
see also https://github.com/web-platform-tests/wpt/pull/25853