UNPKG

@serenity-js/core

Version:

The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure

47 lines 1.53 kB
import { Version } from '../Version'; /** * Dynamically loads Node modules located relative to `cwd`. */ export declare class ModuleLoader { readonly cwd: string; readonly useRequireCache: boolean; /** * @param {string} cwd * Current working directory, relative to which Node modules should be resolved. * @param useRequireCache * Whether to use Node's `require.cache`. Defaults to `true`. * Set to `false` to force Node to reload required modules on every call. */ constructor(cwd: string, useRequireCache?: boolean); /** * Returns `true` if a given module is available to be required, false otherwise. * * @param moduleId * NPM module id, for example 'cucumber' or '@serenity-js/core' */ hasAvailable(moduleId: string): boolean; /** * Works like `require.resolve`, but relative to specified current working directory * * @param moduleId * NPM module id, for example `cucumber` or `@serenity-js/core` * * @returns * Path to a given Node.js module */ resolve(moduleId: string): string; /** * Works like `require`, but relative to specified current working directory * * @param moduleId */ require(moduleId: string): any; private cachedIfNeeded; /** * Returns `Version` of module specified by `moduleId`, based on its `package.json`. * * @param moduleId */ versionOf(moduleId: string): Version; } //# sourceMappingURL=ModuleLoader.d.ts.map