Skip to content

Commit 29293c4

Browse files
committed
chore: Simplify Babel config, inlining it Jest config
1 parent 4c30eb6 commit 29293c4

File tree

5 files changed

+19
-39
lines changed

5 files changed

+19
-39
lines changed

config/babel.config.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

config/jest.config.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
let moduleNameMapper
2+
3+
const babel = [
4+
'babel-jest',
5+
{
6+
overrides: [
7+
{
8+
test: '**/*.ts',
9+
plugins: [
10+
['@babel/plugin-transform-typescript', { allowDeclareFields: true }]
11+
]
12+
}
13+
],
14+
presets: [['@babel/env', { targets: { node: 'current' } }]]
15+
}
16+
]
17+
218
const transform = {
3-
'[/\\\\]tests[/\\\\].*\\.(m?js|ts)$': [
4-
'babel-jest',
5-
{ configFile: './config/babel.config.js' }
6-
]
19+
'[/\\\\]tests[/\\\\].*\\.(m?js|ts)$': babel
720
}
821

922
// The npm script name is significant.
@@ -16,10 +29,7 @@ switch (process.env.npm_lifecycle_event) {
1629
'^yaml/util$': '<rootDir>/dist/util.js',
1730
'^../src/test-events$': '<rootDir>/dist/test-events.js'
1831
}
19-
transform['[/\\\\]dist[/\\\\].*\\.mjs$'] = [
20-
'babel-jest',
21-
{ configFile: './config/babel.config.js' }
22-
]
32+
transform['[/\\\\]dist[/\\\\].*\\.mjs$'] = babel
2333
break
2434

2535
case 'test':
@@ -30,10 +40,7 @@ switch (process.env.npm_lifecycle_event) {
3040
'^yaml/cli$': '<rootDir>/src/cli.ts',
3141
'^yaml/util$': '<rootDir>/src/util.ts'
3242
}
33-
transform['[/\\\\]src[/\\\\].*\\.ts$'] = [
34-
'babel-jest',
35-
{ configFile: './config/babel.config.js' }
36-
]
43+
transform['[/\\\\]src[/\\\\].*\\.ts$'] = babel
3744
}
3845

3946
module.exports = {

config/rollup.browser-config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default {
1616
}),
1717
babel({
1818
babelHelpers: 'bundled',
19-
configFile: './config/babel.config.js',
2019
presets: [['@babel/env', { modules: false }]]
2120
}),
2221
typescript({ declaration: false, outDir: 'browser/dist' })

package-lock.json

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@
6969
},
7070
"devDependencies": {
7171
"@babel/core": "^7.12.10",
72-
"@babel/plugin-transform-class-properties": "^7.23.3",
73-
"@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4",
7472
"@babel/plugin-transform-typescript": "^7.12.17",
7573
"@babel/preset-env": "^7.12.11",
7674
"@eslint/js": "^9.9.1",

0 commit comments

Comments
 (0)