test262 icon indicating copy to clipboard operation
test262 copied to clipboard

Harness relies on ES6(+) features

Open p-bakker opened this issue 4 years ago • 1 comments
trafficstars

I know most consumers of the test262 probably have a more or less compliant EcmaScript implementation, at least with all the main features implemented, but reality is that there are also some implementations that are behind, for example Rhino (or new implementations might be started from scratch)

While trying to improve Rhino, we keep running into issues where harness code uses >=ES6 features (f.e. unicode regex, default params) which Rhino doesn't support yet (we're working on it though), which causes tests to fail or give false positives

So I'm wondering: shouldn't the harness code refrain from using newer features and stick to ES5 (except for harness code that explicitly tests newer features)?

Just some examples:

  1. nativeFunctionMatcher.js uses the u flag on regexes. Rhino doesn't support those, so any testcase that depends on nativeFunctionMatcher .js fails with a SyntaxError
  2. compareArray.js uses a default parameter value on assert.compareArray
  3. sta.js uses rest params for Thrower

I looked at docs that I could find, but couldn't find any guidance on this particular topic.

Would be great if the harness code could be made compatible with less compliant environments

Or another possibility would be to write the harness code using the latest syntax and features, but use Babel for example to compile it down to ES5. Would be easiest if that down-compiled version would be part of this repo (replacing the current content in /harness). That would be the easiest for us at least, but no idea what others thing of that

p-bakker avatar Jun 26 '21 08:06 p-bakker

Related: #3196

gibson042 avatar Aug 01 '24 16:08 gibson042