Skip to content

Commit 95dc7d6

Browse files
committed
let babel and jest work automatically
1 parent 87e5b47 commit 95dc7d6

File tree

5 files changed

+24
-89
lines changed

5 files changed

+24
-89
lines changed

babel.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = function (api) {
2+
// const isTest = api.env('test');
3+
4+
api.cache(() => process.env.NODE_ENV);
5+
6+
const presets = [
7+
[
8+
'@babel/env',
9+
{
10+
targets: { browsers: ['last 2 versions', 'ie >= 10'] },
11+
},
12+
],
13+
['@babel/preset-typescript', { allowDeclareFields: true }],
14+
];
15+
16+
return {
17+
assumptions: {
18+
noClassCalls: true,
19+
superIsCallableConstructor: true,
20+
},
21+
presets,
22+
};
23+
};

jest.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ module.exports = {
33
testRunner: 'jest-jasmine2', // See https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults as `jasmine-check` uses jasmine and not `jest-circus`
44
moduleFileExtensions: ['js', 'ts'],
55
resolver: '<rootDir>/resources/jestResolver.js',
6-
transform: {
7-
'^.+\\.(js|ts)$': '<rootDir>/resources/jestPreprocessor.js',
8-
},
96
testRegex: '/__tests__/.*\\.(ts|js)$',
107
unmockedModulePathPatterns: ['./node_modules/react'],
118
};

resources/jestPreprocessor.js

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

resources/rollup-config.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import path from 'path';
2-
import babel from '@rollup/plugin-babel';
2+
import { babel } from '@rollup/plugin-babel';
33
import commonjs from '@rollup/plugin-commonjs';
44
import json from '@rollup/plugin-json';
55
import terser from '@rollup/plugin-terser';
@@ -12,7 +12,6 @@ const extensions = ['.ts', '.tsx', '.js', '.jsx'];
1212

1313
export default [
1414
{
15-
external: [/@babel\/runtime/],
1615
input: path.join(SRC_DIR, 'Immutable.js'),
1716
plugins: [
1817
commonjs(),

src/.babelrc.json

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

0 commit comments

Comments
 (0)