jest-resolve
- Version 30.5.1
- Published
- 77.5 kB
- 7 dependencies
- MIT license
Install
npm i jest-resolveyarn add jest-resolvepnpm add jest-resolveOverview
Overview not available.
Index
Functions
Classes
Resolver
- canResolveSync()
- clearDefaultResolverCache()
- findNodeModule()
- findNodeModuleAsync()
- getGlobalPaths()
- getMockModule()
- getMockModuleAsync()
- getModule()
- getModuleID()
- getModuleIDAsync()
- getModulePath()
- getModulePaths()
- getPackage()
- hasDistinctAsyncResolver()
- isCoreModule()
- ModuleNotFoundError
- normalizeCoreModuleSpecifier()
- resolveModule()
- resolveModuleAsync()
- resolveModuleFromDirIfExists()
- resolveModuleFromDirIfExistsAsync()
- resolveStubModuleName()
- resolveStubModuleNameAsync()
- tryCastModuleNotFoundError()
- unstable_isExplicitlyCommonjs
- unstable_shouldLoadAsEsm
Interfaces
Type Aliases
Functions
function cachedShouldLoadAsEsm
cachedShouldLoadAsEsm: ( path: string, extensionsToTreatAsEsm: Array<string>) => boolean;function isExplicitlyCommonjsPackage
isExplicitlyCommonjsPackage: (modulePath: string) => boolean;function preloadResolver
preloadResolver: (resolver: string | undefined | null) => Promise<void>;Load a user resolver so that later synchronous resolution can use it. Called from
normalizein the main process and from the test worker'ssetup, both of which run before any module is resolved.
function resolveRunner
resolveRunner: ( resolver: string | undefined | null, { filePath, rootDir, requireResolveFunction, }: { filePath: string; rootDir: string; requireResolveFunction: (moduleName: string) => string; }) => string;Finds the runner to use:
1. looks for jest-runner- relative to project. 1. looks for jest-runner- relative to Jest. 1. looks for relative to project. 1. looks for relative to Jest.
function resolveSequencer
resolveSequencer: ( resolver: string | undefined | null, { filePath, rootDir, requireResolveFunction, }: { filePath: string; rootDir: string; requireResolveFunction: (moduleName: string) => string; }) => string;function resolveTestEnvironment
resolveTestEnvironment: ({ rootDir, testEnvironment: filePath, requireResolveFunction,}: { rootDir: string; testEnvironment: string; requireResolveFunction: (moduleName: string) => string;}) => string;Finds the test environment to use:
1. looks for jest-environment- relative to project. 1. looks for jest-environment- relative to Jest. 1. looks for relative to project. 1. looks for relative to Jest.
function resolveWatchPlugin
resolveWatchPlugin: ( resolver: string | undefined | null, { filePath, rootDir, requireResolveFunction, }: { filePath: string; rootDir: string; requireResolveFunction: (moduleName: string) => string; }) => string;Finds the watch plugins to use:
1. looks for jest-watch- relative to project. 1. looks for jest-watch- relative to Jest. 1. looks for relative to project. 1. looks for relative to Jest.
Classes
class Resolver
class Resolver {}constructor
constructor(moduleMap: IModuleMap, options: ResolverConfig);property ModuleNotFoundError
static ModuleNotFoundError: typeof ModuleNotFoundError;property unstable_isExplicitlyCommonjs
static unstable_isExplicitlyCommonjs: (modulePath: string) => boolean;property unstable_shouldLoadAsEsm
static unstable_shouldLoadAsEsm: ( path: string, extensionsToTreatAsEsm: string[]) => boolean;method canResolveSync
canResolveSync: () => boolean;method clearDefaultResolverCache
static clearDefaultResolverCache: () => void;method findNodeModule
static findNodeModule: ( path: string, options: FindNodeModuleConfig) => string | null;method findNodeModuleAsync
static findNodeModuleAsync: ( path: string, options: FindNodeModuleConfig) => Promise<string | null>;method getGlobalPaths
getGlobalPaths: (moduleName?: string) => Array<string>;method getMockModule
getMockModule: ( from: string, name: string, options?: Pick<ResolveModuleConfig, 'conditions'>) => string | null;method getMockModuleAsync
getMockModuleAsync: ( from: string, name: string, options: Pick<ResolveModuleConfig, 'conditions'>) => Promise<string | null>;method getModule
getModule: (name: string) => string | null;method getModuleID
getModuleID: ( virtualMocks: Map<string, boolean>, from: string, moduleName: string | undefined, options: ResolveModuleConfig) => string;method getModuleIDAsync
getModuleIDAsync: ( virtualMocks: Map<string, boolean>, from: string, moduleName: string | undefined, options: ResolveModuleConfig) => Promise<string>;method getModulePath
getModulePath: (from: string, moduleName: string) => string;method getModulePaths
getModulePaths: (from: string) => Array<string>;method getPackage
getPackage: (name: string) => string | null;method hasDistinctAsyncResolver
hasDistinctAsyncResolver: () => boolean;method isCoreModule
isCoreModule: (moduleName: string) => boolean;method normalizeCoreModuleSpecifier
normalizeCoreModuleSpecifier: (specifier: string) => string;method resolveModule
resolveModule: ( from: string, moduleName: string, options?: ResolveModuleConfig) => string;method resolveModuleAsync
resolveModuleAsync: ( from: string, moduleName: string, options?: ResolveModuleConfig) => Promise<string>;method resolveModuleFromDirIfExists
resolveModuleFromDirIfExists: ( dirname: string, moduleName: string, options?: ResolveModuleConfig) => string | null;method resolveModuleFromDirIfExistsAsync
resolveModuleFromDirIfExistsAsync: ( dirname: string, moduleName: string, options?: ResolveModuleConfig) => Promise<string | null>;method resolveStubModuleName
resolveStubModuleName: ( from: string, moduleName: string, options?: Pick<ResolveModuleConfig, 'conditions'>) => string | null;method resolveStubModuleNameAsync
resolveStubModuleNameAsync: ( from: string, moduleName: string, options?: Pick<ResolveModuleConfig, 'conditions'>) => Promise<string | null>;method tryCastModuleNotFoundError
static tryCastModuleNotFoundError: ( error: unknown) => ModuleNotFoundError | null;Interfaces
interface ResolverOptions
interface ResolverOptions extends Omit<NapiResolveOptions, 'extensions'> {}property basedir
basedir: string;Directory to begin resolving from.
property conditions
conditions?: ReadonlyArray<string>;List of export conditions.
property defaultAsyncResolver
defaultAsyncResolver: AsyncResolver;Instance of default async resolver.
property defaultResolver
defaultResolver: SyncResolver;Instance of default resolver.
property extensions
extensions?: ReadonlyArray<string>;List of file extensions to be considered when resolving.
property moduleDirectory
moduleDirectory?: ReadonlyArray<string>;List of directory names to be looked up for modules recursively.
property paths
paths?: ReadonlyArray<string>;List of
require.pathsto use if nothing is found innode_modules.
property rootDir
rootDir?: string;Current root directory.
Type Aliases
type AsyncResolver
type AsyncResolver = (path: string, options: ResolverOptions) => Promise<string>;type FindNodeModuleConfig
type FindNodeModuleConfig = { basedir: string; conditions?: ReadonlyArray<string>; extensions?: ReadonlyArray<string>; moduleDirectory?: ReadonlyArray<string>; paths?: ReadonlyArray<string>; resolver?: string | null; rootDir?: string; throwIfNotFound?: boolean;};type JestResolver
type JestResolver = ResolverSyncObject | ResolverAsyncObject;type PackageJSON
type PackageJSON = JSONObject;type ResolveModuleConfig
type ResolveModuleConfig = { conditions?: ReadonlyArray<string>; skipNodeResolution?: boolean; paths?: ReadonlyArray<string>;};type SyncResolver
type SyncResolver = (path: string, options: ResolverOptions) => string;Package Files (1)
Dependencies (7)
Dev Dependencies (2)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto 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-resolve.
- Markdown[](https://www.jsdocs.io/package/jest-resolve)
- HTML<a href="https://www.jsdocs.io/package/jest-resolve"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2568 ms. - Missing or incorrect documentation? Open an issue for this package.
