11/**
2- * Test helpers to temporarily override OB_CLI_PATH ( and related keys)
3- * and ensure the environment and cli-runner internal state are restored.
2+ * Test helpers to temporarily override OB_CLI_PATH and ensure the
3+ * environment and cli-runner internal state are restored.
44 */
5- export type EnvSnapshot = { OB_CLI_PATH ?: string ; SB_CLI_PATH ?: string } ;
5+ export type EnvSnapshot = { OB_CLI_PATH ?: string } ;
66
77/**
88 * Synchronously set OB_CLI_PATH and attempt to update cli-runner internal state.
99 * Returns a restore function that will reset environment and cli-runner state.
1010 */
1111export function setObCliPath ( path ?: string ) : ( ) => void {
12- const prev : EnvSnapshot = { OB_CLI_PATH : process . env . OB_CLI_PATH , SB_CLI_PATH : process . env . SB_CLI_PATH } ;
12+ const prev : EnvSnapshot = { OB_CLI_PATH : process . env . OB_CLI_PATH } ;
1313
1414 if ( path === undefined ) delete process . env . OB_CLI_PATH ;
1515 else process . env . OB_CLI_PATH = String ( path ) ;
@@ -36,7 +36,6 @@ export function setObCliPath(path?: string): () => void {
3636 return ( ) => {
3737 // restore environment
3838 if ( prev . OB_CLI_PATH === undefined ) delete process . env . OB_CLI_PATH ; else process . env . OB_CLI_PATH = prev . OB_CLI_PATH ;
39- if ( prev . SB_CLI_PATH === undefined ) delete process . env . SB_CLI_PATH ; else process . env . SB_CLI_PATH = prev . SB_CLI_PATH ;
4039
4140 // Attempt to restore cli-runner internal state (best-effort)
4241 ( async ( ) => {
@@ -58,7 +57,7 @@ export function setObCliPath(path?: string): () => void {
5857 * and restores environment and cli-runner internal state afterwards.
5958 */
6059export async function withObCliPath < T > ( path : string | undefined , fn : ( ) => Promise < T > | T ) : Promise < T > {
61- const prev : EnvSnapshot = { OB_CLI_PATH : process . env . OB_CLI_PATH , SB_CLI_PATH : process . env . SB_CLI_PATH } ;
60+ const prev : EnvSnapshot = { OB_CLI_PATH : process . env . OB_CLI_PATH } ;
6261
6362 // Set env
6463 if ( path === undefined ) delete process . env . OB_CLI_PATH ;
@@ -101,7 +100,6 @@ export async function withObCliPath<T>(path: string | undefined, fn: () => Promi
101100
102101 // Restore env
103102 if ( prev . OB_CLI_PATH === undefined ) delete process . env . OB_CLI_PATH ; else process . env . OB_CLI_PATH = prev . OB_CLI_PATH ;
104- if ( prev . SB_CLI_PATH === undefined ) delete process . env . SB_CLI_PATH ; else process . env . SB_CLI_PATH = prev . SB_CLI_PATH ;
105103 }
106104}
107105
0 commit comments