switch modern-tests to use SWC instead of Babel for faster builds and simpler configuration

This commit is contained in:
Nacho Codoñer
2026-03-06 10:38:10 +01:00
parent dda561fc10
commit e793bee8e4
5 changed files with 341 additions and 1458 deletions

View File

@@ -1,14 +0,0 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
// This is needed to handle ES modules
sourceType: 'unambiguous',
};

View File

@@ -11,9 +11,14 @@ module.exports = {
transformIgnorePatterns: [
"/node_modules/(?!(execa|wait-on|is-docker|is-stream|human-signals|merge-stream|npm-run-path|onetime|mimic-fn|strip-final-newline|path-key|shebug-command|shebug-regex)/)"
],
// Use Babel to transform JavaScript files
transform: {
"^.+\\.js$": "babel-jest"
"^.+\\.js$": ["@swc/jest", {
jsc: {
parser: { syntax: "ecmascript" },
target: "es2022",
},
module: { type: "commonjs" },
}],
},
// Playwright configuration
globals: {

File diff suppressed because it is too large Load Diff

View File

@@ -6,8 +6,8 @@
"test": "jest --config jest.config.js"
},
"devDependencies": {
"@babel/preset-env": "^7.21.3",
"babel-jest": "^29.0.0",
"@swc/core": "^1.15.18",
"@swc/jest": "^0.2.39",
"cheerio": "^1.0.0-rc.12",
"execa": "^5.1.1",
"fs-extra": "^11.3.1",

View File

@@ -116,8 +116,9 @@ describe('Meteor Skeletons /', () => {
test: 'tests/main.js',
},
bodyStyles: {
'font-family':
'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
'font-family': process.platform === 'darwin'
? 'Inter, -apple-system, "system-ui", "Segoe UI", Roboto, sans-serif'
: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
padding: '10px',
},
}),