mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[mochaSetup] added notes to explain the purpose for the workarounds in place
This commit is contained in:
parent
680bf2102c
commit
7b15ee05d1
2 changed files with 12 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
|||
var wrap = require('lodash').wrap;
|
||||
var Mocha = require('mocha');
|
||||
|
||||
// work around simplemocha's lack of a "--require" option.
|
||||
// see https://github.com/yaymukund/grunt-simple-mocha/issues/50 for feature request.
|
||||
Mocha.prototype.run = wrap(Mocha.prototype.run, function (orig) {
|
||||
require('../../test/mocha_setup');
|
||||
orig.call(this);
|
||||
|
|
|
@ -3,6 +3,16 @@ var autoRelease = require('auto-release-sinon');
|
|||
|
||||
require('babel/register')(require('../src/optimize/babelOptions').node);
|
||||
|
||||
// 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.
|
||||
var queuedAfterEachArgs = [];
|
||||
Object.defineProperty(global, 'afterEach', {
|
||||
configurable: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue