Skip to content

Commit

Permalink
feat(plugin-coverage): set up plugin-coverage package
Browse files Browse the repository at this point in the history
  • Loading branch information
Tlacenka committed Feb 5, 2024
1 parent 1fb06a4 commit 8b18a0f
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/plugin-coverage/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"parserOptions": {
"project": ["packages/plugin-coverage/tsconfig.*?.json"]
}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": ["error"]
}
}
]
}
10 changes: 10 additions & 0 deletions packages/plugin-coverage/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@code-pushup/coverage-plugin",
"version": "0.8.25",
"dependencies": {
"@code-pushup/models": "*",
"@code-pushup/utils": "*",
"parse-lcov": "^1.0.4",
"zod": "^3.22.4"
}
}
55 changes: 55 additions & 0 deletions packages/plugin-coverage/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "plugin-coverage",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/plugin-coverage/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/esbuild:esbuild",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/plugin-coverage",
"main": "packages/plugin-coverage/src/index.ts",
"tsConfig": "packages/plugin-coverage/tsconfig.lib.json",
"assets": ["packages/plugin-coverage/*.md"],
"esbuildConfig": "esbuild.config.js"
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/plugin-coverage/**/*.ts",
"packages/plugin-coverage/package.json"
]
}
},
"unit-test": {
"executor": "@nx/vite:test",
"outputs": ["{workspaceRoot}/coverage/packages/plugin-coverage"],
"options": {
"config": "packages/plugin-coverage/vite.config.unit.ts",
"reportsDirectory": "../../coverage/plugin-coverage/unit-tests"
}
},
"integration-test": {
"executor": "@nx/vite:test",
"outputs": ["{workspaceRoot}/coverage/packages/plugin-coverage"],
"options": {
"config": "packages/plugin-coverage/vite.config.integration.ts",
"reportsDirectory": "../../coverage/plugin-coverage/integration-tests"
}
},
"deploy": {
"options": {
"distFolderPath": "dist/packages/plugin-coverage"
}
},
"publish": {
"command": "node tools/scripts/publish.mjs plugin-coverage {args.ver} {args.tag}",
"dependsOn": ["build"]
}
},
"tags": ["scope:plugin", "type:feature"]
}
23 changes: 23 additions & 0 deletions packages/plugin-coverage/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "ESNext",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"types": ["vitest"]
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.test.json"
}
]
}
16 changes: 16 additions & 0 deletions packages/plugin-coverage/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": [
"vite.config.unit.ts",
"vite.config.integration.ts",
"src/**/*.test.ts",
"src/**/*.mock.ts",
"mocks/**/*.ts"
]
}
13 changes: 13 additions & 0 deletions packages/plugin-coverage/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node"]
},
"include": [
"vite.config.unit.ts",
"vite.config.integration.ts",
"mocks/**/*.ts",
"src/**/*.test.ts"
]
}
21 changes: 21 additions & 0 deletions packages/plugin-coverage/vite.config.integration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/// <reference types="vitest" />
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { defineConfig } from 'vite';

export default defineConfig({
cacheDir: '../../node_modules/.vite/plugin-coverage',
plugins: [nxViteTsPaths()],
test: {
globals: true,
cache: {
dir: '../../node_modules/.vitest',
},
environment: 'node',
include: ['src/**/*.integration.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
globalSetup: ['global-setup.ts'],
setupFiles: [
'../../testing-utils/src/lib/setup/console.mock.ts',
'../../testing-utils/src/lib/setup/reset.mocks.ts',
],
},
});
25 changes: 25 additions & 0 deletions packages/plugin-coverage/vite.config.unit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/// <reference types="vitest" />
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { defineConfig } from 'vite';

export default defineConfig({
cacheDir: '../../node_modules/.vite/plugin-coverage',
plugins: [nxViteTsPaths()],
test: {
globals: true,
cache: {
dir: '../../node_modules/.vitest',
},
coverage: {
reporter: ['lcov'],
},
environment: 'node',
include: ['src/**/*.unit.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
globalSetup: ['global-setup.ts'],
setupFiles: [
'../../testing-utils/src/lib/setup/fs.mock.ts',
'../../testing-utils/src/lib/setup/console.mock.ts',
'../../testing-utils/src/lib/setup/reset.mocks.ts',
],
},
});
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@code-pushup/lighthouse-plugin": [
"packages/plugin-lighthouse/src/index.ts"
],
"@code-pushup/coverage-plugin": ["packages/plugin-coverage/src/index.ts"],
"@code-pushup/models": ["packages/models/src/index.ts"],
"@code-pushup/nx-plugin": ["packages/nx-plugin/src/index.ts"],
"@code-pushup/testing-utils": ["testing-utils/src/index.ts"],
Expand Down

0 comments on commit 8b18a0f

Please sign in to comment.