aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-03-31 05:49:39 +0800
committerkumavis <aaron@kumavis.me>2017-03-31 05:49:39 +0800
commit8ae37ae80de38728c8c878ab24249450a570e97a (patch)
tree16bcab448be5579f0709050fbdebe0548e126e87 /test
parente95ae43c8f0e40742540844984861a06f26999c6 (diff)
downloadtangerine-wallet-browser-8ae37ae80de38728c8c878ab24249450a570e97a.tar
tangerine-wallet-browser-8ae37ae80de38728c8c878ab24249450a570e97a.tar.gz
tangerine-wallet-browser-8ae37ae80de38728c8c878ab24249450a570e97a.tar.bz2
tangerine-wallet-browser-8ae37ae80de38728c8c878ab24249450a570e97a.tar.lz
tangerine-wallet-browser-8ae37ae80de38728c8c878ab24249450a570e97a.tar.xz
tangerine-wallet-browser-8ae37ae80de38728c8c878ab24249450a570e97a.tar.zst
tangerine-wallet-browser-8ae37ae80de38728c8c878ab24249450a570e97a.zip
tests - helper - add note
Diffstat (limited to 'test')
-rw-r--r--test/helper.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/test/helper.js b/test/helper.js
index dd22d80b4..aaac7580e 100644
--- a/test/helper.js
+++ b/test/helper.js
@@ -26,27 +26,29 @@ function enableFailureOnUnhandledPromiseRejection() {
// overwrite node's promise with the stricter Bluebird promise
global.Promise = require('bluebird')
+ // modified from https://github.com/mochajs/mocha/issues/1926#issuecomment-180842722
+
// rethrow unhandledRejections
if (typeof process !== 'undefined') {
process.on('unhandledRejection', function (reason) {
- throw reason;
- });
+ throw reason
+ })
} else if (typeof window !== 'undefined') {
// 2016-02-01: No browsers support this natively, however bluebird, when.js,
// and probably other libraries do.
if (typeof window.addEventListener === 'function') {
window.addEventListener('unhandledrejection', function (evt) {
- throw evt.detail.reason;
- });
+ throw evt.detail.reason
+ })
} else {
- var oldOHR = window.onunhandledrejection;
+ var oldOHR = window.onunhandledrejection
window.onunhandledrejection = function (evt) {
- if (typeof oldOHR === 'function') oldOHR.apply(this, arguments);
- throw evt.detail.reason;
- };
+ if (typeof oldOHR === 'function') oldOHR.apply(this, arguments)
+ throw evt.detail.reason
+ }
}
} else if (typeof console !== 'undefined' &&
typeof (console.error || console.log) === 'function') {
- (console.error || console.log)('Unhandled rejections will be ignored!');
+ (console.error || console.log)('Unhandled rejections will be ignored!')
}
} \ No newline at end of file