Skip to content
Merged
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
7 changes: 5 additions & 2 deletions packages/script/src/validate-env.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import type { ConsolaInstance } from 'consola'
import type { RegistryScript } from './runtime/types'

interface WarnLogger {
warn: (message: string) => void
}

const UPPER_RE = /([A-Z])/g
const toScreamingSnake = (s: string) => s.replace(UPPER_RE, '_$1').toUpperCase()

Expand Down Expand Up @@ -39,7 +42,7 @@ function levenshtein(a: string, b: string): number {
export function validateScriptsEnvVars(
scripts: RegistryScript[],
enabledRegistryKeys: Set<string>,
logger: ConsolaInstance,
logger: WarnLogger,
globalsKeys: string[] = [],
): void {
// Configured `scripts.globals` keys — env vars NUXT_PUBLIC_SCRIPTS_GLOBALS_<KEY>_*
Expand Down
3 changes: 1 addition & 2 deletions test/unit/validate-env.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { ConsolaInstance } from 'consola'
import type { RegistryScript } from '../../packages/script/src/runtime/types'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { validateScriptsEnvVars } from '../../packages/script/src/validate-env'
Expand All @@ -10,7 +9,7 @@ const scripts = [
] as unknown as RegistryScript[]

function makeLogger() {
return { warn: vi.fn() } as unknown as ConsolaInstance
return { warn: vi.fn() }
}

describe('validateScriptsEnvVars', () => {
Expand Down
Loading