bitburner-src/test/jest/config/babelTransform.js
2024-09-09 18:36:00 -07:00

17 lines
619 B
JavaScript

const babelJest = require("babel-jest").default;
module.exports = {
process(sourceText, sourcePath, options) {
const alias = options?.config?.moduleNameMapper;
const extensions = options.config.moduleFileExtensions;
const babelTransformer = babelJest.createTransformer({
presets: [["@babel/preset-react"], ["@babel/preset-env"], ["@babel/preset-typescript"]],
plugins: [["transform-barrels", { executorName: "jest", alias: alias, extensions: extensions }]],
babelrc: false,
configFile: false,
});
return babelTransformer.process(sourceText, sourcePath, options);
},
};