Skip to content

fix: vitest config 공통화 등 자잘한 수정사항 반영#66

Merged
noahluftyang merged 3 commits intomainfrom
fix/shared-config
Jan 1, 2025
Merged

fix: vitest config 공통화 등 자잘한 수정사항 반영#66
noahluftyang merged 3 commits intomainfrom
fix/shared-config

Conversation

@noahluftyang
Copy link
Copy Markdown
Collaborator

@noahluftyang noahluftyang commented Jan 1, 2025

변경사항

  • 각 패키지에서 모노레포 루트의 vitest.config.ts를 확장하도록 변경, vitest@vitest/coverage-v8을 카탈로그로 관리 d59135d
  • css module 관련 타입정의를 global.d.ts로 통일하고 프로젝트 상단으로 위치 조정 70cdcc4
  • 일부 스토리 파일에 타이틀 명시 b4ca99b

시각자료

체크리스트

  • 기능 명세를 작성하였나요?
  • 테스트 코드를 작성하였나요?

추가 논의사항

Summary by CodeRabbit

  • 테스트 및 커버리지

    • Vitest 구성 파일 전반에 걸쳐 통합 테스트 설정 간소화
    • GitHub Actions 워크플로우의 테스트 실행 스크립트 업데이트
    • 테스트 커버리지 보고서 설정 조정
  • 의존성 관리

    • 여러 패키지에서 @vitest/coverage-v8 의존성 제거
    • Vitest 버전을 ^2.1.8로 업데이트
  • Storybook 개선

    • Divider 및 RadioGroup 컴포넌트에 스토리 제목 추가
  • 타입스크립트 설정

    • 일부 패키지에 CSS 모듈 타입 선언 추가

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 1, 2025

⚠️ No Changeset found

Latest commit: b4ca99b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 1, 2025

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

.templates/component/vitest.config.ts

Oops! Something went wrong! :(

ESLint: 9.17.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

개요

Walkthrough

이 풀 리퀘스트는 주로 Vitest 구성 파일, 패키지 의존성, GitHub Actions 워크플로우, 그리고 몇몇 Storybook 메타데이터를 수정합니다. 주요 변경 사항은 Vitest 구성의 표준화, 의존성 버전 업데이트, 테스트 스크립트 조정, 그리고 일부 CSS 모듈 선언 추가 및 제거를 포함합니다.

Changes

파일 변경 요약
.github/workflows/coverage.yaml 테스트 실행 명령어 pnpm vitest --coveragepnpm run test --coverage 변경
package.json "test": "vitest" 스크립트 추가, 의존성 버전을 "catalog:" 로 변경
vitest.config.ts 환경 설정 'happy-dom' 추가, 커버리지 구성 업데이트
여러 패키지의 vitest.config.ts defineConfigmergeConfigdefineProject 로 구성 변경
여러 패키지의 package.json @vitest/coverage-v8 의존성 제거
Storybook 스토리 파일 컴포넌트 메타데이터에 title 속성 추가

Sequence Diagram

sequenceDiagram
    participant Dev as 개발자
    participant Workflow as GitHub Actions
    participant Vitest as Vitest 테스트
    participant Coverage as 코드 커버리지

    Dev->>Workflow: 코드 푸시
    Workflow->>Vitest: 테스트 실행
    Vitest-->>Workflow: 테스트 결과
    Workflow->>Coverage: 커버리지 보고서 업로드
Loading

Possibly related PRs

Suggested reviewers

  • bae-sh
  • heeji289
  • synuns
  • hy57in
  • kimdaeyeobbb
  • developerjhp
  • froggy1014

Poem

🐰 테스트의 토끼, 코드를 뛰어넘어
설정 파일들을 깔끔하게 정리해
비테스트 설정, 이제는 간결하게
커버리지 높이고, 성능을 키워
코드의 숲을 자유롭게 달려가네! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
.templates/component/vitest.config.ts (1)

4-11: 확장 용이성 점검
추후 여러 컴포넌트가 이 파일을 기반으로 생성될 경우, mergeConfig 구조가 확장 가능하도록 유지될지 미리 검토해 보시는 것을 권장합니다.

packages/skeleton/vitest.config.ts (1)

4-11: 프로젝트별 재정의 구성을 명확히 확인하세요.

test 오브젝트에서 필요한 설정만 남겨 공통 설정과 잘 구분되도록 설계한 점이 좋아 보입니다. 그러나 추후 프로젝트마다 추가 옵션이 필요해지면, defineProject 내부를 체계적으로 확장할 방법을 고민해 보세요.

vitest.config.ts (1)

11-12: 커버리지 범위 설정을 세밀하게 고려하세요

include: ['**/src']로 소스에 초점을 맞추되, 제외 경로(.templates, *.stories.tsx, index.ts)가 유용한지 재확인해 주세요. 필요 시 테스트 대상 소스와 분리된 파일이 누락되지 않도록 주의가 필요합니다.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4656c79 and b4ca99b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (21)
  • .github/workflows/coverage.yaml (1 hunks)
  • .templates/component/vitest.config.ts (1 hunks)
  • package.json (2 hunks)
  • packages/Input/src/env.d.ts (0 hunks)
  • packages/Input/vitest.config.ts (1 hunks)
  • packages/badge/package.json (0 hunks)
  • packages/badge/vitest.config.ts (1 hunks)
  • packages/card/package.json (0 hunks)
  • packages/card/vitest.config.ts (1 hunks)
  • packages/divider/src/Divider.stories.tsx (1 hunks)
  • packages/divider/vitest.config.ts (1 hunks)
  • packages/radio-group/src/RadioGroup.stories.tsx (1 hunks)
  • packages/radio-group/vitest.config.ts (1 hunks)
  • packages/skeleton/vitest.config.ts (1 hunks)
  • packages/switch/vitest.config.ts (1 hunks)
  • packages/tooltip/global.d.ts (1 hunks)
  • packages/tooltip/vitest.config.ts (1 hunks)
  • packages/typography/global.d.ts (1 hunks)
  • packages/typography/vitest.config.ts (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
  • vitest.config.ts (1 hunks)
💤 Files with no reviewable changes (3)
  • packages/card/package.json
  • packages/Input/src/env.d.ts
  • packages/badge/package.json
✅ Files skipped from review due to trivial changes (2)
  • packages/typography/global.d.ts
  • packages/tooltip/global.d.ts
🔇 Additional comments (27)
packages/badge/vitest.config.ts (2)

1-2: 전역 구성 파일 병합 방식 도입
mergeConfigdefineProject를 함께 사용하여 프로젝트별 설정을 확장하는 접근은 재사용성과 유지보수성에 이점이 있습니다.


4-11: 프로젝트별 설정 최소화
프로젝트 특화 설정(테스트 셋업 파일)만 남기고 나머지를 공통 설정에 위임하여, 중복을 줄이고 관리 포인트를 간소화했습니다.

packages/card/vitest.config.ts (2)

1-2: 공통 Vitest 설정 활용
defaultConfig를 가져와서 병합하는 방식은 여러 패키지 간의 설정 일관성을 보장하므로 적절해 보입니다.


4-11: 프로젝트 특화 테스트 설정
setupFiles만 남기고 기타 설정은 상위 설정에 포함되므로 테스트 유지보수 부담이 크게 줄어듭니다.

packages/tooltip/vitest.config.ts (2)

1-2: 공통 설정 -> 프로젝트 설정으로 자연스러운 확장
mergeConfigdefineProject를 함께 사용하는 방식은 서로 다른 패키지 사이에서도 코드를 쉽게 공유하고 유지할 수 있어 좋습니다.


4-11: 불필요한 속성 제거로 가독성 향상
공통 설정에서 이미 처리하는 속성을 파일에서 제거해, 개별 패키지 설정의 가독성과 명확성이 개선되었습니다.

packages/typography/vitest.config.ts (2)

1-2: 재사용성 높은 테스트 구성
defaultConfig를 병합해 사용함으로써 향후 레거시 설정 제거나 확장 시에도 일관성을 유지하기 수월해집니다.


4-11: 구성 간소화
프로젝트별 필수 설정만 명시하도록 하여, 유지보수 시 대규모 수정 없이도 공통 설정을 변경하면 전체 패키지에 자동 반영될 수 있습니다.

packages/Input/vitest.config.ts (2)

1-2: 프로젝트 전역 Vitest 설정 확장 확인하기
메인 설정(../../vitest.config)을 불러와 사용하는 방식으로 보이는데, 이로 인해 프로젝트 전역 설정과 충돌이 없는지 확인해 주세요.


4-11: 구성 병합 로직 검토
기본 설정에 프로젝트별 설정을 병합하는 패턴은 유지보수성을 높여줍니다. 다만, 장래에 test 섹션 이외에도 다른 설정들을 추가해야 하는 상황이라면, 이 구성 방식을 지속적으로 확장할 수 있을지 미리 고려해 보시면 좋겠습니다.

packages/divider/vitest.config.ts (2)

1-2: 전역 설정 병합 패턴 유지
mergeConfigdefineProject로 프로젝트 테스트 설정을 깔끔히 분리했습니다. 다른 패키지와 일관성 있게 적용된 점이 좋습니다.


4-11: 추가 설정 고려 제안
test 섹션만 남겨둔 상태인데, 테스트 환경(environment 등)이 필요한 경우가 아닌지 확인해 보세요.

packages/switch/vitest.config.ts (2)

1-2: 테스트 설정 공통화
공통 설정(defaultConfig) 재활용으로 전체적인 테스트 환경을 표준화한 점이 인상적입니다.


4-11: 직관적 테스트 설정 유지
setupFiles만 유지하여 필요 최소한의 설정만 남긴 것은 단순화 측면에서 좋습니다. 추후 CI 환경에서 문제가 없는지 확인을 권장합니다.

.templates/component/vitest.config.ts (1)

1-2: 템플릿 설정에서 공통 설정 사용 유도
컴포넌트 템플릿에서도 전역 설정을 활용해 일관된 구조를 제공하도록 수정된 점이 좋습니다.

packages/skeleton/vitest.config.ts (1)

1-2: 공통 설정 분리 방식이 타당합니다.

다른 패키지와 동일한 mergeConfig + defineProject 방식을 사용하여 중복 설정을 줄이고 유지보수를 용이하게 만드는 접근은 적절합니다.

packages/radio-group/vitest.config.ts (2)

1-2: 공통화된 구성을 적용해 일관성을 유지합니다.

defineProjectmergeConfig를 통해 공통 설정을 가져오고, 필요한 부분만 별도로 재정의하는 방식이 유용해 보입니다.


4-11: 프로젝트별 옵션 추가 시 충돌을 방지하세요.

이 구조에서는 다른 패키지들과 동일하게 test.setupFiles만 오버라이딩하고 있습니다. 향후 다른 테스트 환경 설정이 필요하면, 중복되거나 충돌하지 않도록 주의 깊게 관리해야 합니다.

vitest.config.ts (1)

6-6: 'happy-dom' 환경 사용에 따른 호환성 검토 필요

environment'happy-dom'으로 설정하면 DOM API를 일부 지원할 수 있습니다. 다만, Node 환경 특성이나 JSDOM을 사용하던 기존 테스트와의 호환성을 점검해 보세요.

packages/divider/src/Divider.stories.tsx (1)

6-6: 스토리북 구조 상에서의 제목 정의가 명확해졌습니다

title: 'Divider'로 설정해 사용자들이 Divider 컴포넌트를 쉽게 식별할 수 있습니다. 다만, 다른 컴포넌트와의 구분을 위해 상황에 따라 폴더/그룹 이름을 추가하는 것도 고려해 보세요.

packages/radio-group/src/RadioGroup.stories.tsx (1)

7-7: Storybook에 명시적인 타이틀 추가가 유용합니다.
Storybook에서 컴포넌트가 명확하게 구분되어, 팀원들이 스토리 구조를 한눈에 이해하기 좋습니다.

pnpm-workspace.yaml (2)

13-13: 커버리지 패키지 추가의 영향 검토
새로운 커버리지 플러그인을 도입함으로써 테스트 리포트가 정상적으로 동작하는지 확인이 필요합니다.


19-19: Vitest 버전 업그레이드
버전 업으로 인해 호환성 문제가 없는지 확인하고, 프로젝트 전반의 테스트 실행에 이상이 없는지점검하면 좋겠습니다.

.github/workflows/coverage.yaml (1)

26-26: 테스트 스크립트 변경으로 일관성 확보
pnpm vitest --coverage 대신 pnpm run test --coverage를 사용하여, 각각의 패키지에서 동일한 스크립트 설정을 활용할 수 있습니다.

package.json (3)

7-8: Storybook 개발 및 테스트 스크립트 분리
"dev:storybook" 스크립트와 "test" 스크립트를 명확히 분리함으로써, 다양한 워크플로우 설정 시 편의성이 높아집니다.


23-23: 커버리지 관련 의존성 카탈로그화
@vitest/coverage-v8를 카탈로그로 관리하여 버전 충돌을 피하고, 프로젝트 전반적으로 일관성 있는 버전을 유지할 수 있습니다.


31-31: Vitest 의존성 카탈로그화
테스트 프레임워크 버전을 중앙에서 일괄 관리하기에 적합합니다. 버전 업데이트 시 전체 프로젝트에 반영되도록 주의해 주세요.

@noahluftyang noahluftyang enabled auto-merge (squash) January 1, 2025 12:25
Copy link
Copy Markdown
Member

@synuns synuns left a comment

Choose a reason for hiding this comment

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

지금 시점에 딱 필요한 작업이었는데 너무 좋다!
머지하면서 제너레이터 쪽이랑 잘 작동하는지만 한번 확인해보면 될 것 같아

run: pnpm install
- name: 테스트
run: pnpm vitest --coverage
run: pnpm run test --coverage
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

오호 명령어를 패키지 스크립트로 하는게 확실히 더 관리하기 좋겠다

@@ -1,16 +1,11 @@
import { defineConfig } from 'vitest/config';
import { defineProject, mergeConfig } from 'vitest/config';
import defaultConfig from '../../vitest.config';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

defaultConfig로 중복 제거 나이스!!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

해당 pr이랑 무관하게 생각이 든건데 프로젝트를 절대 경로로 관리해보는건 어떨까?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

global.d.ts 로 변경한 이유가 있을까?

defaultConfig,
defineProject({
test: {
setupFiles: './vitest.setup.ts',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

setup 파일 통일한거 너무 좋다

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.

2 participants