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

View file

@ -24,23 +24,9 @@
*/
EXPORTED_SYMBOLS = ["ConcurrentCaller"];
Components.utils.import('resource://zotero/require.js');
var require = (target) => {
var { Loader, Require, Module } = Components.utils.import('resource://gre/modules/commonjs/toolkit/loader.js');
var requirer = Module('/', '/');
var globals = {};
Components.utils.import("resource://gre/modules/Timer.jsm", globals);
var loader = Loader({
id: 'zotero/requireminimal',
globals
});
return (Require(loader, requirer))(target);
};
var Promise = require('resource://zotero/bluebird/bluebird.js');
var Promise = require('resource://zotero/bluebird.js');
/**
* Call a fixed number of functions at once, queueing the rest until slots