mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[mocha] setup auto-release-sinon for server tests
This commit is contained in:
parent
c87aec3dae
commit
680bf2102c
1 changed files with 30 additions and 0 deletions
|
@ -1 +1,31 @@
|
|||
var sinon = require('sinon');
|
||||
var autoRelease = require('auto-release-sinon');
|
||||
|
||||
require('babel/register')(require('../src/optimize/babelOptions').node);
|
||||
|
||||
var 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);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue