Skip to content

vitest, playwright 세팅#34

Merged
mung96 merged 6 commits into
mainfrom
chore/test-setting
Apr 14, 2026
Merged

vitest, playwright 세팅#34
mung96 merged 6 commits into
mainfrom
chore/test-setting

Conversation

@mung96

@mung96 mung96 commented Apr 14, 2026

Copy link
Copy Markdown
Owner

No description provided.

@mung96 mung96 self-assigned this Apr 14, 2026
@vercel

vercel Bot commented Apr 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dev-time Building Building Preview, Comment Apr 14, 2026 0:53am

@mung96 mung96 merged commit 8768bb6 into main Apr 14, 2026
3 of 4 checks passed
@mung96 mung96 deleted the chore/test-setting branch April 14, 2026 00:53

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request establishes a comprehensive testing environment by adding Vitest for unit tests and Playwright for end-to-end testing, along with MSW for API mocking. Key feedback includes fixing a syntax error in the useRouter mock that causes it to return undefined, aligning Playwright package versions to prevent conflicts, and configuring the baseURL for easier E2E test maintenance. Additionally, it is recommended to ensure TypeScript path aliases are supported across all Vitest projects, including Storybook.

Comment thread vitest.setup.ts
Comment on lines +7 to +9
const useRouter = vi.fn(() => {
push: vi.fn();
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

useRouter 모의(mock) 함수가 객체를 반환하지 않고 undefined를 반환하고 있습니다. 화살표 함수에서 객체 리터럴을 반환하려면 소괄호 ()로 감싸야 합니다. 현재 상태로는 테스트에서 router.push() 등을 호출할 때 오류가 발생합니다.

Suggested change
const useRouter = vi.fn(() => {
push: vi.fn();
});
const useRouter = vi.fn(() => ({
push: vi.fn(),
}));

Comment thread playwright.config.ts
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('')`. */
// baseURL: 'http://localhost:3000',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

baseURL을 설정하면 테스트 코드에서 await page.goto('/')와 같이 상대 경로를 사용할 수 있어 유지보수가 쉬워집니다. 아래 webServer 설정의 URL과 일치하도록 설정하는 것을 권장합니다.

Suggested change
// baseURL: 'http://localhost:3000',
baseURL: 'http://localhost:3000',

Comment thread package.json
"devDependencies": {
"@chromatic-com/storybook": "^5.0.0",
"@hookform/devtools": "^4.4.0",
"@playwright/test": "^1.59.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

@playwright/test 버전이 프로젝트에 이미 설치된 playwright 패키지 버전(1.58.1)과 다릅니다. 두 패키지의 버전이 일치하지 않으면 예기치 않은 동작이 발생할 수 있으므로 버전을 맞추는 것이 좋습니다.

Suggested change
"@playwright/test": "^1.59.1",
"@playwright/test": "^1.58.1",

Comment thread vitest.config.ts
projects: [
{
extends: true,
plugins: [tsconfigPaths()],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

tsconfigPaths() 플러그인이 unit 프로젝트에만 적용되어 있습니다. 만약 Storybook 테스트에서도 TypeScript 경로 별칭(path alias)을 사용한다면, 해당 프로젝트 설정에도 추가하거나 공통 플러그인으로 설정하는 것이 좋습니다.

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.

1 participant