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

Used SWC instead of Babel for Jest tests #1367

Merged
merged 6 commits into from
Feb 21, 2022
Merged

Used SWC instead of Babel for Jest tests #1367

merged 6 commits into from
Feb 21, 2022

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Feb 20, 2022

PR Checklist

Overview

Uses @swc/jest instead of babel-jest.

  • Execution: jest --clearCache before each command. Terminal was in focus and no actions taken on open programs during test runs.
  • Hardware: Surface Laptop 4, 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz.
  • Reporting: Time ranges are rounded numbers from 7 runs with the highest and lowest values removed.
  • Software: WSL 2.0 in an Ubuntu drive via a VS Code terminal.
Command Babel Time SWC Time (old - new) / old x 100%
jest 18-20 seconds 11-14 seconds 30-40% faster
jest --coverage --maxWorkers=2 23-28 seconds 20-25 seconds 10-13% faster

Sorted raw time data:

  • Babel:
    • jest: 16.151, 17.686, 18.548, 18.738, 19.278, 19.676, 20.091
    • jest --coverage --maxWorkers=2: 22.320, 23.239, 24.898, 25.109, 27.087, 27.724, 28.649
  • SWC:
    • jest: 11.488, 11.862, 12.709, 13.558, 13.932, 14.215, 14.351
    • jest --coverage --maxWorkers=2: 19.839, 20.708, 22.430, 23.670, 24.704, 25.013, 25.248

"@babel/plugin-proposal-optional-chaining": "7.16.7",
"@babel/preset-env": "7.16.11",
"@babel/preset-typescript": "7.16.7",
"@swc/jest": "^0.2.17",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1370 mentioned that @swc/core should be added too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +28 to +32
{
jsc: {
target: "es2021",
},
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of swc-project/jest#75, these are no longer required.

Suggested change
{
jsc: {
target: "es2021",
},
},

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

Successfully merging this pull request may close these issues.

Use SWC instead of Babel
1 participant