From 7b006a1092510897d0517f5e30b888a555c595d3 Mon Sep 17 00:00:00 2001 From: Aaron Imming Date: Thu, 25 Jul 2019 13:16:22 +0800 Subject: [PATCH 1/3] Double jest timeout for bot --- .jest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jest b/.jest index 35ec7d7a44..9c8e79be57 100644 --- a/.jest +++ b/.jest @@ -1,3 +1,3 @@ -jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000 +jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000 process.on('unhandledRejection', e => console.log(e)) From 81a73dd17220c7963c7ff9168c3c487c8444f9af Mon Sep 17 00:00:00 2001 From: Aaron Imming Date: Thu, 25 Jul 2019 13:17:35 +0800 Subject: [PATCH 2/3] Only subscribe to balance in browser --- src/botPage/bot/TradeEngine/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/botPage/bot/TradeEngine/index.js b/src/botPage/bot/TradeEngine/index.js index 8ad3f62180..f93ffbd8ce 100644 --- a/src/botPage/bot/TradeEngine/index.js +++ b/src/botPage/bot/TradeEngine/index.js @@ -115,10 +115,16 @@ export default class TradeEngine extends Balance(Purchase(Sell(OpenContract(Prop this.listen('authorize', ({ authorize }) => { this.accountInfo = authorize; this.token = token; - this.api.subscribeToBalance().then(r => { - this.balance = Number(r.balance.balance); + + // Only subscribe to balance in browser, not for tests. + if (document) { + this.api.subscribeToBalance().then(r => { + this.balance = Number(r.balance.balance); + resolve(); + }); + } else { resolve(); - }); + } }) ); } From 0ee3cef9792db794b1bb3e76ede95f9a55b7a52d Mon Sep 17 00:00:00 2001 From: Aaron Imming Date: Thu, 25 Jul 2019 13:18:20 +0800 Subject: [PATCH 3/3] Reduce amount of jest workers to 1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aa9f7a5dc1..42cdfb3bcb 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "scripts": { "start": "gulp watch", - "test": "eslint src/ && jest -w 10 --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", + "test": "eslint src/ && jest -w 1 --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", "release": "d() { test -z $1 && echo 'Please specify branch.' && exit 1; (git show-branch $1) || exit 1; git stash; git checkout $1; npm i; rm -rf branch/$1; mkdir -p branch/$1 ; gulp build-min; cp -r www/ branch/$1; gulp release-branch --branch $1;}; d", "release-production": "d() { git stash; git checkout master; npm i;gulp build-min;gulp release-master;}; d", "build": "webpack --config webpack.config.cli.js"