Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.www.
wechaty
提交
3de1f3cc
W
wechaty
项目概览
.www.
/
wechaty
与 Fork 源项目一致
Fork自
wechaty / wechaty
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
wechaty
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3de1f3cc
编写于
3月 10, 2018
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
safe-test support under win32
上级
f5e5d329
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
59 addition
and
27 deletion
+59
-27
.travis.yml
.travis.yml
+1
-1
Dockerfile
Dockerfile
+1
-1
bin/entrypoint.sh
bin/entrypoint.sh
+4
-4
package.json
package.json
+1
-0
script/safe-test.sh
script/safe-test.sh
+0
-20
script/safe-test.ts
script/safe-test.ts
+52
-0
src/puppet-web/bridge.spec.ts
src/puppet-web/bridge.spec.ts
+0
-1
未找到文件。
.travis.yml
浏览文件 @
3de1f3cc
...
@@ -30,7 +30,7 @@ script:
...
@@ -30,7 +30,7 @@ script:
-
echo $TRAVIS_OS_NAME
-
echo $TRAVIS_OS_NAME
-
node --version
-
node --version
-
npm --version
-
npm --version
-
./script/safe-test.sh
-
npm run test:safe
after_success
:
after_success
:
-
if [ "$TRAVIS_OS_NAME" == 'osx' ]; then npm run coverage; fi
-
if [ "$TRAVIS_OS_NAME" == 'osx' ]; then npm run coverage; fi
...
...
Dockerfile
浏览文件 @
3de1f3cc
...
@@ -60,7 +60,7 @@ RUN npm install \
...
@@ -60,7 +60,7 @@ RUN npm install \
COPY
. .
COPY
. .
# RUN npm run test:debug
# RUN npm run test:debug
RUN
./script/safe-test.sh
RUN
npm run
test
:safe
RUN
npm run dist
RUN
npm run dist
# Loading from node_modules Folders: https://nodejs.org/api/modules.html
# Loading from node_modules Folders: https://nodejs.org/api/modules.html
...
...
bin/entrypoint.sh
浏览文件 @
3de1f3cc
...
@@ -32,10 +32,10 @@ function wechaty::errorBotNotFound() {
...
@@ -32,10 +32,10 @@ function wechaty::errorBotNotFound() {
`--volume="
$(
pwd
)
":/bot`
`--volume="
$(
pwd
)
":/bot`
this will let the container visit your current directory.
this will let the container visit your current directory.
2. Are you sure your .js/.ts files aren't .js.txt/.ts.txt?
2. Are you sure your .js/.ts files aren't .js.txt/.ts.txt?
this could be a problem on new Windows installs (file
this could be a problem on new Windows installs (file
extensions hidden by default).
extensions hidden by default).
if you still have issue, please have a look at
if you still have issue, please have a look at
...
@@ -265,7 +265,7 @@ function main() {
...
@@ -265,7 +265,7 @@ function main() {
test
)
test
)
# WECHATY_LOG=silent npm run test:unit
# WECHATY_LOG=silent npm run test:unit
WECHATY_LOG
=
silent
./script/safe-test.sh
WECHATY_LOG
=
silent
npm run
test
:safe
;;
;;
#
#
...
...
package.json
浏览文件 @
3de1f3cc
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
"lint:sh"
:
"bash -n bin/*.sh"
,
"lint:sh"
:
"bash -n bin/*.sh"
,
"sloc"
:
"sloc bin example src test index.ts --details --format cli-table --keys total,source,comment && sloc bin example src test index.ts"
,
"sloc"
:
"sloc bin example src test index.ts --details --format cli-table --keys total,source,comment && sloc bin example src test index.ts"
,
"test"
:
"npm run clean && npm run lint && npm run test:unit && npm run test:shell && npm run sloc"
,
"test"
:
"npm run clean && npm run lint && npm run test:unit && npm run test:shell && npm run sloc"
,
"test:safe"
:
"ts-node script/safe-test"
,
"test:linux"
:
"npm run pretest && parallel ts-node -- ./src/**/*.spec.ts ./test/**/*.spec.ts && npm run posttest"
,
"test:linux"
:
"npm run pretest && parallel ts-node -- ./src/**/*.spec.ts ./test/**/*.spec.ts && npm run posttest"
,
"test:pack"
:
"npm run dist && export TMPDIR=/tmp/wechaty.$$ && npm pack && mkdir $TMPDIR && mv wechaty-*.*.*.tgz $TMPDIR && cp test/fixture/smoke-testing.js $TMPDIR && cd $TMPDIR && npm init -y && npm i wechaty-*.*.*.tgz && node smoke-testing.js"
,
"test:pack"
:
"npm run dist && export TMPDIR=/tmp/wechaty.$$ && npm pack && mkdir $TMPDIR && mv wechaty-*.*.*.tgz $TMPDIR && cp test/fixture/smoke-testing.js $TMPDIR && cd $TMPDIR && npm init -y && npm i wechaty-*.*.*.tgz && node smoke-testing.js"
,
"test:shell"
:
"shellcheck bin/*.sh"
,
"test:shell"
:
"shellcheck bin/*.sh"
,
...
...
script/safe-test.sh
已删除
100755 → 0
浏览文件 @
f5e5d329
#!/usr/bin/env bash
#
# https://github.com/Chatie/wechaty/issues/1084
# WebDriver / Puppeteer sometimes will fail(i.e. timeout) with no reason.
# That will cause the unit tests fail randomly.
# So we need to retry again when unit tests fail,
# and treat it's really fail after MAX_RETRY_NUM times.
MAX_RETRY_NUM
=
3
echo
"Safe Test: starting..."
n
=
0
npm
test
while
((
n < MAX_RETRY_NUM
&&
$?
>
0
))
do
((
n++
))
echo
"Safe Test: retrying
$n
times..."
npm
test
done
script/safe-test.ts
0 → 100644
浏览文件 @
3de1f3cc
#!/usr/bin/env ts-node
/**
* https://github.com/Chatie/wechaty/issues/1084
* WebDriver / Puppeteer sometimes will fail(i.e. timeout) with no reason.
* That will cause the unit tests fail randomly.
* So we need to retry again when unit tests fail,
* and treat it's really fail after MAX_RETRY_NUM times.
*/
import
{
spawn
}
from
'
child_process
'
const
MAX_RETRY_NUM
=
1
async
function
main
():
Promise
<
number
>
{
console
.
log
(
'
Safe Test: starting...
'
)
let
round
=
0
let
succ
=
false
do
{
console
.
log
(
`Safe Test: running for round #
${
round
}
`
)
succ
=
await
npmTest
()
if
(
succ
)
{
// success!
console
.
log
(
`Safe Test: successed at round #
${
round
}
!`
)
return
0
}
}
while
(
round
++
<
MAX_RETRY_NUM
)
return
1
// fail finally :(
}
async
function
npmTest
()
{
const
child
=
spawn
(
'
npm
'
,
[
'
test
'
,
],
{
stdio
:
'
inherit
'
,
},
)
return
new
Promise
<
boolean
>
((
resolve
,
reject
)
=>
{
child
.
once
(
'
exit
'
,
code
=>
code
===
0
?
resolve
(
true
)
:
resolve
(
false
),
)
child
.
once
(
'
error
'
,
reject
)
})
}
main
()
.
then
(
process
.
exit
)
.
catch
(
e
=>
{
console
.
error
(
e
)
process
.
exit
(
1
)
})
src/puppet-web/bridge.spec.ts
浏览文件 @
3de1f3cc
...
@@ -177,5 +177,4 @@ test('clickSwitchAccount()', async t => {
...
@@ -177,5 +177,4 @@ test('clickSwitchAccount()', async t => {
t
.
equal
(
clicked
,
false
,
'
should no button found
'
)
t
.
equal
(
clicked
,
false
,
'
should no button found
'
)
})
})
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录