Skip to content

Commit

Permalink
Move vitest to root
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpeulen committed Aug 9, 2024
1 parent 47ed6f3 commit 04d4750
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: pnpm exec playwright install chromium --with-deps

- name: Run vitest
run: pnpm run test
run: pnpm run test run --coverage

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
Expand Down
32 changes: 0 additions & 32 deletions .storybook/test-runner.ts

This file was deleted.

10 changes: 10 additions & 0 deletions .storybook/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { beforeAll } from 'vitest'
import { setProjectAnnotations } from '@storybook/nextjs'
import * as rscAnnotations from '@storybook/react/dist/entry-preview-rsc.mjs'
import * as projectAnnotations from './preview'
// promise with resolveres polyfill
import '@ungap/with-resolvers'

const annotations = setProjectAnnotations([projectAnnotations, rscAnnotations])

beforeAll(annotations.beforeAll!)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"scripts": {
"build": "next build",
"dev": "next dev",
"test": "vitest --config .storybook-vite/vitest.config.mts",
"test": "vitest",
"lint": "next lint",
"start": "next start",
"prisma:setup": "dotenv -e .env.local prisma migrate dev && pnpm run generate-dmmf",
Expand Down
7 changes: 2 additions & 5 deletions .storybook-vite/vitest.config.mts → vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import path from 'node:path'
import { storybookTest } from '@storybook/experimental-addon-vitest/plugin'
import vitePluginNext from 'vite-plugin-storybook-nextjs'
import { defineConfig } from 'vitest/config'

const __dirname = import.meta.dirname

export default defineConfig({
plugins: [
vitePluginNext({ dir: path.join(__dirname, '..') }),
vitePluginNext(),
storybookTest({
storybookScript: 'pnpm run storybook --ci',
}),
Expand All @@ -23,6 +20,6 @@ export default defineConfig({
headless: true,
screenshotFailures: false,
},
setupFiles: ['./.storybook-vite/storybook.setup.ts'],
setupFiles: ['./.storybook/vitest.setup.ts'],
},
})

0 comments on commit 04d4750

Please sign in to comment.