Skip to content

Commit

Permalink
switched to ololog/reporter for Mocha tests (for nice logging and sup…
Browse files Browse the repository at this point in the history
…ression of log output for nonfailed/non-.only tests)
  • Loading branch information
xpl committed Dec 5, 2017
1 parent bc5ea09 commit ab08593
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions js/base/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ const jwt = (request, secret, alg = 'HS256', hash = 'sha256') => {

module.exports = {

setTimeout_safe,

// common utility functions

sleep,
Expand Down
7 changes: 4 additions & 3 deletions js/test/test_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ describe ('ccxt base code', () => {
const start = Date.now ()
const calls = []

global.setTimeout = (done, ms) => { // simulates a defect setTimeout implementation that sleeps less than we asked
global.setTimeout = (done, ms) => { // simulates a defect setTimeout implementation that sleeps wrong time (100ms always in this test)
calls.push ({ when: Date.now () - start, ms_asked: ms })
setTimeout_impl (done, ms - 100)
setTimeout_impl (done, 100)
}

// ask to sleep 250ms
ccxt.setTimeout_safe (() => {
const end = Date.now () - start
console.log (calls)
log (calls)
global.setTimeout = setTimeout_impl
done ()
}, 250)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build": "npm run export-exchanges && npm run vss && npm run pandoc-python-readme && npm run pandoc-doc-readme && npm run pandoc-doc-manual && npm run pandoc-doc-install && npm run pandoc-doc-exchanges && npm run pandoc-doc-exchanges-by-country && npm run transpile && npm run update-badges && npm run browserify",
"test": "npm run build && node run-tests",
"fast-test": "node run-tests --js",
"test-base": "mocha --reporter spec js/test/test_base.js",
"test-base": "mocha --reporter ololog/reporter js/test/test_base.js",
"export-exchanges": "node export-exchanges",
"update-badges": "node update-badges",
"convert-md-2-rst": "bash ./convert-md-2-rst",
Expand Down

0 comments on commit ab08593

Please sign in to comment.