Skip to content

test: introduce test-vitest-setup #1067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

AndriiSiuta
Copy link
Collaborator

Closes #1065

@github-actions github-actions bot added 📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests 🛠️ tooling labels Aug 15, 2025
Copy link

pkg-pr-new bot commented Aug 15, 2025

Open in StackBlitz

@code-pushup/create-cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/create-cli@1067

@code-pushup/ci

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/ci@1067

@code-pushup/models

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/models@1067

@code-pushup/nx-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/nx-plugin@1067

@code-pushup/cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@1067

@code-pushup/coverage-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/coverage-plugin@1067

@code-pushup/core

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/core@1067

@code-pushup/eslint-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/eslint-plugin@1067

@code-pushup/js-packages-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/js-packages-plugin@1067

@code-pushup/jsdocs-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/jsdocs-plugin@1067

@code-pushup/lighthouse-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/lighthouse-plugin@1067

@code-pushup/typescript-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/typescript-plugin@1067

@code-pushup/utils

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@1067

commit: 3551706

Copy link
Collaborator

@BioPhoton BioPhoton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for starting this refactor! Looking forward to a clean test config setup.

Some remarks, If you open a PR and request a review please do a self review.

Check if:

  • all changes are applied in a consistent way. Not different versions for the same change. E.g. you extend the global configuration in different ways.
  • do not add code changes out of scope. If they are necessary mention them in a comment
  • potentially add information on the state of the PR e.g. DO NOT REFIEW and additional comments about unfinished parts.
  • If you use AI do an extra detailed review!

@github-actions github-actions bot removed the 📖 Project documentation improvements or additions to the project documentation label Aug 22, 2025
Copy link

nx-cloud bot commented Aug 22, 2025

View your CI Pipeline Execution ↗ for commit 3551706

Command Status Duration Result
nx code-pushup -- --verbose --no-progress --per... ❌ Failed 8m 24s View ↗
nx code-pushup -- print-config --verbose --outp... ✅ Succeeded 8s View ↗

☁️ Nx Cloud last updated this comment at 2025-08-22 10:25:48 UTC

@AndriiSiuta AndriiSiuta requested a review from BioPhoton August 22, 2025 10:16
Comment on lines +19 to +26
type CoverageConfig = {
enabled?: boolean;
provider: 'v8';
reporter: ('text' | 'lcov')[];
reportsDirectory: string;
include: string[];
exclude: string[];
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use the types from vite/vitest directly:

// from vite
import type { UserConfig } from 'vite';
type TestCoverage = Exclude<UserConfig['test'], undefined>;
// from vitest
import type { UserConfig } from 'vitest';
type TestCoverage = UserConfig;

// for both
const testConfig: TestCoverage = {
    coverage: {
      reporter: ['text', 'lcov'],
      reportsDirectory: '../../coverage/plugin-eslint/int-tests',
      exclude: ['mocks/**', '**/types.ts'],
    },
};

I suggest go with types from vitest and remove the types in this file.

@@ -14,7 +15,7 @@ export function tsconfigPathAliases(): AliasOptions {
.map(
([importPath, relativePath]): Alias => ({
find: importPath,
replacement: new URL(`../${relativePath}`, import.meta.url).pathname,
replacement: path.resolve(relativePath),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change needed? I think we can revert it. Was there a problem?

Comment on lines +1 to +8
import baseConfig from '../../eslint.config.js';

export default [
...baseConfig,
{
files: ['**/*'],
},
];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be the same as in test-setup?

import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
  files: ['**/*.ts'],
  languageOptions: {
    parserOptions: {
      projectService: true,
      tsconfigRootDir: import.meta.dirname,
    },
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test: introduce test-vitest-setup project to handle test setup for vite tests
2 participants