fbredius/storybook

View on GitHub
scripts/utils/jest-transform-ts.js

Summary

Maintainability
A
0 mins
Test Coverage
const tsTransformer = require('jest-preset-angular/preprocessor');
const babelTransformer = require('./jest-transform-js');

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);
};