Fixes and tweaks to make tests work with babelized code

* 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
This commit is contained in:
Tom Najdek 2017-05-31 16:28:47 +01:00 committed by Dan Stillman
parent 748c30206f
commit 14bf3184bb
17 changed files with 150 additions and 6781 deletions

25
resource/require.js Normal file
View file

@ -0,0 +1,25 @@
'use strict';
var EXPORTED_SYMBOLS = ['require'];
var require = (function() {
var { Loader, Require, Module } = Components.utils.import('resource://gre/modules/commonjs/toolkit/loader.js');
var requirer = Module('/', '/');
var _runningTimers = {};
var loader = Loader({
id: 'zotero/require',
paths: {
'': 'resource://zotero/',
},
globals: {
document: typeof document !== 'undefined' && document || {},
console: typeof console !== 'undefined' && console || {},
navigator: typeof navigator !== 'undefined' && navigator || {},
window,
Zotero: typeof Zotero !== 'undefined' && Zotero || {}
}
});
return Require(loader, requirer);
})();