Skip to content

Commit

Permalink
Converted scripts to use ESM module system
Browse files Browse the repository at this point in the history
  • Loading branch information
Sampo Kivistö committed Jun 15, 2022
1 parent ef61532 commit 614a1d2
Show file tree
Hide file tree
Showing 31 changed files with 2,721 additions and 2,954 deletions.
6 changes: 2 additions & 4 deletions jest.babel.transform.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Custom Jest transform implementation that wraps babel-jest and injects our
// babel presets, so we don't have to use .babelrc.
const babelJest = require('babel-jest').default;
import babelJest from 'babel-jest';

const babelTransformer = babelJest.createTransformer({
export default babelJest.createTransformer({
babelrc: false,
presets: [
["@babel/preset-env",
Expand All @@ -20,5 +20,3 @@ const babelTransformer = babelJest.createTransformer({
["@babel/plugin-proposal-class-properties", { "loose": true }]
]
});

module.exports = babelTransformer;
5 changes: 2 additions & 3 deletions jest.config-nodom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
collectCoverageFrom: [
"packages/*/src/**/*.ts",
"!**/*.ts.js",
Expand All @@ -17,7 +17,6 @@ module.exports = {
"^inferno(.*?)$": "<rootDir>/packages/inferno$1/src/index.ts",
"mobx": "<rootDir>/node_modules/mobx"
},
rootDir: __dirname,
setupFiles: [],
testMatch: [
"<rootDir>/packages/*/__tests__/**/*spec.server-nodom.@(js|ts)?(x)"
Expand All @@ -32,4 +31,4 @@ module.exports = {
testEnvironment: "node",
testRunner: "jest-jasmine2",
reporters: [["jest-silent-reporter", { "useDots": true }]]
};
}
5 changes: 2 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
collectCoverageFrom: [
"packages/*/src/**/*.ts",
"!**/*.ts.js",
Expand All @@ -17,7 +17,6 @@ module.exports = {
"^inferno(.*?)$": "<rootDir>/packages/inferno$1/src/index.ts",
"mobx": "<rootDir>/node_modules/mobx"
},
rootDir: __dirname,
setupFiles: ["<rootDir>/scripts/test/requestAnimationFrame.ts"],
testMatch: [
"<rootDir>/packages/*/__tests__/**/*spec.@(js|ts)?(x)",
Expand All @@ -33,4 +32,4 @@ module.exports = {
testEnvironment: "jsdom",
testRunner: "jest-jasmine2",
reporters: [["jest-silent-reporter", { "useDots": true }]]
};
}
11 changes: 6 additions & 5 deletions jest.ts.transform.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const typescript = require('typescript');
const babelJest = require('babel-jest').default;
import typescript from 'typescript';
import babelJest from 'babel-jest';
import {readFileSync} from 'fs';

const transformer = babelJest.createTransformer({
babelrc: false,
Expand All @@ -20,9 +21,9 @@ const transformer = babelJest.createTransformer({
]
});

const tsConfig = require('./tsconfig.json');
const tsConfig = JSON.parse(readFileSync('./tsconfig.json'));

module.exports = {
export default {
process(src, path, config) {
return transformer.process(
typescript.transpile(
Expand All @@ -35,4 +36,4 @@ module.exports = {
config
);
},
};
}
Loading

0 comments on commit 614a1d2

Please sign in to comment.