From a1ffdd39143dd7962a454818ca1656e3473cb7d6 Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Fri, 8 Apr 2022 20:30:46 -0400 Subject: [PATCH] feat(register): add `cwd` param --- src/register.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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, });