mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
grunt-mocha integration
This commit is contained in:
parent
1b308bf86b
commit
4579019ec1
2 changed files with 53 additions and 57 deletions
|
@ -54,15 +54,19 @@
|
|||
urlArgs: COVERAGE ? 'instrument=true' : void 0
|
||||
});
|
||||
|
||||
mocha.setup({
|
||||
ui: 'bdd',
|
||||
timeout: 5000,
|
||||
reporter: 'html'
|
||||
});
|
||||
|
||||
function setupMocha() {
|
||||
require(['lodash'], function (_) {
|
||||
require(['lodash', 'jquery'], function (_, $) {
|
||||
$(function () {
|
||||
|
||||
mocha.ui = _.wrap(mocha.ui, function (mochaUi, ui) {
|
||||
var ret = mochaUi.call(this, ui);
|
||||
|
||||
var oldDescribe = window.describe;
|
||||
window.describe = _.wrap(oldDescribe, unwindDescribeArrays);
|
||||
window.describe.only = _.wrap(oldDescribe.only, unwindDescribeArrays);
|
||||
var _desc = window.describe;
|
||||
window.describe = _.wrap(_desc, unwindDescribeArrays);
|
||||
window.describe.only = _.wrap(_desc.only, unwindDescribeArrays);
|
||||
function unwindDescribeArrays(fn, name, body) {
|
||||
if (!body && name && name instanceof Array) {
|
||||
body = name[1]; name = name[0];
|
||||
|
@ -71,18 +75,9 @@
|
|||
return fn.call(this, name, body);
|
||||
}
|
||||
|
||||
return ret;
|
||||
});
|
||||
|
||||
mocha.setup({
|
||||
ui: 'bdd',
|
||||
timeout: 5000,
|
||||
reporter: 'html'
|
||||
});
|
||||
|
||||
if (COVERAGE) setupCoverage(runTests);
|
||||
else runTests();
|
||||
|
||||
if (COVERAGE) setupCoverage(runTests);
|
||||
else runTests();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue