Skip to content

Commit bc318bd

Browse files
committed
stub nuxt modules
1 parent 9063d55 commit bc318bd

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.storybook/preview.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
import type { Preview } from '@nuxtjs/storybook'
2+
import { currentLocales } from '../config/i18n'
3+
import { fn } from 'storybook/test'
4+
import { ACCENT_COLORS } from '../shared/utils/constants'
5+
6+
// related: https://github.com/npmx-dev/npmx.dev/blob/1431d24be555bca5e1ae6264434d49ca15173c43/test/nuxt/setup.ts#L12-L26
7+
// Stub Nuxt specific globals
8+
// @ts-expect-error - dynamic global name
9+
globalThis['__NUXT_COLOR_MODE__'] ??= {
10+
preference: 'system',
11+
value: 'dark',
12+
getColorScheme: fn(() => 'dark'),
13+
addColorScheme: fn(),
14+
removeColorScheme: fn(),
15+
}
16+
// @ts-expect-error - dynamic global name
17+
globalThis.defineOgImageComponent = fn()
218

319
const preview: Preview = {
420
parameters: {

0 commit comments

Comments
 (0)