(callback, timeout)
| 25 | process.exit(255) |
| 26 | }) |
| 27 | const expect = function (callback, timeout) { |
| 28 | const executed = false |
| 29 | timeout = timeout || parseInt(process.env.TEST_TIMEOUT) || 5000 |
| 30 | const id = setTimeout(function () { |
| 31 | assert.ok( |
| 32 | executed, |
| 33 | 'Expected execution of function to be fired within ' + |
| 34 | timeout + |
| 35 | ' milliseconds ' + |
| 36 | ' (hint: export TEST_TIMEOUT=<timeout in milliseconds>' + |
| 37 | ' to change timeout globally)' + |
| 38 | callback.toString() |
| 39 | ) |
| 40 | }, timeout) |
| 41 | |
| 42 | if (callback.length < 3) { |
| 43 | return function (err, queryResult) { |
| 44 | clearTimeout(id) |
| 45 | if (err) { |
| 46 | assert.ok(err instanceof Error, 'Expected errors to be instances of Error: ' + sys.inspect(err)) |
| 47 | } |
| 48 | callback.apply(this, arguments) |
| 49 | } |
| 50 | } else if (callback.length == 3) { |
| 51 | return function (err, arg1, arg2) { |
| 52 | clearTimeout(id) |
| 53 | if (err) { |
| 54 | assert.ok(err instanceof Error, 'Expected errors to be instances of Error: ' + sys.inspect(err)) |
| 55 | } |
| 56 | callback.apply(this, arguments) |
| 57 | } |
| 58 | } else { |
| 59 | throw new Error('Unsupported arrity ' + callback.length) |
| 60 | } |
| 61 | } |
| 62 | // print out the filename |
| 63 | process.stdout.write(require('path').basename(process.argv[1])) |
| 64 | if (isNativeMode) process.stdout.write(' (native)') |
no outgoing calls
no test coverage detected