diff --git a/src/register.ts b/src/register.ts index 929b7a0..1299a64 100644 --- a/src/register.ts +++ b/src/register.ts @@ -45,13 +45,20 @@ 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 { +export function register(explicitParams?: RegisterParams): () => void { const configLoaderResult = configLoader({ - cwd: options.cwd, + cwd: explicitParams?.cwd ?? options.cwd, explicitParams, });