web-platform-tests / rfcs

web-platform-tests RFCs
75 stars 63 forks source link

Use arrow funcs as the default test name #64

Closed gsnedders closed 3 years ago

gsnedders commented 3 years ago

Rendered

see also https://github.com/web-platform-tests/wpt/pull/25853

jgraham commented 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?

gsnedders commented 3 years ago

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)"

Hexcles commented 3 years ago

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?

jgraham commented 3 years ago

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.

zcorpan commented 3 years ago

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:

https://test262.report/browse/built-ins/Function/prototype/toString?engines=javascriptcore%2Cspidermonkey%2Cv8

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.

othermaciej commented 3 years ago

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).

gsnedders commented 3 years ago

Yay, nobody objected! 🎉