mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-06 16:24:08 -06:00
feat: test-coverage (#4701)
This commit is contained in:
39
.github/workflows/sonarqube.yml
vendored
39
.github/workflows/sonarqube.yml
vendored
@@ -1,11 +1,11 @@
|
||||
name: SonarQube
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# push:
|
||||
# branches:
|
||||
# - main
|
||||
# pull_request:
|
||||
# types: [opened, synchronize, reopened]
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
@@ -16,6 +16,35 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
|
||||
- name: Setup Node.js 20.x
|
||||
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
|
||||
with:
|
||||
node-version: 20.x
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --config.platform=linux --config.architecture=x64
|
||||
|
||||
- name: create .env
|
||||
run: cp .env.example .env
|
||||
|
||||
- name: Generate Random ENCRYPTION_KEY, CRON_SECRET & NEXTAUTH_SECRET and fill in .env
|
||||
run: |
|
||||
RANDOM_KEY=$(openssl rand -hex 32)
|
||||
sed -i "s/ENCRYPTION_KEY=.*/ENCRYPTION_KEY=${RANDOM_KEY}/" .env
|
||||
sed -i "s/CRON_SECRET=.*/CRON_SECRET=${RANDOM_KEY}/" .env
|
||||
sed -i "s/NEXTAUTH_SECRET=.*/NEXTAUTH_SECRET=${RANDOM_KEY}/" .env
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: |
|
||||
cd apps/web
|
||||
pnpm test:coverage
|
||||
cd ../../
|
||||
# The Vitest coverage config is in your vite.config.mts
|
||||
|
||||
- name: SonarQube Scan
|
||||
uses: SonarSource/sonarqube-scan-action@bfd4e558cda28cda6b5defafb9232d191be8c203
|
||||
env:
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"build:dev": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"test": "dotenv -e ../../.env -- vitest run"
|
||||
"test": "dotenv -e ../../.env -- vitest run",
|
||||
"test:coverage": "dotenv -e ../../.env -- vitest run --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/azure": "1.0.10",
|
||||
@@ -130,6 +131,7 @@
|
||||
"@types/nodemailer": "6.4.17",
|
||||
"@types/papaparse": "5.3.15",
|
||||
"@types/qrcode": "1.5.5",
|
||||
"@vitest/coverage-v8": "2.1.8",
|
||||
"vite": "6.0.9",
|
||||
"vitest": "2.1.8",
|
||||
"vitest-mock-extended": "2.0.2"
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
import tsconfigPaths from "vite-tsconfig-paths";
|
||||
import { defineConfig } from "vitest/config";
|
||||
// vitest.config.ts
|
||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||
import { loadEnv } from 'vite'
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
exclude: ["playwright/**", "node_modules/**"],
|
||||
setupFiles: ["../../packages/lib/vitestSetup.ts"],
|
||||
exclude: ['playwright/**', 'node_modules/**'],
|
||||
setupFiles: ['../../packages/lib/vitestSetup.ts'],
|
||||
env: loadEnv('', process.cwd(), ''),
|
||||
coverage: {
|
||||
provider: 'v8', // Use V8 as the coverage provider
|
||||
reporter: ['text', 'html', 'lcov'], // Generate text summary and HTML reports
|
||||
reportsDirectory: './coverage', // Output coverage reports to the coverage/ directory
|
||||
},
|
||||
},
|
||||
plugins: [tsconfigPaths()],
|
||||
});
|
||||
});
|
||||
3504
pnpm-lock.yaml
generated
3504
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
sonar.projectKey=formbricks_formbricks
|
||||
sonar.organization=formbricks
|
||||
sonar.javascript.lcov.reportPaths=./apps/web/coverage/lcov.info
|
||||
|
||||
# This is the name and version displayed in the SonarCloud UI.
|
||||
#sonar.projectName=formbricks
|
||||
|
||||
Reference in New Issue
Block a user