提交 d6b002d8 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

switch unit test tool from tap to tape, and modify usage of t.end to fix tape

上级 98089a01
......@@ -8,7 +8,7 @@
"pretest": "npm run lint",
"start": "node bin/io-bot",
"demo": "node example/ding-dong-bot.js",
"test": "cross-env TAP_TIMEOUT=600 tap --reporter=tap test/{*,**}/*.spec.js"
"test": "cross-env LC_ALL=C TAP_TIMEOUT=600 tape test/**/*.spec.js"
},
"repository": {
"type": "git",
......@@ -65,8 +65,7 @@
"cross-env": "^2.0.0",
"eslint": "^3.2.2",
"qrcode-terminal": "^0.10.0",
"rimraf": "^2.5.4",
"tap": "^6.3.0",
"tape": "^4.6.0",
"tuling123-client": "0.0.1"
},
"files_comment__whitelist_npm_publish": "http://stackoverflow.com/a/8617868/1123955",
......
......@@ -187,7 +187,7 @@ class Browser extends EventEmitter {
const timeout = max * (backoff * max) / 2
return retryPromise({ max: max, backoff: backoff }, attempt => {
log.silly('PuppetWebBrowser', 'clean() retryPromise: attampt %s time for timeout %s'
log.silly('PuppetWebBrowser', 'clean() retryPromise: attempt %s time for timeout %s'
, attempt, timeout)
return new Promise((resolve, reject) => {
......@@ -195,7 +195,7 @@ class Browser extends EventEmitter {
.then(pids => {
if (pids.length === 0) {
log.verbose('PuppetWebBrowser', 'clean() retryPromise() resolved')
resolve('clean() no browser process, confirm clean')
resolve('clean() browser process not found, at attemp#' + attempt)
} else {
reject(new Error('clean() found browser process, not clean, dirty'))
}
......
......@@ -32,8 +32,9 @@ function onFeed({
, timeout = 60000 // 60s default. can be override in options but be careful about the number zero(0)
} = {}) {
type = type || 'HEARTBEAT' // BUG compatible with issue: node-tap strange behaviour cause CircleCI & Travis-CI keep failing #11
timeout = timeout || 60000 // BUG compatible with issue: node-tap strange behaviour cause CircleCI & Travis-CI keep failing #11
// change to tape instead of tap
// type = type || 'HEARTBEAT' // BUG compatible with issue: node-tap strange behaviour cause CircleCI & Travis-CI keep failing #11
// timeout = timeout || 60000 // BUG compatible with issue: node-tap strange behaviour cause CircleCI & Travis-CI keep failing #11
if (!this) {
throw new Error('onFeed() must has `this` of instanceof PuppetWeb')
......
......@@ -313,7 +313,7 @@ mkdir b
cd b
cat > bug.js <<__CODE__
const test = require('tap').test
const test = require('tape')
const func = require('../w.js')
test('func param test', function(t) {
......
const test = require('tap').test
const test = require('tape')
const Contact = require('../src/contact')
const Puppet = require('../src/puppet')
......@@ -35,5 +35,5 @@ test('Contact smoke testing', t => {
t.equal(typeof s, 'string', 'toString()')
})
.catch(e => t.fail('ready() rejected: ' + e))
.then(t.end) // test end
.then(_ => t.end()) // test end
})
const test = require('tap').test
const test = require('tape')
const Message = require('../src/message')
const Contact = require('../src/contact')
const Puppet = require('../src/puppet')
......@@ -81,7 +81,7 @@ test('Message ready() promise testing', t => {
t.equal(tc.get('name') , expectedToNickName , 'contact ready for ToNickName')
})
.catch(e => t.fail('m.ready() rejected: ' + e))
.then(t.end) // test end
.then(_ => t.end()) // test end
})
test('TBW: Message static method', t => {
......
const co = require('co')
const test = require('tap').test
const test = require('tape')
const Browser = require('../../src/puppet-web/browser')
const Bridge = require('../../src/puppet-web/bridge')
......
const co = require('co')
const test = require('tap').test
const test = require('tape')
const log = require('../../src/npmlog-env')
......@@ -167,7 +167,7 @@ test('Browser session save & load', function(t) {
})
.then(r => { // Finally
b.quit()
.then(t.end)
.then(_ => t.end())
})
.catch(e => { t.fail(e) }) // Exception
})
const co = require('co')
const util = require('util')
const test = require('tap').test
const test = require('tape')
const retryPromise = require('retry-promise').default
const log = require('../../src/npmlog-env')
......@@ -24,7 +24,8 @@ test('Puppet Web Event smoking test', function(t) {
})
.catch(e => t.fail(e)) // Reject
.then(r => { // Finally
pw.quit().then(t.end)
pw.quit()
.then(_ => t.end())
})
.catch(e => t.fail(e)) // Exception
})
const co = require('co')
const util = require('util')
const test = require('tap').test
const test = require('tape')
const retryPromise = require('retry-promise').default
const log = require('../../src/npmlog-env')
......@@ -61,7 +61,7 @@ false && test('PuppetWeb smoke testing', function(t) {
.then(r => { // Finally 1
// log.warn('TestPuppetWeb', 'finally()')
pw.quit()
.then(t.end)
.then(_ => t.end())
})
.catch(e => t.fail(e)) // Exception
})
......@@ -85,7 +85,7 @@ test('Puppet Web server/browser communication', function(t) {
})
.then(r => { // Finally
pw.quit()
.then(t.end)
.then(_ => t.end())
})
.catch(e => { t.fail(e) }) // Exception
......
const https = require('https')
const test = require('tap').test
const test = require('tape')
const co = require('co')
const log = require('../../src/npmlog-env')
......
const co = require('co')
const util = require('util')
const test = require('tap').test
const test = require('tape')
const retryPromise = require('retry-promise').default
const log = require('../../src/npmlog-env')
......@@ -59,7 +59,7 @@ test('Puppet Web watchdog timer', function(t) {
})
.then(() => { // Finally
pw.quit()
.then(t.end)
.then(_ => t.end())
})
return
......
const test = require('tap').test
const test = require('tape')
const Message = require('../src/message')
const Room = require('../src/room')
const Contact = require('../src/contact')
......@@ -39,7 +39,7 @@ test('Room smoke testing', t => {
t.equal(typeof s, 'string', 'toString()')
})
.catch(e => t.fail('ready() rejected: ' + e))
.then(t.end) // test end
.then(_ => t.end()) // test end
})
/*
const rawData = JSON.parse('{"MsgId":"1120003476579027592","FromUserName":"@@4aa0ae1e1ebc568b613fa43ce93b478df0339f73340d87083822c2016d2e53d9","ToUserName":"@94e4b0db79ccc844d7bb4a2b1efac3ff","MsgType":1,"Content":"@9ad4ba13fac52c55d323521b67f7cc39:<br/>[Strong]","Status":3,"ImgStatus":1,"CreateTime":1462889712,"VoiceLength":0,"PlayLength":0,"FileName":"","FileSize":"","MediaId":"","Url":"","AppMsgType":0,"StatusNotifyCode":0,"StatusNotifyUserName":"","RecommendInfo":{"UserName":"","NickName":"","QQNum":0,"Province":"","City":"","Content":"","Signature":"","Alias":"","Scene":0,"VerifyFlag":0,"AttrStatus":0,"Sex":0,"Ticket":"","OpCode":0},"ForwardFlag":0,"AppInfo":{"AppID":"","Type":0},"HasProductId":0,"Ticket":"","ImgHeight":0,"ImgWidth":0,"SubMsgType":0,"NewMsgId":1120003476579027600,"MMPeerUserName":"@@4aa0ae1e1ebc568b613fa43ce93b478df0339f73340d87083822c2016d2e53d9","MMDigest":"感恩的心 ","MMIsSend":false,"MMIsChatRoom":true,"MMUnread":false,"LocalID":"1120003476579027592","ClientMsgId":"1120003476579027592","MMActualContent":"HTML-CODE","MMActualSender":"@9ad4ba13fac52c55d323521b67f7cc39","MMDigestTime":"22:15","MMDisplayTime":1462889712,"MMTime":"22:15","_h":126,"_index":0,"_offsetTop":0,"$$hashKey":"0QK", "MemberList": [{"Uin":0,"UserName":"@94e4b0db79ccc844d7bb4a2b1efac3ff","NickName":"李卓桓","AttrStatus":37996631,"PYInitial":"","PYQuanPin":"","RemarkPYInitial":"","RemarkPYQuanPin":"","MemberStatus":0,"DisplayName":"北京阿布","KeyWord":"liz"},{"Uin":0,"UserName":"@34887973779b7dd827366a31772cd83df223e6f71d9a79e44fe619aafe2901a4","NickName":"Tiger","AttrStatus":4292711,"PYInitial":"","PYQuanPin":"","RemarkPYInitial":"","RemarkPYQuanPin":"","MemberStatus":0,"DisplayName":"DisplayNameTiger","KeyWord":"","HeadImgUrl":"/cgi-bin/mmwebwx-bin/webwxgeticon?seq=0&username=@34887973779b7dd827366a31772cd83df223e6f71d9a79e44fe619aafe2901a4&skey=@crypt_f9cec94b_8517b7f9fec85f5a78a804c4f45f5536&chatroomid=@7b3dcd218431d79045cda3493c3179ae"}]}')
......
'use strict'
const test = require('tap').test
const test = require('tape')
const log = require('../src/npmlog-env')
const webUtil = require('../src/web-util')
......
......@@ -2,7 +2,7 @@
const path = require('path')
const co = require('co')
const test = require('tap').test
const test = require('tape')
const log = require('../src/npmlog-env')
......@@ -38,7 +38,7 @@ test('WebDriver process create & quit test', function(t) {
t.equal(pids.length, 0, 'no driver process after quit')
})
.catch(e => { t.fail(e) })
.then(t.end.bind(t))
.then(_ => t.end())
return
})
......
const test = require('tap').test
const test = require('tape')
const log = require('../src/npmlog-env')
test('Wechaty Framework', function(t) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册