mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
* [npm] upgrade babel The upgrade to babel 6 requires an upgrade to all of the associated modules, which meant that a few other things changed at the same time. The most notable is the way that we handle our babel-options, which is now done with an npm module and includes using the babel-loader's "presets" query string param. This meant changes to the babel_options.js module and extending it to help setting up the "babel-register" module, which was previously copy-pasted in several places. * [mtodules] upgrade to support babel6 module semantics * [eslint] fix lint errors * [babel] ignoer massive fixture files * [cli/errors] use Object.setPrototypeOf since subclassing Error is broken * [babel] Upgrading core babel libraries [babel] Use WIP babel-6-fix branch of babel-preset-kibana * Fix broken test * [babel] Reverse unnecessary module.exports changes * Fix notifier * Use babel presets and plugins directly * [babel/options] resolve preset/plugins paths for better plugin compatibility * [babel/options] use babel-preset-env for correct node settings * [babel] cache babel compilation in webpack like we thought we were
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
const sinon = require('sinon');
|
|
const autoRelease = require('auto-release-sinon');
|
|
|
|
require('../src/optimize/babel/register');
|
|
|
|
// hook into the global afterEach variable to allow autoReleaseSinon to register
|
|
// an afterEach handler before mocha has exposed itself to the test files.
|
|
//
|
|
// This works by telling autoReleaseSinon to use a fake "afterEach" function.
|
|
// Rather than actually record an afterEach handler the function tracks all of
|
|
// the calls it received and queues them up in queuedAfterEachArgs.
|
|
//
|
|
// The global "afterEach" variable is also tracked, and once it is assigned by mocha
|
|
// the variable global is reconfigured to point directly to the new value (from mocha)
|
|
// and all of the queued invocations are executed.
|
|
const queuedAfterEachArgs = [];
|
|
Object.defineProperty(global, 'afterEach', {
|
|
configurable: true,
|
|
get() { return undefined; },
|
|
set(afterEach) {
|
|
Object.defineProperty(global, 'afterEach', {
|
|
configurable: true,
|
|
writable: true,
|
|
value: afterEach
|
|
});
|
|
|
|
queuedAfterEachArgs.forEach(function (args) {
|
|
afterEach.apply(null, args);
|
|
});
|
|
|
|
return global.afterEach;
|
|
}
|
|
});
|
|
|
|
autoRelease.setupAutoRelease(sinon, function () {
|
|
if (!global.afterEach) {
|
|
queuedAfterEachArgs.push(Array.prototype.slice.call(arguments));
|
|
} else {
|
|
global.afterEach.apply(this, arguments);
|
|
}
|
|
});
|