Describe the bug
I am trying to use @wordpress/scripts for unit tests. Still running into #13364, but there's also another issue when running wp-scripts test-unit-js:
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
npm install --save core-js@2 npm install --save core-js@3
yarn add core-js@2 yarn add core-js@3
Indeed, @wordpress/babel-preset-default uses useBuiltIns when running tests, but does not specify the corejs version:
|
if ( isTestEnv ) { |
|
opts.useBuiltIns = 'usage'; |
To reproduce
Steps to reproduce the behavior:
- Install
wp-scripts in your project.
- Try to run some tests
- Notice error
Expected behavior
The Babel config should add the corejs option in that scenario.
Describe the bug
I am trying to use
@wordpress/scriptsfor unit tests. Still running into #13364, but there's also another issue when runningwp-scripts test-unit-js:Indeed,
@wordpress/babel-preset-defaultusesuseBuiltInswhen running tests, but does not specify thecorejsversion:gutenberg/packages/babel-preset-default/index.js
Lines 20 to 21 in 354c1ff
To reproduce
Steps to reproduce the behavior:
wp-scriptsin your project.Expected behavior
The Babel config should add the
corejsoption in that scenario.