Skip to content
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

tc39/test262 #543

Closed
dnalborczyk opened this issue Aug 3, 2018 · 5 comments
Closed

tc39/test262 #543

dnalborczyk opened this issue Aug 3, 2018 · 5 comments

Comments

@dnalborczyk
Copy link
Contributor

dnalborczyk commented Aug 3, 2018

I took a stab at running esm against the ECMA Test Suite tc39/test262 and it's looking pretty darn good so far!!

I included only https://github.com/tc39/test262/tree/master/test/language/module-code [for now]

I also added the "use modules" pragma, since otherwise esm thinks of some files as cjs modules. that being sad, I'm still thinking that behavior should be changed for the longer good 😕

236 tests are passing
16 tests I marked pending (in order to investigate)

out of the 16 pending are:

  • 4 tests using export * from ns

  • 1 test uses a stage 3 private class fields

  • some others seem like legit bugs, I'll report back here.

@jdalton regarding private class fields, would you rather have users go through Babel for syntax parsing and/or compilation? Which I believe the Babel plugin is not quite ready yet, but I sense it'll be very soon. There's also already several --harmony flags regarding private fields in node v10+ (for V8). (not quite sure why there is more than one flag though, I haven't looked into the differences).

I'm in the midst of automating the test run, so we can include it in the esm test suite. there's some small portions missing, plus the code needs some serious TLC.

PR coming ...

@dnalborczyk
Copy link
Contributor Author

TODO: reminder for dynamic imports: tc39/test262#1588

we could run against this branch temporarily and see what it does (and whitelist/blacklist if needed)

@jdalton
Copy link
Member

jdalton commented Aug 4, 2018

@dnalborczyk

WOW!!!

This is so nice! I'm floored here. Thank you so much for digging into this!

I also added the "use modules" pragma, since otherwise esm thinks of some files as cjs modules. that being sad, I'm still thinking that behavior should be changed for the longer good

Instead use the .mjs extension. It's a strict, locked down, mode and should be fine for conformance testing.

Oh, I see now. When testing locally changing all the extensions might be a pain and a quick "use module" addition is nice since you don't have to track down all the deps and rename them.

The test262 tests are probably assuming some out-of-band way to signal that the parse goal is "module". With browsers that's the type="module" attribute. With Node --experimental-modules it's .mjs (though more ways to signal are coming). The esm loader allows signaling the "module" goal with a variety of options, including the "use module" directive.

1 test uses a stage 3 private class fields

We should parse private class fields, so if it's erroring there then that's a bug on us. The rest is up to Node with the --harmony flag. We don't transform syntax beyond ESM support and rely on Node for support of object rest/spread, async, async generators, BigInt, etc.

Update:

Moved to #550.

@dnalborczyk
Copy link
Contributor Author

This is so nice! I'm floored here. Thank you so much for digging into this!

thank you!! much appreciated! 👍

Oh, I see now. When testing locally changing all the extensions might be a pain and a quick "use module" addition is nice since you don't have to track down all the deps and rename them.

that wouldn't be a problem as well, the way the test run is setup. I just have a really distaste of 'mjs'. 😖

The test262 tests are probably assuming some out-of-band way to signal that the parse goal is "module". With browsers that's the type="module" attribute. With Node --experimental-modules it's .mjs (though more ways to signal are coming). The esm loader allows signaling the "module" goal with a variety of options, including the "use module" directive.

ah, thank you! I'll get back to you with some thoughts on that later! I'm probably missing some things for the whole picture.

We should parse private class fields, so if it's erroring there then that's a bug on us. The rest is up to Node with the --harmony flag. We don't transform syntax beyond ESM support and rely on Node for support of object rest/spread, async, async generators, BigInt, etc.

I probably forgot the --harmony flag in the test run then if it's supported by esm. I didn't look into it at the time at writing who was throwing (esm vs. node)

@jdalton
Copy link
Member

jdalton commented Jan 13, 2019

The esm loader now passes all applicable test262 tests 🎉

@dnalborczyk
Copy link
Contributor Author

yeah, I noticed!

absolutely amazing job!!! 🎉🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants