Im using bitbucket with bitbucket pipeline where the monorepo contains typescript and typescript react files. Before the scanner and security gate pipes, I have test:
image: node:20
definitions:
caches:
pnpm: $BITBUCKET_CLONE_DIR/.pnpm-store
node: node_modules/**
nextjs: $BITBUCKET_CLONE_DIR/web/.next/cache
yaml-anchors:
- &install-pnpm-script >-
npm i -g pnpm && pnpm ci:prepare
clone:
depth: full # SonarQube Cloud scanner needs the full history to assign issues properly
services:
docker:
memory: 4096
postgres:
image: postgres:16
variables:
POSTGRES_USER: prisma
POSTGRES_PASSWORD: prisma
POSTGRES_DB: tests
steps:
-
- step: &install-pnpm-deps
name: install-dependencies
caches:
- node
- pnpm
script:
- npm i -g pnpm
- pnpm ci:prepare
artifacts:
- node_modules
- .pnpm-store
- step: &lint
name: Lint
caches:
- node
- pnpm
script:
- *install-pnpm-script
- pnpm ci:lint
- step: &test-and-sonar
name: Test and sonar
caches:
- node
- pnpm
script:
- *install-pnpm-script
- pnpm test:core:backend && pnpm test:web
- pipe: sonarsource/sonarcloud-scan:3.0.0
- pipe: sonarsource/sonarcloud-quality-gate:0.1.6
pipelines:
default:
- step: *install-pnpm-deps
- parallel:
- step: *lint
- step: *test-and-sonar
options:
max-time: 30
size: 2x
docker: true
And my sonar-project.properties is:
sonar.exclusions=**/*.sql
sonar.tests=web,core
sonar.sources=web,core
sonar.test.inclusions=**/*.test.ts,**/*.test.tsx
sonar.javascript.lcov.reportPaths=web/coverage/lcov.info,coverage/lcov.info
sonar.cpd.exclusions=**/*.sql,**/*.test.ts,**/*.test.tsx
Upon running test scripts, it generates 2 lcov reports: 1 at the root, and 1 at web/coverage. Upon adding these to reportPaths, it remains not reporting coverage. How to properly do it?