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

debug ci

上级 f6c0df9d
...@@ -4,11 +4,12 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key ...@@ -4,11 +4,12 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key
&& sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
RUN apt-get update -q && apt-get install -qy \ RUN apt-get update -q && apt-get install -qy \
apt-utils \ apt-utils \
chromium \ chromium \
google-chrome-stable \ google-chrome-stable \
vim \ vim \
xvfb xvfb \
&& rm -rf /tmp/*
WORKDIR /wechaty WORKDIR /wechaty
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
"posttest": "npm run clean && npm run sloc", "posttest": "npm run clean && npm run sloc",
"test:phantomjs": "cross-env LC_ALL=C WECHATY_LOG=info WECHATY_HEAD=phantomjs ava --timeout=10m \"dist/test/*.spec.js\"", "test:phantomjs": "cross-env LC_ALL=C WECHATY_LOG=info WECHATY_HEAD=phantomjs ava --timeout=10m \"dist/test/*.spec.js\"",
"test:phantomjs.bak": "cross-env LC_ALL=C WECHATY_LOG=info WECHATY_HEAD=phantomjs ava --timeout=10m \"dist/{src,test}/**/*.spec.js\"", "test:phantomjs.bak": "cross-env LC_ALL=C WECHATY_LOG=info WECHATY_HEAD=phantomjs ava --timeout=10m \"dist/{src,test}/**/*.spec.js\"",
"test:chrome": "cross-env LC_ALL=C WECHATY_LOG=info WECHATY_HEAD=chrome ava --concurrency 5 --ext js --timeout=10m \"dist/{src,test}/**/*.spec.js\"", "test:chrome": "cross-env LC_ALL=C WECHATY_LOG=info WECHATY_HEAD=chrome ava --concurrency 2 --ext js --timeout=10m \"dist/{src,test}/**/*.spec.js\"",
"testdev": "cross-env LC_ALL=C WECHATY_LOG=silly ava --ext ts --serial --verbose --fail-fast --timeout=3m", "testdev": "cross-env LC_ALL=C WECHATY_LOG=silly ava --ext ts --serial --verbose --fail-fast --timeout=3m",
"testdist": "WECHATY_HEAD=phantomjs ava --ext ts --verbose --fail-fast --timeout=3m", "testdist": "WECHATY_HEAD=phantomjs ava --ext ts --verbose --fail-fast --timeout=3m",
"ava": "cross-env LC_ALL=C WECHATY_LOG=verbose ts-node node_modules/.bin/ava \"{src,test}/**/*.spec.js\"", "ava": "cross-env LC_ALL=C WECHATY_LOG=verbose ts-node node_modules/.bin/ava \"{src,test}/**/*.spec.js\"",
......
...@@ -373,7 +373,7 @@ export class Browser extends EventEmitter { ...@@ -373,7 +373,7 @@ export class Browser extends EventEmitter {
this.emit('dead', msg) this.emit('dead', msg)
} else { } else {
log.warn('PuppetWebBrowser', 'dead() wil not emit `dead` event because %s' log.warn('PuppetWebBrowser', 'dead() wil not emit `dead` event because %s'
, 'state is not both `open` or state is inprocess()' , 'state is not `stable open`'
) )
} }
} }
......
...@@ -54,7 +54,6 @@ export class Wechaty extends EventEmitter implements Sayable { ...@@ -54,7 +54,6 @@ export class Wechaty extends EventEmitter implements Sayable {
public puppet: Puppet | null public puppet: Puppet | null
// private inited: boolean = false
private state = new StateMonitor<'standby', 'ready'>('Wechaty', 'standby') private state = new StateMonitor<'standby', 'ready'>('Wechaty', 'standby')
private npmVersion: string private npmVersion: string
...@@ -62,7 +61,7 @@ export class Wechaty extends EventEmitter implements Sayable { ...@@ -62,7 +61,7 @@ export class Wechaty extends EventEmitter implements Sayable {
public static instance(setting?: WechatySetting) { public static instance(setting?: WechatySetting) {
if (setting && this._instance) { if (setting && this._instance) {
throw new Error('there has already a instance. no params allowed any more') throw new Error('there has already a instance. no params will be allowed any more')
} }
if (!this._instance) { if (!this._instance) {
this._instance = new Wechaty(setting) this._instance = new Wechaty(setting)
...@@ -89,10 +88,6 @@ export class Wechaty extends EventEmitter implements Sayable { ...@@ -89,10 +88,6 @@ export class Wechaty extends EventEmitter implements Sayable {
this.npmVersion = require('../package.json').version this.npmVersion = require('../package.json').version
this.uuid = UtilLib.guid() this.uuid = UtilLib.guid()
// this.inited = false
// Wechaty._instance = this
} }
public toString() { return 'Class Wechaty(' + this.setting.type + ')'} public toString() { return 'Class Wechaty(' + this.setting.type + ')'}
...@@ -113,6 +108,7 @@ export class Wechaty extends EventEmitter implements Sayable { ...@@ -113,6 +108,7 @@ export class Wechaty extends EventEmitter implements Sayable {
const ss = require('child_process') const ss = require('child_process')
.spawnSync(gitLogCmd, gitLogArgs, { cwd: __dirname }) .spawnSync(gitLogCmd, gitLogArgs, { cwd: __dirname })
if (ss.status !== 0) { if (ss.status !== 0) {
throw new Error(ss.error) throw new Error(ss.error)
} }
...@@ -121,6 +117,7 @@ export class Wechaty extends EventEmitter implements Sayable { ...@@ -121,6 +117,7 @@ export class Wechaty extends EventEmitter implements Sayable {
.toString() .toString()
.trim() .trim()
return `#git[${revision}]` return `#git[${revision}]`
} catch (e) { /* fall safe */ } catch (e) { /* fall safe */
/** /**
* 1. .git not exist * 1. .git not exist
...@@ -208,16 +205,21 @@ export class Wechaty extends EventEmitter implements Sayable { ...@@ -208,16 +205,21 @@ export class Wechaty extends EventEmitter implements Sayable {
public async initPuppet(): Promise<Puppet> { public async initPuppet(): Promise<Puppet> {
let puppet: Puppet let puppet: Puppet
if (!this.setting.head) {
throw new Error('no head')
}
switch (this.setting.type) { switch (this.setting.type) {
case 'web': case 'web':
puppet = new PuppetWeb({ puppet = new PuppetWeb({
head: <HeadName>this.setting.head head: this.setting.head
, profile: this.setting.profile , profile: this.setting.profile
}) })
break break
default: default:
throw new Error('Puppet unsupport(yet): ' + this.setting.type) throw new Error('Puppet unsupport(yet?): ' + this.setting.type)
} }
const eventList: WechatyEventName[] = [ const eventList: WechatyEventName[] = [
...@@ -250,7 +252,7 @@ export class Wechaty extends EventEmitter implements Sayable { ...@@ -250,7 +252,7 @@ export class Wechaty extends EventEmitter implements Sayable {
*/ */
// set puppet before init, because we need this.puppet if we quit() before init() finish // set puppet before init, because we need this.puppet if we quit() before init() finish
this.puppet = puppet this.puppet = <Puppet>puppet // force to use base class Puppet interface for better encapsolation
// set puppet instance to Wechaty Static variable, for using by Contact/Room/Message/FriendRequest etc. // set puppet instance to Wechaty Static variable, for using by Contact/Room/Message/FriendRequest etc.
Config.puppetInstance(puppet) Config.puppetInstance(puppet)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册