
* Use mocha, chai & sinon from the npm. As of sinon 2.0 sinon-as-promised is no longer required so it is removed * Tweak code to re-use the same loader with the same environment throghout the code * Introduce browserify step for testing tools that only provide node-compatible libraries (sinon, chai-as-promised) * Introduce copy step for test data to resolve multiple issues with tests depending on files not being symlinks * Re-introduce custom implementation of setTimeout to resolve issues with few tests * Re-introduce custom Bluebird Promises config & monkey patch
29 lines
No EOL
690 B
JavaScript
29 lines
No EOL
690 B
JavaScript
'use strict';
|
|
|
|
var EXPORTED_SYMBOLS = ['Promise'];
|
|
|
|
var Promise = require('bluebird/promise')();
|
|
|
|
Promise.config({
|
|
warnings: true,
|
|
longStackTraces: true,
|
|
cancellation: true
|
|
});
|
|
|
|
// TEMP: Only turn on if debug logging enabled?
|
|
Promise.onPossiblyUnhandledRejection((e, promise) => {
|
|
if (e.name == 'ZoteroPromiseInterrupt' || e.handledRejection) {
|
|
return;
|
|
}
|
|
|
|
typeof Zotero !== 'undefined' && Zotero.debug('Possibly unhandled rejection:\n\n'
|
|
+ (e.message
|
|
? e.message + "\n\n" + e.stack.split(/\n/)
|
|
// Filter out internal Bluebird calls
|
|
.filter(line => !line.includes('bluebird'))
|
|
.join('\n')
|
|
: e), 1);
|
|
throw e;
|
|
});
|
|
|
|
module.exports = Promise; |