storybook/scripts/jest-ts-babel.js

11 lines
480 B
JavaScript
Raw Permalink Normal View History

const tsTransformer = require('jest-preset-angular/preprocessor');
2018-08-15 17:26:24 +03:00
const babelTransformer = require('./babel-jest');
module.exports.process = function transform(src, path, config, transformOptions) {
const tsResult = tsTransformer.process(src, path, config, transformOptions);
const jsPath = path.replace('.ts', '.js');
const source = typeof tsResult === 'string' ? tsResult : tsResult.code;
return babelTransformer.process(source, jsPath, config, transformOptions);
};