Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SECURITY_KEY=68bcd9eaacc6f95026886658cf4902f6
74 changes: 74 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"root": true,
"plugins": ["react", "react-hooks", "prettier"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:storybook/recommended",
"plugin:prettier/recommended",
"plugin:import/warnings"
],
"env": {
"browser": true,
"node": true
},
"ignorePatterns": ["node_modules/*", "dist"],
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"no-unused-vars": "warn",
"react/prop-types": "off",
"import/order": [
"error",
{
"groups": ["builtin", "external", ["parent", "sibling"], "index"],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"newlines-between": "always"
}
]
},
"globals": {
"Set": true,
"Map": true
},
"settings": {
"react": {
"version": "detect"
}
},
"overrides": [
{
"files": [
"__mocks__/**.js",
"src/utils/test/**.js",
"src/**/*.spec.js",
"src/**/*.spec.jsx"
],
"plugins": ["vitest"],
"extends": ["plugin:vitest/recommended"],
"rules": {
"vitest/expect-expect": "off"
},
"globals": {
"globalThis": true,
"describe": true,
"it": true,
"expect": true,
"beforeEach": true,
"afterEach": true,
"beforeAll": true,
"afterAll": true,
"vi": true
}
}
]
}
16 changes: 16 additions & 0 deletions .github/workflows/vitest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'vitest test'
on: pull_request
jobs:
Component-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 19
- name: Install dependencies
run: npm ci
- name: run vitest
run: npm run test
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
19.9.0
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid"
}
18 changes: 18 additions & 0 deletions __mocks__/zustand.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const { create: actualCreate } = await vi.importActual('zustand');
import { act } from '@testing-library/react';

// 앱에 선언된 모든 스토어에 대해 재설정 함수를 저장
const storeResetFns = new Set();

// 스토어를 생성할 때 초기 상태를 가져와 리셋 함수를 생성하고 set에 추가합니다.
export const create = createState => {
const store = actualCreate(createState);
const initialState = store.getState();
storeResetFns.add(() => store.setState(initialState, true));
return store;
};

// 테스트가 구동되기 전 모든 스토어를 리셋합니다.
beforeEach(() => {
act(() => storeResetFns.forEach(resetFn => resetFn()));
});
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
<title>Wish Mart</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
9 changes: 9 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"baseUrl": ".",
"target": "es6",
"paths": {
"@/*": ["./src/*"]
}
}
}
Loading