Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-book
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-book
Commits
a44bdccb
提交
a44bdccb
authored
7月 20, 2026
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(admin): add component test harness
上级
ce372724
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
73 行增加
和
2 行删除
+73
-2
package.json
apps/admin/package.json
+9
-2
setup.ts
apps/admin/src/test/setup.ts
+1
-0
smoke.test.tsx
apps/admin/src/test/smoke.test.tsx
+21
-0
vitest.config.ts
apps/admin/vitest.config.ts
+17
-0
pnpm-lock.yaml
pnpm-lock.yaml
+25
-0
没有找到文件。
apps/admin/package.json
浏览文件 @
a44bdccb
...
@@ -10,7 +10,9 @@
...
@@ -10,7 +10,9 @@
"preview"
:
"vite preview"
,
"preview"
:
"vite preview"
,
"lint"
:
"oxlint --fix ."
,
"lint"
:
"oxlint --fix ."
,
"format"
:
"oxfmt src/"
,
"format"
:
"oxfmt src/"
,
"test"
:
"node --test src/app/route-manifest.test.mjs src/store/storage-import.test.mjs src/utils/*.test.js src/layout/components/*.test.js"
"test"
:
"node --test src/app/route-manifest.test.mjs src/store/storage-import.test.mjs src/utils/*.test.js src/layout/components/*.test.js"
,
"test:unit"
:
"vitest"
,
"test:unit:watch"
:
"vitest --watch"
},
},
"dependencies"
:
{
"dependencies"
:
{
"@ant-design/icons"
:
"^5.4.0"
,
"@ant-design/icons"
:
"^5.4.0"
,
...
@@ -50,16 +52,21 @@
...
@@ -50,16 +52,21 @@
"zustand"
:
"^4.5.5"
"zustand"
:
"^4.5.5"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"@testing-library/jest-dom"
:
"^6.9.1"
,
"@testing-library/react"
:
"^16.3.2"
,
"@testing-library/user-event"
:
"^14.6.1"
,
"@types/react"
:
"^18.3.7"
,
"@types/react"
:
"^18.3.7"
,
"@types/react-dom"
:
"^18.3.0"
,
"@types/react-dom"
:
"^18.3.0"
,
"@vitejs/plugin-react"
:
"^6.0.3"
,
"@vitejs/plugin-react"
:
"^6.0.3"
,
"jsdom"
:
"^29.1.1"
,
"less"
:
"^4.2.0"
,
"less"
:
"^4.2.0"
,
"oxfmt"
:
"^0.59.0"
,
"oxfmt"
:
"^0.59.0"
,
"oxlint"
:
"^1.74.0"
,
"oxlint"
:
"^1.74.0"
,
"react-router"
:
"^7.18.1"
,
"react-router"
:
"^7.18.1"
,
"typescript"
:
"^7.0.2"
,
"typescript"
:
"^7.0.2"
,
"vite"
:
"^8.1.5"
,
"vite"
:
"^8.1.5"
,
"vite-plugin-mkcert"
:
"^1.17.10"
"vite-plugin-mkcert"
:
"^1.17.10"
,
"vitest"
:
"^4.1.10"
},
},
"browserslist"
:
[
"browserslist"
:
[
"> 1%"
,
"> 1%"
,
...
...
apps/admin/src/test/setup.ts
0 → 100644
浏览文件 @
a44bdccb
import
'@testing-library/jest-dom/vitest'
apps/admin/src/test/smoke.test.tsx
0 → 100644
浏览文件 @
a44bdccb
import
{
useState
}
from
'react'
import
{
render
,
screen
}
from
'@testing-library/react'
import
userEvent
from
'@testing-library/user-event'
import
{
describe
,
expect
,
it
}
from
'vitest'
function
ClickCounter
()
{
const
[
count
,
setCount
]
=
useState
(
0
)
return
<
button
onClick=
{
()
=>
setCount
(
count
+
1
)
}
>
Clicked
{
count
}
times
</
button
>
}
describe
(
'component test harness'
,
()
=>
{
it
(
'renders a button and updates it after a click'
,
async
()
=>
{
const
user
=
userEvent
.
setup
()
render
(<
ClickCounter
/>)
await
user
.
click
(
screen
.
getByRole
(
'button'
,
{
name
:
'Clicked 0 times'
}))
expect
(
screen
.
getByRole
(
'button'
,
{
name
:
'Clicked 1 times'
})).
toBeInTheDocument
()
})
})
apps/admin/vitest.config.ts
0 → 100644
浏览文件 @
a44bdccb
import
{
fileURLToPath
,
URL
}
from
'node:url'
import
{
defineConfig
}
from
'vitest/config'
export
default
defineConfig
({
resolve
:
{
alias
:
{
'@'
:
fileURLToPath
(
new
URL
(
'./src'
,
import
.
meta
.
url
)),
},
},
test
:
{
css
:
true
,
environment
:
'jsdom'
,
include
:
[
'src/test/**/*.test.{ts,tsx}'
],
setupFiles
:
[
'./src/test/setup.ts'
],
},
})
pnpm-lock.yaml
浏览文件 @
a44bdccb
...
@@ -116,6 +116,15 @@ importers:
...
@@ -116,6 +116,15 @@ importers:
specifier
:
^4.5.5
specifier
:
^4.5.5
version
:
4.5.7(@types/react@18.3.31)(immer@9.0.21)(react@18.3.1)
version
:
4.5.7(@types/react@18.3.31)(immer@9.0.21)(react@18.3.1)
devDependencies
:
devDependencies
:
'
@testing-library/jest-dom'
:
specifier
:
^6.9.1
version
:
6.9.1
'
@testing-library/react'
:
specifier
:
^16.3.2
version
:
16.3.2(@testing-library/dom@10.4.1)(@types/react-dom@18.3.7(@types/react@18.3.31))(@types/react@18.3.31)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'
@testing-library/user-event'
:
specifier
:
^14.6.1
version
:
14.6.1(@testing-library/dom@10.4.1)
'
@types/react'
:
'
@types/react'
:
specifier
:
^18.3.7
specifier
:
^18.3.7
version
:
18.3.31
version
:
18.3.31
...
@@ -125,6 +134,9 @@ importers:
...
@@ -125,6 +134,9 @@ importers:
'
@vitejs/plugin-react'
:
'
@vitejs/plugin-react'
:
specifier
:
^6.0.3
specifier
:
^6.0.3
version
:
6.0.3(vite@8.1.5(@types/node@22.20.1)(esbuild@0.28.1)(less@4.6.7))
version
:
6.0.3(vite@8.1.5(@types/node@22.20.1)(esbuild@0.28.1)(less@4.6.7))
jsdom
:
specifier
:
^29.1.1
version
:
29.1.1
less
:
less
:
specifier
:
^4.2.0
specifier
:
^4.2.0
version
:
4.6.7
version
:
4.6.7
...
@@ -146,6 +158,9 @@ importers:
...
@@ -146,6 +158,9 @@ importers:
vite-plugin-mkcert
:
vite-plugin-mkcert
:
specifier
:
^1.17.10
specifier
:
^1.17.10
version
:
1.17.12(vite@8.1.5(@types/node@22.20.1)(esbuild@0.28.1)(less@4.6.7))
version
:
1.17.12(vite@8.1.5(@types/node@22.20.1)(esbuild@0.28.1)(less@4.6.7))
vitest
:
specifier
:
^4.1.10
version
:
4.1.10(@types/node@22.20.1)(jsdom@29.1.1)(vite@8.1.5(@types/node@22.20.1)(esbuild@0.28.1)(less@4.6.7))
apps/learning
:
apps/learning
:
dependencies
:
dependencies
:
...
@@ -4863,6 +4878,16 @@ snapshots:
...
@@ -4863,6 +4878,16 @@ snapshots:
picocolors
:
1.1.1
picocolors
:
1.1.1
redent
:
3.0.0
redent
:
3.0.0
'
@testing-library/react@16.3.2(@testing-library/dom@10.4.1)(@types/react-dom@18.3.7(@types/react@18.3.31))(@types/react@18.3.31)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)'
:
dependencies
:
'
@babel/runtime'
:
7.29.7
'
@testing-library/dom'
:
10.4.1
react
:
18.3.1
react-dom
:
18.3.1(react@18.3.1)
optionalDependencies
:
'
@types/react'
:
18.3.31
'
@types/react-dom'
:
18.3.7(@types/react@18.3.31)
'
@testing-library/react@16.3.2(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.7(react@19.2.7))(react@19.2.7)'
:
'
@testing-library/react@16.3.2(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.7(react@19.2.7))(react@19.2.7)'
:
dependencies
:
dependencies
:
'
@babel/runtime'
:
7.29.7
'
@babel/runtime'
:
7.29.7
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论