Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
ccfa1ad9
I
incubator-echarts
项目概览
半栈学徒
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
incubator-echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ccfa1ad9
编写于
4月 30, 2021
作者:
P
pissang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(visual): add disk size stat
上级
c7f9a4be
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
9 deletion
+44
-9
test/runTest/client/client.js
test/runTest/client/client.js
+6
-1
test/runTest/client/index.html
test/runTest/client/index.html
+5
-4
test/runTest/store.js
test/runTest/store.js
+33
-4
未找到文件。
test/runTest/client/client.js
浏览文件 @
ccfa1ad9
...
...
@@ -348,7 +348,12 @@ const app = new Vue({
},
switchTestsRun
(
runResult
)
{
this
.
runConfig
.
expectedVersion
=
runResult
.
expectedVersion
;
this
.
runConfig
.
actualVersion
=
runResult
.
actualVersion
;
// TODO
this
.
runConfig
.
isExpectedNightly
=
runResult
.
expectedVersion
.
includes
(
'
-dev.
'
);
this
.
runConfig
.
isActualNightly
=
runResult
.
actualVersion
.
includes
(
'
-dev.
'
);
this
.
runConfig
.
renderer
=
runResult
.
renderer
;
},
genTestsRunReport
(
runResult
)
{
...
...
test/runTest/client/index.html
浏览文件 @
ccfa1ad9
...
...
@@ -287,16 +287,17 @@ under the License.
title=
"All Tests Runs"
>
<el-table
:data=
"testsRuns"
>
<el-table-column
property=
"expectedVersion"
label=
"Expected"
></el-table-column>
<el-table-column
property=
"actualVersion"
label=
"Actual"
></el-table-column>
<el-table-column
property=
"expectedVersion"
label=
"Expected"
width=
"160"
></el-table-column>
<el-table-column
property=
"actualVersion"
label=
"Actual"
width=
"160"
></el-table-column>
<el-table-column
property=
"renderer"
label=
"Renderer"
width=
"100"
></el-table-column>
<el-table-column
property=
"lastRunTime"
label=
"lastRunTime"
></el-table-column>
<el-table-column
property=
"lastRunTime"
label=
"Last Run"
></el-table-column>
<el-table-column
property=
"diskSize"
label=
"Disk Size"
width=
"100"
></el-table-column>
<el-table-column
property=
"total"
label=
"Total Tests"
width=
"100"
></el-table-column>
<el-table-column
property=
"finished"
label=
"Finished"
width=
"100"
></el-table-column>
<el-table-column
property=
"passed"
label=
"Passed"
width=
"100"
></el-table-column>
<el-table-column
fixed=
"right"
label=
""
label=
"
Operations
"
width=
"160"
>
<template
slot-scope=
"scope"
>
<el-button
type=
"text"
@
click=
"switchTestsRun(scope.row)"
size=
"small"
>
View
</el-button>
...
...
test/runTest/store.js
浏览文件 @
ccfa1ad9
...
...
@@ -23,6 +23,7 @@ const fs = require('fs');
const
globby
=
require
(
'
globby
'
);
const
{
testNameFromFile
}
=
require
(
'
./util
'
);
const
{
blacklist
,
SVGBlacklist
}
=
require
(
'
./blacklist
'
);
const
{
promisify
}
=
require
(
'
util
'
);
let
_tests
=
[];
let
_testsMap
=
{};
...
...
@@ -33,6 +34,14 @@ const RESULTS_ROOT_DIR = path.join(__dirname, 'tmp', 'result');
const
TEST_HASH_SPLITTER
=
'
__
'
;
function
convertBytes
(
bytes
)
{
const
sizes
=
[
'
Bytes
'
,
'
KB
'
,
'
MB
'
,
'
GB
'
,
'
TB
'
]
if
(
bytes
==
0
)
{
return
'
N/A
'
;
}
const
i
=
Math
.
floor
(
Math
.
log
(
bytes
)
/
Math
.
log
(
1024
));
return
(
bytes
/
Math
.
pow
(
1024
,
i
)).
toFixed
(
Math
.
min
(
1
,
i
))
+
'
'
+
sizes
[
i
]
}
class
Test
{
constructor
(
fileUrl
)
{
this
.
fileUrl
=
fileUrl
;
...
...
@@ -201,13 +210,31 @@ module.exports.updateActionsMeta = function (testName, actions) {
),
'
utf-8
'
);
};
async
function
getFolderSize
(
dir
)
{
const
files
=
await
globby
(
dir
);
let
size
=
0
;
for
(
let
file
of
files
)
{
size
+=
fs
.
statSync
(
file
).
size
;
}
return
size
;
// const statAsync = promisify(fs.stat);
// return Promise.all(
// files.map(file => statAsync(file))
// ).then(sizes => {
// return sizes.reduce((total, current) => {
// return total + current.size;
// }, 0)
// });
}
/**
* Get results of all runs
* @return [ { id, expectedVersion, actualVersion, renderer, lastRunTime, total, finished, passed } ]
* @return [ { id, expectedVersion, actualVersion, renderer, lastRunTime, total, finished, passed
, diskSize
} ]
*/
module
.
exports
.
getAllTestsRuns
=
async
function
()
{
const
dirs
=
await
globby
(
'
*
'
,
{
cwd
:
RESULTS_ROOT_DIR
,
onlyDirectories
:
true
});
return
dirs
.
map
((
dir
)
=>
{
const
results
=
[];
for
(
let
dir
of
dirs
)
{
const
params
=
parseRunHash
(
dir
);
const
resultJson
=
JSON
.
parse
(
fs
.
readFileSync
(
path
.
join
(
RESULTS_ROOT_DIR
,
...
...
@@ -243,9 +270,11 @@ module.exports.getAllTestsRuns = async function () {
params
.
passed
=
passedCount
;
params
.
finished
=
finishedCount
;
params
.
id
=
dir
;
params
.
diskSize
=
convertBytes
(
await
getFolderSize
(
path
.
join
(
RESULTS_ROOT_DIR
,
dir
)));
return
params
;
});
results
.
push
(
params
);
};
return
results
;
}
module
.
exports
.
delTestsRun
=
async
function
(
hash
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录