Skip to content

feat: support custom colors for test.name #7809

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

Merged
merged 1 commit into from
May 5, 2025

Conversation

AriPerkkio
Copy link
Member

@AriPerkkio AriPerkkio commented Apr 8, 2025

Description

import { defineConfig } from "vitest/config";

export default defineConfig({
  test: {
    workspace: [
      {
        test: {
          name: { label: "Unit", color: "green" },
        },
      },
      {
        test: {
          name: { label: "Browser" }, // Uses default color picking
        },
      },
      {
        test: {
          name: "Database", // Uses default color picking
        },
      },
    ],
  },
});

Note: Text color on CLI is terminal specific. Setting both background color and text color doesn't work at least in VSCode terminal. You can set either background or text color, not both.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

Copy link

netlify bot commented Apr 8, 2025

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 5d47063
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/68177b9dd14d110008456c9c
😎 Deploy Preview https://deploy-preview-7809--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@AriPerkkio AriPerkkio force-pushed the feat/project-name-color branch 2 times, most recently from 194ede2 to 24b60ed Compare April 8, 2025 16:34
@AriPerkkio AriPerkkio changed the title feat: customize test.name color in reporters feat: support custom colors for test.name Apr 10, 2025
@AriPerkkio AriPerkkio force-pushed the feat/project-name-color branch 2 times, most recently from 51299cd to b905f45 Compare April 10, 2025 08:10
@AriPerkkio

This comment was marked as outdated.

@AriPerkkio AriPerkkio force-pushed the feat/project-name-color branch 6 times, most recently from 461d9fe to 609d68e Compare April 10, 2025 11:56
@AriPerkkio AriPerkkio marked this pull request as ready for review April 10, 2025 12:25
@AriPerkkio AriPerkkio added this to the 3.2.0 milestone Apr 10, 2025
sheremet-va
sheremet-va previously approved these changes Apr 16, 2025
@sheremet-va sheremet-va merged commit 4af5df3 into vitest-dev:main May 5, 2025
12 of 13 checks passed
@AriPerkkio AriPerkkio deleted the feat/project-name-color branch May 5, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow custom colors for project names
2 participants