diff --git a/src/register.ts b/src/register.ts index 929b7a0..59af42f 100644 --- a/src/register.ts +++ b/src/register.ts @@ -45,15 +45,22 @@ function getCoreModules( return coreModules; } +export interface RegisterParams extends ExplicitParams { + /** + * Defaults to `--project` CLI flag or `process.cwd()` + */ + cwd?: string; +} + /** * Installs a custom module load function that can adhere to paths in tsconfig. * Returns a function to undo paths registration. */ -export function register(explicitParams: ExplicitParams): () => void { - const configLoaderResult = configLoader({ - cwd: options.cwd, - explicitParams, - }); +export function register({ + cwd = options.cwd, + ...explicitParams +}: RegisterParams): () => void { + const configLoaderResult = configLoader({ cwd, explicitParams }); if (configLoaderResult.resultType === "failed") { console.warn(