Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cli/bunfig.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
# which is why CI filters those with `find ... ! -name` instead.
preload = [
"../sdk/test/setup-env.ts",
"../test/setup-scm-loader.ts",
"./test/setup-agents-artifact.ts",
]
37 changes: 22 additions & 15 deletions cli/src/__tests__/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,30 @@ function loadCliEnv(): Record<string, string> {

try {
ensureCliEnvDefaults()
// NOTE: Inline require() is used for lazy loading - the env module depends on
// Infisical secrets which may not be available at module load time in test environments
const { env } = require('../../../packages/internal/src/env') as {
env: Record<string, unknown>
}
try {
const { env } = require('../../../packages/internal/src/env') as {
env: Record<string, unknown>
}

cachedEnv = Object.entries(env).reduce<Record<string, string>>(
(acc, [key, value]) => {
if (value !== undefined && value !== null) {
acc[key] = String(value)
}
return acc
},
{},
)
cachedEnv = Object.entries(env).reduce<Record<string, string>>(
(acc, [key, value]) => {
if (value !== undefined && value !== null) {
acc[key] = String(value)
}
return acc
},
{},
)

return cachedEnv
return cachedEnv
} catch {
// Fallback for public mirror where packages/internal is not present
cachedEnv = {
...TEST_CLIENT_ENV_DEFAULTS,
...TEST_SERVER_ENV_DEFAULTS,
}
return cachedEnv
}
} catch (error) {
const message =
error instanceof Error
Expand Down
Loading