diff --git a/code-pushup.preset.ts b/code-pushup.preset.ts index 15ba02ccc..af7633ea9 100644 --- a/code-pushup.preset.ts +++ b/code-pushup.preset.ts @@ -11,9 +11,8 @@ import eslintPlugin, { eslintConfigFromNxProject, } from './packages/plugin-eslint/src/index.js'; import jsPackagesPlugin from './packages/plugin-js-packages/src/index.js'; -import jsDocsPlugin, { - JsDocsPluginConfig, -} from './packages/plugin-jsdocs/src/index.js'; +import jsDocsPlugin from './packages/plugin-jsdocs/src/index.js'; +import type { JsDocsPluginTransformedConfig } from './packages/plugin-jsdocs/src/lib/config.js'; import { PLUGIN_SLUG, groups, @@ -98,7 +97,7 @@ export const eslintCategories: CategoryConfig[] = [ ]; export function getJsDocsCategories( - config: JsDocsPluginConfig, + config: JsDocsPluginTransformedConfig, ): CategoryConfig[] { return [ { @@ -147,7 +146,7 @@ export const lighthouseCoreConfig = async ( }; export const jsDocsCoreConfig = ( - config: JsDocsPluginConfig | string[], + config: JsDocsPluginTransformedConfig | string[], ): CoreConfig => ({ plugins: [ jsDocsPlugin(Array.isArray(config) ? { patterns: config } : config), @@ -180,28 +179,25 @@ export const typescriptPluginConfig = async ( export const coverageCoreConfigNx = async ( projectName?: string, ): Promise => { - if (projectName) { - throw new Error('coverageCoreConfigNx for single projects not implemented'); - } const targetNames = ['unit-test', 'int-test']; - const targetArgs = [ - '-t', - ...targetNames, - '--coverage.enabled', - '--skipNxCache', - ]; + const targetArgs = ['-t', ...targetNames]; return { plugins: [ await coveragePlugin({ coverageToolCommand: { command: 'npx', - args: [ - 'nx', - projectName ? `run --project ${projectName}` : 'run-many', - ...targetArgs, - ], + args: projectName + ? ['nx', 'run-many', '-p', projectName, ...targetArgs] + : ['nx', 'run-many', ...targetArgs], }, - reports: await getNxCoveragePaths(targetNames), + reports: projectName + ? [ + { + pathToProject: `packages/${projectName}`, + resultsPath: `packages/${projectName}/coverage/lcov.info`, + }, + ] + : await getNxCoveragePaths(targetNames), }), ], categories: coverageCategories, diff --git a/e2e/ci-e2e/project.json b/e2e/ci-e2e/project.json index 29a33f65d..f458d8d9d 100644 --- a/e2e/ci-e2e/project.json +++ b/e2e/ci-e2e/project.json @@ -8,7 +8,7 @@ "e2e": { "executor": "@nx/vite:test", "options": { - "configFile": "e2e/ci-e2e/vitest.e2e.config.ts" + "configFile": "{projectRoot}/vitest.e2e.config.ts" } } }, diff --git a/e2e/cli-e2e/project.json b/e2e/cli-e2e/project.json index ba2f90352..6cdabf9ae 100644 --- a/e2e/cli-e2e/project.json +++ b/e2e/cli-e2e/project.json @@ -8,7 +8,7 @@ "e2e": { "executor": "@nx/vite:test", "options": { - "configFile": "e2e/cli-e2e/vitest.e2e.config.ts" + "configFile": "{projectRoot}/vitest.e2e.config.ts" } } }, diff --git a/e2e/create-cli-e2e/project.json b/e2e/create-cli-e2e/project.json index beeb09874..bf0b88071 100644 --- a/e2e/create-cli-e2e/project.json +++ b/e2e/create-cli-e2e/project.json @@ -9,7 +9,7 @@ "executor": "@nx/vite:test", "options": { "keepServerRunning": true, - "configFile": "e2e/create-cli-e2e/vitest.e2e.config.ts" + "configFile": "{projectRoot}/vitest.e2e.config.ts" } } }, diff --git a/e2e/nx-plugin-e2e/project.json b/e2e/nx-plugin-e2e/project.json index 9c7a190fc..f569a465f 100644 --- a/e2e/nx-plugin-e2e/project.json +++ b/e2e/nx-plugin-e2e/project.json @@ -8,7 +8,7 @@ "e2e": { "executor": "@nx/vite:test", "options": { - "configFile": "e2e/nx-plugin-e2e/vitest.e2e.config.ts" + "configFile": "{projectRoot}/vitest.e2e.config.ts" } } }, diff --git a/e2e/plugin-coverage-e2e/project.json b/e2e/plugin-coverage-e2e/project.json index 7b127aa13..ca5b5b3fd 100644 --- a/e2e/plugin-coverage-e2e/project.json +++ b/e2e/plugin-coverage-e2e/project.json @@ -8,7 +8,7 @@ "e2e": { "executor": "@nx/vite:test", "options": { - "configFile": "e2e/plugin-coverage-e2e/vitest.e2e.config.ts" + "configFile": "{projectRoot}/vitest.e2e.config.ts" } } }, diff --git a/e2e/plugin-eslint-e2e/project.json b/e2e/plugin-eslint-e2e/project.json index 544d6a8ef..c4000be23 100644 --- a/e2e/plugin-eslint-e2e/project.json +++ b/e2e/plugin-eslint-e2e/project.json @@ -8,7 +8,7 @@ "e2e": { "executor": "@nx/vite:test", "options": { - "configFile": "e2e/plugin-eslint-e2e/vitest.e2e.config.ts" + "configFile": "{projectRoot}/vitest.e2e.config.ts" } } }, diff --git a/e2e/plugin-js-packages-e2e/project.json b/e2e/plugin-js-packages-e2e/project.json index 901c92dd4..5c6382c06 100644 --- a/e2e/plugin-js-packages-e2e/project.json +++ b/e2e/plugin-js-packages-e2e/project.json @@ -9,7 +9,7 @@ "e2e": { "executor": "@nx/vite:test", "options": { - "configFile": "e2e/plugin-eslint-e2e/vitest.e2e.config.ts" + "configFile": "{projectRoot}/vitest.e2e.config.ts" } } }, diff --git a/e2e/plugin-lighthouse-e2e/project.json b/e2e/plugin-lighthouse-e2e/project.json index f8f4c9cb4..a29950ee3 100644 --- a/e2e/plugin-lighthouse-e2e/project.json +++ b/e2e/plugin-lighthouse-e2e/project.json @@ -8,7 +8,7 @@ "e2e": { "executor": "@nx/vite:test", "options": { - "configFile": "e2e/plugin-lighthouse-e2e/vitest.e2e.config.ts" + "configFile": "{projectRoot}/vitest.e2e.config.ts" } } }, diff --git a/examples/plugins/project.json b/examples/plugins/project.json index f64b7c7b7..1370e0782 100644 --- a/examples/plugins/project.json +++ b/examples/plugins/project.json @@ -4,39 +4,10 @@ "sourceRoot": "examples/plugins/src", "projectType": "library", "targets": { - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/examples/plugins", - "main": "examples/plugins/src/index.ts", - "tsConfig": "examples/plugins/tsconfig.lib.json", - "assets": ["examples/plugins/*.md"] - } - }, - "lint": { - "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": ["examples/plugins/**/*.ts"] - } - }, - "unit-test": { - "executor": "@nx/vite:test", - "outputs": ["{options.reportsDirectory}"], - "options": { - "configFile": "examples/plugins/vitest.unit.config.ts", - "reportsDirectory": "../../coverage/examples-plugins/unit-tests" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "outputs": ["{options.reportsDirectory}"], - "options": { - "configFile": "examples/plugins/vitest.int.config.ts", - "reportsDirectory": "../../coverage/examples-plugins/int-tests" - } - }, + "build": {}, + "lint": {}, + "unit-test": {}, + "int-test": {}, "run-collect": { "command": "npx dist/packages/cli collect --config=examples/plugins/code-pushup.config.ts --persist.format=md", "dependsOn": [ diff --git a/nx.json b/nx.json index 16fdf3f99..99e48af53 100644 --- a/nx.json +++ b/nx.json @@ -14,6 +14,35 @@ "assets": ["{projectRoot}/*.md"] } }, + "unit-test": { + "cache": true, + "outputs": [ + "{workspaceRoot}/coverage/{projectName}/unit-tests/lcov.info" + ], + "executor": "@nx/vite:test", + "options": { + "configFile": "{projectRoot}/vitest.unit.config.ts", + "passWithNoTests": true, + "coverage": { + "enabled": true + } + } + }, + "int-test": { + "cache": true, + "outputs": ["{workspaceRoot}/coverage/{projectName}/int-tests/lcov.info"], + "executor": "@nx/vite:test", + "options": { + "configFile": "{projectRoot}/vitest.int.config.ts", + "passWithNoTests": true, + "coverage": { + "enabled": true + } + } + }, + "e2e": { + "dependsOn": ["^build"] + }, "lint": { "inputs": ["default", "{workspaceRoot}/eslint.config.?(c)js"], "executor": "@nx/linter:eslint", @@ -27,9 +56,6 @@ ] } }, - "e2e": { - "dependsOn": ["^build"] - }, "nxv-pkg-install": { "parallelism": false }, diff --git a/packages/ci/project.json b/packages/ci/project.json index 433089f77..9215f87b3 100644 --- a/packages/ci/project.json +++ b/packages/ci/project.json @@ -6,18 +6,8 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/ci/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/ci/vitest.int.config.ts" - } - } + "unit-test": {}, + "int-test": {} }, "tags": ["scope:tooling", "type:feature", "publishable"] } diff --git a/packages/cli/project.json b/packages/cli/project.json index f25d2cccf..bc3b384a7 100644 --- a/packages/cli/project.json +++ b/packages/cli/project.json @@ -6,18 +6,8 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/cli/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/cli/vitest.int.config.ts" - } - }, + "unit-test": {}, + "int-test": {}, "run-help": { "command": "npx dist/packages/cli --help", "dependsOn": ["build"] diff --git a/packages/core/project.json b/packages/core/project.json index fe36dba07..4924717c5 100644 --- a/packages/core/project.json +++ b/packages/core/project.json @@ -6,18 +6,8 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/core/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/core/vitest.int.config.ts" - } - } + "unit-test": {}, + "int-test": {} }, "tags": ["scope:core", "type:feature", "publishable"] } diff --git a/packages/create-cli/project.json b/packages/create-cli/project.json index 11e1ef907..c2bc6ef60 100644 --- a/packages/create-cli/project.json +++ b/packages/create-cli/project.json @@ -6,18 +6,7 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/create-cli/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/create-cli/vitest.int.config.ts" - } - }, + "unit-test": {}, "exec-node": { "dependsOn": ["build"], "command": "node ./dist/packages/create-cli/src/index.js", diff --git a/packages/create-cli/vitest.int.config.ts b/packages/create-cli/vitest.int.config.ts deleted file mode 100644 index 2495fbe9c..000000000 --- a/packages/create-cli/vitest.int.config.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// -import { defineConfig } from 'vite'; -import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js'; - -export default defineConfig({ - cacheDir: '../../node_modules/.vite/create-cli', - test: { - reporters: ['basic'], - globals: true, - cache: { - dir: '../../node_modules/.vitest', - }, - alias: tsconfigPathAliases(), - pool: 'threads', - poolOptions: { threads: { singleThread: true } }, - coverage: { - reporter: ['text', 'lcov'], - reportsDirectory: '../../coverage/create-cli/int-tests', - exclude: ['mocks/**', '**/types.ts'], - }, - environment: 'node', - include: ['src/**/*.int.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], - globalSetup: ['../../global-setup.ts'], - setupFiles: [ - '../../testing/test-setup/src/lib/console.mock.ts', - '../../testing/test-setup/src/lib/reset.mocks.ts', - ], - }, -}); diff --git a/packages/models/project.json b/packages/models/project.json index d80e38793..15981781f 100644 --- a/packages/models/project.json +++ b/packages/models/project.json @@ -18,18 +18,7 @@ ] }, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/models/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/models/vitest.int.config.ts" - } - } + "unit-test": {} }, "tags": ["scope:shared", "type:util", "publishable"] } diff --git a/packages/models/vitest.int.config.ts b/packages/models/vitest.int.config.ts deleted file mode 100644 index fc651cceb..000000000 --- a/packages/models/vitest.int.config.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// -import { defineConfig } from 'vite'; -import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js'; - -export default defineConfig({ - cacheDir: '../../node_modules/.vite/models', - test: { - reporters: ['basic'], - globals: true, - cache: { - dir: '../../node_modules/.vitest', - }, - alias: tsconfigPathAliases(), - pool: 'threads', - poolOptions: { threads: { singleThread: true } }, - coverage: { - reporter: ['text', 'lcov'], - reportsDirectory: '../../coverage/models/int-tests', - exclude: ['mocks/**', '**/types.ts', 'zod2md.config.ts'], - }, - environment: 'node', - include: ['src/**/*.int.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], - globalSetup: ['../../global-setup.ts'], - setupFiles: [ - '../../testing/test-setup/src/lib/console.mock.ts', - '../../testing/test-setup/src/lib/reset.mocks.ts', - ], - }, -}); diff --git a/packages/nx-plugin/project.json b/packages/nx-plugin/project.json index df20084e3..52c8f2290 100644 --- a/packages/nx-plugin/project.json +++ b/packages/nx-plugin/project.json @@ -41,18 +41,8 @@ ] } }, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/nx-plugin/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/nx-plugin/vitest.int.config.ts" - } - } + "unit-test": {}, + "int-test": {} }, "tags": ["scope:tooling", "type:feature", "publishable"] } diff --git a/packages/plugin-coverage/project.json b/packages/plugin-coverage/project.json index ddef42a9d..edb62346f 100644 --- a/packages/plugin-coverage/project.json +++ b/packages/plugin-coverage/project.json @@ -6,18 +6,8 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/plugin-coverage/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/plugin-coverage/vitest.int.config.ts" - } - } + "unit-test": {}, + "int-test": {} }, "tags": ["scope:plugin", "type:feature", "publishable"] } diff --git a/packages/plugin-eslint/project.json b/packages/plugin-eslint/project.json index 0f23cf33d..241101850 100644 --- a/packages/plugin-eslint/project.json +++ b/packages/plugin-eslint/project.json @@ -6,18 +6,8 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/plugin-eslint/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/plugin-eslint/vitest.int.config.ts" - } - } + "unit-test": {}, + "int-test": {} }, "tags": ["scope:plugin", "type:feature", "publishable"] } diff --git a/packages/plugin-js-packages/project.json b/packages/plugin-js-packages/project.json index d664a3817..9f0dc7789 100644 --- a/packages/plugin-js-packages/project.json +++ b/packages/plugin-js-packages/project.json @@ -6,18 +6,8 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/plugin-js-packages/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/plugin-js-packages/vitest.int.config.ts" - } - } + "unit-test": {}, + "int-test": {} }, "tags": ["scope:plugin", "type:feature", "publishable"], "description": "A plugin for JavaScript packages." diff --git a/packages/plugin-jsdocs/project.json b/packages/plugin-jsdocs/project.json index ebe839f44..745540438 100644 --- a/packages/plugin-jsdocs/project.json +++ b/packages/plugin-jsdocs/project.json @@ -7,17 +7,7 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/plugin-jsdocs/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/plugin-jsdocs/vitest.int.config.ts" - } - } + "unit-test": {}, + "int-test": {} } } diff --git a/packages/plugin-lighthouse/project.json b/packages/plugin-lighthouse/project.json index 9442227f4..b93152ffb 100644 --- a/packages/plugin-lighthouse/project.json +++ b/packages/plugin-lighthouse/project.json @@ -6,18 +6,7 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/plugin-lighthouse/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/plugin-lighthouse/vitest.int.config.ts" - } - } + "unit-test": {} }, "tags": ["scope:plugin", "type:feature", "publishable"] } diff --git a/packages/plugin-lighthouse/vitest.int.config.ts b/packages/plugin-lighthouse/vitest.int.config.ts deleted file mode 100644 index 6d7eae79b..000000000 --- a/packages/plugin-lighthouse/vitest.int.config.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// -import { defineConfig } from 'vite'; -import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js'; - -export default defineConfig({ - cacheDir: '../../node_modules/.vite/plugin-lighthouse', - test: { - reporters: ['basic'], - globals: true, - cache: { - dir: '../../node_modules/.vitest', - }, - alias: tsconfigPathAliases(), - pool: 'threads', - poolOptions: { threads: { singleThread: true } }, - coverage: { - reporter: ['text', 'lcov'], - reportsDirectory: '../../coverage/plugin-lighthouse/int-tests', - exclude: ['mocks/**', '**/types.ts'], - }, - environment: 'node', - include: ['src/**/*.int.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], - globalSetup: ['../../global-setup.ts'], - setupFiles: [ - '../../testing/test-setup/src/lib/cliui.mock.ts', - '../../testing/test-setup/src/lib/reset.mocks.ts', - '../../testing/test-setup/src/lib/chrome-path.mock.ts', - ], - }, -}); diff --git a/packages/plugin-typescript/project.json b/packages/plugin-typescript/project.json index 9b2265b73..645259554 100644 --- a/packages/plugin-typescript/project.json +++ b/packages/plugin-typescript/project.json @@ -6,18 +6,8 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/plugin-typescript/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/plugin-typescript/vitest.int.config.ts" - } - } + "unit-test": {}, + "int-test": {} }, "tags": ["scope:plugin", "type:feature", "publishable"] } diff --git a/packages/utils/project.json b/packages/utils/project.json index 30e7fa046..021205deb 100644 --- a/packages/utils/project.json +++ b/packages/utils/project.json @@ -18,18 +18,8 @@ "cwd": "./packages/utils/perf" } }, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/utils/vitest.unit.config.ts" - } - }, - "int-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "packages/utils/vitest.int.config.ts" - } - } + "unit-test": {}, + "int-test": {} }, "tags": ["scope:shared", "type:util", "publishable"] } diff --git a/testing/test-nx-utils/project.json b/testing/test-nx-utils/project.json index 9fc33df87..d76cad67e 100644 --- a/testing/test-nx-utils/project.json +++ b/testing/test-nx-utils/project.json @@ -6,12 +6,7 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "testing/test-nx-utils/vitest.unit.config.ts" - } - } + "unit-test": {} }, "tags": ["scope:shared", "type:testing"] } diff --git a/testing/test-setup/project.json b/testing/test-setup/project.json index 6320cfaab..0657658a2 100644 --- a/testing/test-setup/project.json +++ b/testing/test-setup/project.json @@ -6,12 +6,7 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "testing/test-setup/vitest.unit.config.ts" - } - } + "unit-test": {} }, "tags": ["scope:shared", "type:testing"] } diff --git a/testing/test-utils/project.json b/testing/test-utils/project.json index ccc11d50c..a23396a9e 100644 --- a/testing/test-utils/project.json +++ b/testing/test-utils/project.json @@ -6,12 +6,7 @@ "targets": { "build": {}, "lint": {}, - "unit-test": { - "executor": "@nx/vite:test", - "options": { - "configFile": "testing/test-utils/vitest.unit.config.ts" - } - }, + "unit-test": {}, "nx-release-publish": { "executor": "nx:noop" }