Skip to content

@i18n-micro/test-utils

50 exports across 2 entry points. Generated from the API snapshot that pnpm run api:surface checks against the TypeScript sources.

@i18n-micro/test-utils

ts
import { /* … */ } from '@i18n-micro/test-utils'
ExportKindSignature
_tfunction(route: unknown) => (key: TranslationKey, params?: Params, defaultValue?: string | null) => Translation
_tsfunction(route: unknown) => (key: TranslationKey, params?: Params, defaultValue?: string | null) => string
createFakeI18nfunction(options?: CreateFakeI18nOptions) => { $i18nStrategy: { localizePath(path: string, loc?: string): string; }; $getI18nConfig: () => { locales: Locale[]; defaultLocale: string | undefined; strategy: "prefix"; }; $getLocale: (_route?: unknown) => string; $setLocale: (val: string) => void; $getLocaleName: () => string | null; $setLocaleName: (val: string | null) => void; $getLocales: () => Locale[]; $setLocales: (val: Locale[]) => void; $defaultLocale: () => string | undefined; $setDefaultLocale: (val: string | undefined) => void; $getRouteName: (_route?: unknown, _locale?: string) => string; $settRouteName: (val: string) => void; $setRouteName: (val: string) => void; $t: (key: TranslationKey, params?: Params, defaultValue?: string | null) => Translation; $_t: (route: unknown) => (key: TranslationKey, params?: Params, defaultValue?: string | null) => Translation; $ts: (key: TranslationKey, params?: Params, defaultValue?: string | null) => string; $_ts: (route: unknown) => (key: TranslationKey, params?: Params, defaultValue?: string | null) => string; $tc: (key: TranslationKey, params: number | Params, defaultValue?: string) => string; $tn: (value: number, options?: Intl.NumberFormatOptions) => string; $td: (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string; $tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string; $has: (key: TranslationKey) => boolean; $resolveTranslations: () => Record<string, unknown>; $setTranslation: (key: TranslationKey, value: unknown) => void; $mergeTranslations: (newTranslations: Translations) => void; $switchLocaleRoute: (loc: string) => { path: string; name: string; }; $switchLocalePath: (loc: string) => string; $switchLocale: (val: string) => void; $switchRoute: (route: unknown, toLocale?: string) => void; $localeRoute: (to: unknown, loc?: string) => { name?: string | symbol | undefined; path: string; }; $localePath: (to: unknown, loc?: string) => string; $setI18nRouteParams: (value: unknown) => unknown; $loadPageTranslations: (loc: string, page: string, translations: Translations) => Promise<void>; $setMissingHandler: (handler: MissingHandler | null) => void; $setTranslationsFromJson: (loc: string, translations: Record<string, unknown>) => Promise<void>; }
CreateFakeI18nOptionsinterface1 members
defaultLocaleconst() => string | undefined
getI18nConfigfunction() => { locales: Locale[]; defaultLocale: string | undefined; strategy: "prefix"; }
getLocaleconst(_route?: unknown) => string
getLocaleNameconst() => string | null
getLocalesconst() => Locale[]
getRouteNameconst(_route?: unknown, _locale?: string) => string
Gettertype(key: TranslationKey, params?: Record<string, string | number | boolean>, defaultValue?: string) => unknown
hasconst(key: TranslationKey) => boolean
i18nStrategyconst{ localizePath(path: string, loc?: string): string; }
i18nUtilsconst{ t: (key: TranslationKey, params?: Params, defaultValue?: string | null) => Translation; tc: (key: TranslationKey, params: number | Params, defaultValue?: string) => string; ts: (key: TranslationKey, params?: Params, defaultValue?: string | null) => string; tn: (value: number, options?: Intl.NumberFormatOptions) => string; td: (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string; tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string; has: (key: TranslationKey) => boolean; resetI18n: (options?: ResetI18nOptions) => void; createFakeI18n: (options?: CreateFakeI18nOptions) => { $i18nStrategy: { localizePath(path: string, loc?: string): string; }; $getI18nConfig: () => { locales: Locale[]; defaultLocale: string | undefined; strategy: "prefix"; }; $getLocale: (_route?: unknown) => string; $setLocale: (val: string) => void; $getLocaleName: () => string | null; $setLocaleName: (val: string | null) => void; $getLocales: () => Locale[]; $setLocales: (val: Locale[]) => void; $defaultLocale: () => string | undefined; $setDefaultLocale: (val: string | undefined) => void; $getRouteName: (_route?: unknown, _locale?: string) => string; $settRouteName: (val: string) => void; $setRouteName: (val: string) => void; $t: (key: TranslationKey, params?: Params, defaultValue?: string | null) => Translation; $_t: (route: unknown) => (key: TranslationKey, params?: Params, defaultValue?: string | null) => Translation; $ts: (key: TranslationKey, params?: Params, defaultValue?: string | null) => string; $_ts: (route: unknown) => (key: TranslationKey, params?: Params, defaultValue?: string | null) => string; $tc: (key: TranslationKey, params: number | Params, defaultValue?: string) => string; $tn: (value: number, options?: Intl.NumberFormatOptions) => string; $td: (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string; $tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string; $has: (key: TranslationKey) => boolean; $resolveTranslations: () => Record<string, unknown>; $setTranslation: (key: TranslationKey, value: unknown) => void; $mergeTranslations: (newTranslations: Translations) => void; $switchLocaleRoute: (loc: string) => { path: string; name: string; }; $switchLocalePath: (loc: string) => string; $switchLocale: (val: string) => void; $switchRoute: (route: unknown, toLocale?: string) => void; $localeRoute: (to: unknown, loc?: string) => { name?: string | symbol | undefined; path: string; }; $localePath: (to: unknown, loc?: string) => string; $setI18nRouteParams: (value: unknown) => unknown; $loadPageTranslations: (loc: string, page: string, translations: Translations) => Promise<void>; $setMissingHandler: (handler: MissingHandler | null) => void; $setTranslationsFromJson: (loc: string, translations: Record<string, unknown>) => Promise<void>; }; setTranslationsFromJson: (loc: string, translations: Record<string, unknown>) => Promise<void>; loadPageTranslations: (loc: string, page: string, translations: Translations) => Promise<void>; setMissingHandler: (handler: MissingHandler | null) => void; getI18nConfig: () => { locales: Locale[]; defaultLocale: string | undefined; strategy: "prefix"; }; i18nStrategy: { localizePath(path: string, loc?: string): string; }; getLocale: (_route?: unknown) => string; setLocale: (val: string) => void; getLocaleName: () => string | null; setLocaleName: (val: string | null) => void; getLocales: () => Locale[]; setLocales: (val: Locale[]) => void; defaultLocale: () => string | undefined; setDefaultLocale: (val: string | undefined) => void; getRouteName: (_route?: unknown, _locale?: string) => string; settRouteName: (val: string) => void; setRouteName: (val: string) => void; _t: (route: unknown) => (key: TranslationKey, params?: Params, defaultValue?: string | null) => Translation; _ts: (route: unknown) => (key: TranslationKey, params?: Params, defaultValue?: string | null) => string; mergeTranslations: (newTranslations: Translations) => void; resolveTranslations: () => Record<string, unknown>; setTranslation: (key: TranslationKey, value: unknown) => void; switchLocaleRoute: (loc: string) => { path: string; name: string; }; switchLocalePath: (loc: string) => string; switchLocale: (val: string) => void; switchRoute: (route: unknown, toLocale?: string) => void; localeRoute: (to: unknown, loc?: string) => { name?: string | symbol | undefined; path: string; }; localePath: (to: unknown, loc?: string) => string; setI18nRouteParams: (value: unknown) => unknown; }
loadPageTranslationsfunction(loc: string, page: string, translations: Translations) => Promise<void>
Localeinterface7 members
localePathfunction(to: unknown, loc?: string) => string
localeRoutefunction(to: unknown, loc?: string) => { name?: string | symbol | undefined; path: string; }
mergeTranslationsconst(newTranslations: Translations) => void
resetI18nfunction(options?: ResetI18nOptions) => void
ResetI18nOptionsinterface5 members
resolveTranslationsconst() => Record<string, unknown>
setDefaultLocaleconst(val: string | undefined) => void
setI18nRouteParamsfunction(value: unknown) => unknown
setLocaleconst(val: string) => void
setLocaleNameconst(val: string | null) => void
setLocalesconst(val: Locale[]) => void
setMissingHandlerfunction(handler: MissingHandler | null) => void
setRouteNameconst(val: string) => void
setTranslationconst(key: TranslationKey, value: unknown) => void
setTranslationsFromJsonfunction(loc: string, translations: Record<string, unknown>) => Promise<void>
settRouteNameconst(val: string) => void
SpyFntype<T>(fn: T) => T
switchLocalefunction(val: string) => void
switchLocalePathfunction(loc: string) => string
switchLocaleRoutefunction(loc: string) => { path: string; name: string; }
switchRoutefunction(route: unknown, toLocale?: string) => void
tfunction(key: TranslationKey, params?: Params, defaultValue?: string | null) => Translation
tcfunction(key: TranslationKey, params: number | Params, defaultValue?: string) => string
tdconst(value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string
tdrfunction(value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string
tnconst(value: number, options?: Intl.NumberFormatOptions) => string
tsconst(key: TranslationKey, params?: Params, defaultValue?: string | null) => string
CreateFakeI18nOptions — 1 members
MemberType
spy?SpyFn | undefined
Locale — 7 members
MemberType
baseDefault?boolean | undefined
baseUrl?string | undefined
codestring
dir?"ltr" | "rtl" | "auto" | undefined
disabled?boolean | undefined
displayName?string | undefined
iso?string | undefined
ResetI18nOptions — 5 members
MemberType
defaultLocale?string | undefined
locale?string | undefined
localeName?string | null | undefined
locales?Locale[] | undefined
routeName?string | undefined
## `@i18n-micro/test-utils/publish-smoke`
ts
import { /* … */ } from '@i18n-micro/test-utils/publish-smoke'
ExportKindSignature
ExportTargetinterface3 members
getLoadedModulefunction(mods: Record<string, Record<string, unknown>>, key: string) => Record<string, unknown>
loadResolvedExportfunction(item: ResolvedExport, packageRequire: NodeRequire) => Promise<Record<string, unknown>>
packageRootFromImportMetafunction(importMetaUrl: string, levelsUp?: number) => string
PublishFormattype'esm' | 'cjs'
resolveExportTargetsfunction(pkg: { exports?: unknown; }, targets: ExportTarget[], packageRoot: string) => ResolvedExport[]
smokeLoadExportsfunction(packageRoot: string, pkg: { exports?: unknown; }, targets: ExportTarget[]) => Promise<Record<string, Record<string, unknown>>>
ExportTarget — 3 members
MemberType
condition?"import" | "require" | "default" | undefined
formats?PublishFormat[] | undefined
subpathstring

Back to all packages · Integration guides

Released under the MIT License.