test262 icon indicating copy to clipboard operation
test262 copied to clipboard

test the ES5.X

Open jsjzgy opened this issue 5 years ago • 4 comments

I want to test the ES5.X test cases separately. How can I separate ES5.X test cases from this code library?

jsjzgy avatar Oct 13 '20 02:10 jsjzgy

Test262 only supports testing the latest draft specification + stage 3 proposals. If you use the features flags to omit tests that you don't want to include, you could probably get pretty close to ES5, since the features mechanism was only introduced for ES6.

I'd be remiss if I didn't also mention that ES5.1 was published over 9 years ago and was replaced by ES6 over 5 years ago.

rwaldron avatar Oct 14 '20 18:10 rwaldron

Are the feature flags in the features.txt file all the features supported by the ES? What is the granularity of the list?

jsjzgy avatar Oct 15 '20 03:10 jsjzgy

@jsjzgy That should be every feature added since ES5.1, but the practice wasn't fully established back in 2015, so there may be ES6 features that were missed, but I wouldn't be opposed to adding them and updating all the tests that would need such flags.

As for granularity: the rule is generally that, if a test file contains any code that makes use of a feature that has a corresponding feature flag, that flag must be present in the features: [] list. So, for example... if a test uses an arrow function, but isn't specifically a test of arrow functions themselves, the test must still have features: [arrow-function]. There has been varying levels of enforcement over the years, including from myself (I used to be a hardline feature-flag-enforcer, but then some folks urged us to relax the rules). I'd like to see a return to strict enforcement.

I'm curious—are you implementing an ES5.x compliant engine?

rwaldron avatar Oct 19 '20 13:10 rwaldron

We had a good conversation about this a few years ago: https://github.com/tc39/test262/issues/569. (Bear in mind that discussion is a little more generic because it concerns the ability to test any revision of the language.)

jugglinmike avatar Jan 21 '21 19:01 jugglinmike