Skip to content

Commit

Permalink
ci: create script to run testing coverages
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlemoos committed Mar 18, 2024
1 parent 015d6e3 commit e849b8e
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests 🧪

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Run tests
run: bun run test:coverage

- name: Publish coverage
uses: romeovs/[email protected]
with:
lcov-file: ./coverage/lcov.info
Binary file modified bun.lockb
Binary file not shown.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@types/bun": "latest",
"@types/react": "^18",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-v8": "^1.4.0",
"drizzle-kit": "^0.20.14",
"jsdom": "^24.0.0",
"react-docgen-typescript": "^2.2.2",
Expand All @@ -22,15 +23,16 @@
},
"scripts": {
"dev": "( cd apps/www && bun run dev )",
"workspace:sync": "rm -rf bun.lockb node_modules && bun install",
"workspace:sync": "rimraf -rf bun.lockb node_modules && bun install",
"lint": "bun x @biomejs/biome lint ./{packages,apps}/*",
"format": "bun x @biomejs/biome format ./{packages,apps}/* --write",
"clean:node_modules": "rm -rf ./node_modules bun.lockb",
"clean:node_modules": "rimraf -rf ./node_modules bun.lockb",
"storybook": "( cd apps/storybook && bun run storybook )",
"storybook:debug": "( cd apps/storybook && bun run storybook:debug )",
"sb": "( cd apps/storybook && bun run storybook )",
"sb:debug": "( cd apps/storybook && bun run storybook:debug )",
"test": "vitest --config vitest.config.ts",
"test:coverage": "rimraf -rf ./coverage && vitest --config vitest.coverage.config.ts --coverage",
"docker:up": "docker compose -f .docker/docker-compose.yaml up -d",
"docker:down": "docker compose -f ./.docker/docker-compose.yaml down",
"db:studio": "( cd packages/drizzle && bun run db:studio )",
Expand Down
28 changes: 28 additions & 0 deletions vitest.coverage.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/// <reference types="vitest" />
/// <reference types="vitest/globals" />
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
globals: true,
include: ['**/*.{test,spec}.?(c|m)ts?(x)'],
environment: 'jsdom',
setupFiles: ['./_/env/vitest-setup.ts'],
coverage: {
provider: 'v8',
reporter: ['lcov'],
},
},
plugins: [react(), tsconfigPaths()],
ssr: {
target: 'node',
},
define: {
'import.meta.vitest': undefined,
},
css: {
postcss: require('./postcss.config.cjs'),
},
})

0 comments on commit e849b8e

Please sign in to comment.