@jest/transform

  • Version 27.1.0
  • Published
  • 47.2 kB
  • 15 dependencies
  • MIT license

Install

npm i @jest/transform
yarn add @jest/transform
pnpm add @jest/transform

Overview

Overview not available.

Index

Functions

function createScriptTransformer

createScriptTransformer: (
config: any,
cacheFS?: StringMap
) => Promise<TransformerType>;

    function createTranspilingRequire

    createTranspilingRequire: (
    config: any
    ) => Promise<
    <TModuleType = unknown>(
    resolverPath: string,
    applyInteropRequireDefault?: boolean
    ) => Promise<TModuleType>
    >;

      function handlePotentialSyntaxError

      handlePotentialSyntaxError: (e: ErrorWithCodeFrame) => ErrorWithCodeFrame;

        function shouldInstrument

        shouldInstrument: (
        filename: any,
        options: ShouldInstrumentOptions,
        config: any
        ) => boolean;

          Interfaces

          interface AsyncTransformer

          interface AsyncTransformer<OptionType = unknown> {}

            property canInstrument

            canInstrument?: boolean;

              property createTransformer

              createTransformer?: (options?: OptionType) => AsyncTransformer<OptionType>;

                property getCacheKey

                getCacheKey?: (
                sourceText: string,
                sourcePath: Config.Path,
                options: TransformOptions<OptionType>
                ) => string;

                  property getCacheKeyAsync

                  getCacheKeyAsync?: (
                  sourceText: string,
                  sourcePath: Config.Path,
                  options: TransformOptions<OptionType>
                  ) => Promise<string>;

                    property process

                    process?: (
                    sourceText: string,
                    sourcePath: Config.Path,
                    options: TransformOptions<OptionType>
                    ) => TransformedSource;

                      property processAsync

                      processAsync: (
                      sourceText: string,
                      sourcePath: Config.Path,
                      options: TransformOptions<OptionType>
                      ) => Promise<TransformedSource>;

                        interface CallerTransformOptions

                        interface CallerTransformOptions {}

                          property supportsDynamicImport

                          supportsDynamicImport: boolean;

                            property supportsExportNamespaceFrom

                            supportsExportNamespaceFrom: boolean;

                              property supportsStaticESM

                              supportsStaticESM: boolean;

                                property supportsTopLevelAwait

                                supportsTopLevelAwait: boolean;

                                  interface ShouldInstrumentOptions

                                  interface ShouldInstrumentOptions
                                  extends Pick<
                                  Config.GlobalConfig,
                                  | 'collectCoverage'
                                  | 'collectCoverageFrom'
                                  | 'collectCoverageOnlyFrom'
                                  | 'coverageProvider'
                                  > {}

                                    property changedFiles

                                    changedFiles?: Set<Config.Path>;

                                      property sourcesRelatedToTestsInChangedFiles

                                      sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;

                                        interface SyncTransformer

                                        interface SyncTransformer<OptionType = unknown> {}

                                          property canInstrument

                                          canInstrument?: boolean;

                                            property createTransformer

                                            createTransformer?: (options?: OptionType) => SyncTransformer<OptionType>;

                                              property getCacheKey

                                              getCacheKey?: (
                                              sourceText: string,
                                              sourcePath: Config.Path,
                                              options: TransformOptions<OptionType>
                                              ) => string;

                                                property getCacheKeyAsync

                                                getCacheKeyAsync?: (
                                                sourceText: string,
                                                sourcePath: Config.Path,
                                                options: TransformOptions<OptionType>
                                                ) => Promise<string>;

                                                  property process

                                                  process: (
                                                  sourceText: string,
                                                  sourcePath: Config.Path,
                                                  options: TransformOptions<OptionType>
                                                  ) => TransformedSource;

                                                    property processAsync

                                                    processAsync?: (
                                                    sourceText: string,
                                                    sourcePath: Config.Path,
                                                    options: TransformOptions<OptionType>
                                                    ) => Promise<TransformedSource>;

                                                      interface TransformationOptions

                                                      interface Options extends ShouldInstrumentOptions, CallerTransformOptions {}

                                                        property isInternalModule

                                                        isInternalModule?: boolean;

                                                          interface TransformOptions

                                                          interface TransformOptions<OptionType = unknown> extends ReducedTransformOptions {}

                                                            property cacheFS

                                                            cacheFS: StringMap;
                                                            • a cached file system which is used in jest-runtime - useful to improve performance

                                                            property config

                                                            config: Config.ProjectConfig;

                                                              property configString

                                                              configString: string;
                                                              • A stringified version of the configuration - useful in cache busting

                                                              property transformerConfig

                                                              transformerConfig: OptionType;
                                                              • the options passed through Jest's config by the user

                                                              Type Aliases

                                                              type ScriptTransformer

                                                              type TransformerType = ScriptTransformer;

                                                                type TransformedSource

                                                                type TransformedSource =
                                                                | {
                                                                code: string;
                                                                map?: FixedRawSourceMap | string | null;
                                                                }
                                                                | string;

                                                                  type Transformer

                                                                  type Transformer<OptionType = unknown> =
                                                                  | SyncTransformer<OptionType>
                                                                  | AsyncTransformer<OptionType>;

                                                                    type TransformResult

                                                                    type TransformResult = TransformTypes.TransformResult;

                                                                      Package Files (5)

                                                                      Dependencies (15)

                                                                      Dev Dependencies (9)

                                                                      Peer Dependencies (0)

                                                                      No peer dependencies.

                                                                      Badge

                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@jest/transform.

                                                                      • Markdown
                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@jest/transform)
                                                                      • HTML
                                                                        <a href="https://www.jsdocs.io/package/@jest/transform"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>