How to use @jest/transform - 2 common examples

To help you get started, we’ve selected a few @jest/transform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / storybook / addons / storyshots / storyshots-core / injectFileName.js View on Github external
const getNextTransformer = (fileName, config) => {
  const self = config.transform.find(([pattern]) => new RegExp(pattern).test(fileName));
  return new ScriptTransformer({
    ...config,
    transform: config.transform.filter(entry => entry !== self),
  });
};
github storybookjs / storybook / addons / docs / jest-transform-mdx.js View on Github external
const getNextTransformer = (filename, config) => {
  const extension = path.extname(filename);
  const jsFileName = `${filename.slice(0, -extension.length)}.js`;
  const self = config.transform.find(([pattern]) => new RegExp(pattern).test(filename));
  const jsTransforms = config.transform.filter(([pattern]) => new RegExp(pattern).test(jsFileName));
  return new ScriptTransformer({
    ...config,
    transform: [
      ...config.transform.filter(entry => entry !== self),
      ...jsTransforms.map(([pattern, ...rest]) => [self[0], ...rest]),
    ],
  });
};

@jest/transform

MIT
Latest version published 1 year ago

Package Health Score

82 / 100
Full package analysis

Popular @jest/transform functions

Similar packages