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
Remove babel polyfill from fixture test runner #12130
Remove babel polyfill from fixture test runner #12130
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/36192/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 381f099:
|
cca600c
to
ed8665b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testing native node built-ins sounds great, makes sense - not sure how to review build changes other than testing it?
"plugins": [ | ||
"transform-async-to-generator", | ||
"proposal-async-generator-functions", | ||
"./inject-corejs-async-iterator-polyfill.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add a preloadScripts
option to the test runner instead?
{
"parserOpts": {
"allowReturnOutsideFunction": true
},
"plugins": [
"transform-async-to-generator",
"proposal-async-generator-functions"
],
"preloadScripts": [
"core-js/es/symbol/async-iterator.js"
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't want to do the plugin hack yeah that could be ok - we should probably document all the config changes somewhere (for ourselves)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My plan at that time was to use babel-plugin-polyfill-corejs3
but I forgot the error messages I came across.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably it's that it wasn't supported by Node.js 6-8.
We can revisit this after Babel 8: maybe add a // TODO(Babel 8)
comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Babel 8 this polyfill won't be needed anyway, since Symbol.asyncIterator
will be natively supported.
ed8665b
to
12a761e
Compare
@@ -167,32 +170,6 @@ export function runCodeInTestContext( | |||
} | |||
} | |||
|
|||
function wrapPackagesArray(type, names, optionsDir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are moved to @babel/helper-fixtures
.
checksum: 6ef567c662088b1b292214920cbd72443059298d477f72e1a37e0a113bafbfac9057cbfe35ae617284effc4b423493326a78561bbff7b04162c7949bdb9624e8 | ||
languageName: node | ||
linkType: hard | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@babel/polyfills
still uses ^0.13.4
. We can explore bumping it to 0.14
later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I'm overly excited about the idea of finally removing @babel/polyfill
, since we deprecated it long time ago 😂)
The polyfill is required by Node.js 6
44545e5
to
810f3db
Compare
I released a new version of the babel-polyfills packages which should fix the CI failure. |
fixture-runner
execution speedregenerator-runtime
instead of deprecated@babel/polyfill
This PR includes commits from #12127. For the real diff, see https://github.com/babel/babel/pull/12130/files/ed39a04b65315164d884744e31791f0984cdfdb6..ed8665b7100dcf6b3f0d8f113aee723ef1fbf568.
Before this PR the fixture runner can access various builtin polyfills provided by
core-js
, after this PR the fixture runner can only accessregenerator-runtime
andbabel-helpers
. The test execution time is thus improved. What's more, we are now testing against builtins provided by test engines (Node.js), so it the test result does not rely on the behaviour of builtin-polyfill provider. (regenerator-runtime
is not builtin polyfill since it provides onlyregeneratorRuntime
namespace).In ed8665b we introduce an integration example with core-js 3: The
symbol-async-iterator
polyfill is injected before each test suites is run. To achieve this we add support of suite plugins in@babel/helper-test-fixtures
.