Skip to content

Commit

Permalink
trim down test harness, remove StackTraceMapper (#8146)
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger authored Oct 28, 2016
1 parent 908da97 commit adc95d0
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 218 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
},
"devDependencies": {
"@elastic/eslint-config-kibana": "0.0.3",
"Nonsense": "0.1.2",
"angular-mocks": "1.4.7",
"auto-release-sinon": "1.0.3",
"babel-eslint": "4.1.8",
Expand Down
34 changes: 0 additions & 34 deletions src/ui/public/stack_trace_mapper/set_error_stack.js

This file was deleted.

15 changes: 0 additions & 15 deletions src/ui/public/stack_trace_mapper/source_map_reader.js

This file was deleted.

19 changes: 0 additions & 19 deletions src/ui/public/stack_trace_mapper/stack_line_format.js

This file was deleted.

65 changes: 0 additions & 65 deletions src/ui/public/stack_trace_mapper/stack_trace_mapper.js

This file was deleted.

41 changes: 0 additions & 41 deletions src/ui/public/stack_trace_mapper/translate_stack_line.js

This file was deleted.

50 changes: 7 additions & 43 deletions src/ui/public/test_harness/test_harness.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,23 @@
/* global mocha */

// chrome expects to be loaded first, let it get its way
import chrome from 'ui/chrome';

import Nonsense from 'Nonsense';
import sinon from 'sinon';
import _ from 'lodash';
import Notifier from 'ui/notify/notifier';

import StackTraceMapper from 'ui/stack_trace_mapper';
import { parse } from 'url';
import $ from 'jquery';
import { setupAutoRelease } from 'auto-release-sinon';

import './test_harness.less';
import 'ng_mock';
import { setupTestSharding } from './test_sharding';

/*** the vislib tests have certain style requirements, so lets make sure they are met ***/
$('body').attr('id', 'test-harness-body'); // so we can make high priority selectors


/*** Setup seeded random ***/
let seedInput = parse(window.location.href, true).query.seed;
let seed = _.add(seedInput, 0) || Date.now();
Math.random = _.bindKey(new Nonsense(seed), 'frac');
Math.random.nonsense = new Nonsense(seed);
console.log('Random-ness seed: ' + seed);

// Setup auto releasing stubs and spys
setupAutoRelease(sinon, window.afterEach);
setupTestSharding();

/*** manually map error stack traces using the sourcemap ***/
before(function () {
// before the tests start, load the sourcemap and hook into error generation for the mocha reporter
this.timeout(30000);
// allows test_harness.less to have higher priority selectors
document.body.setAttribute('id', 'test-harness-body');

let mapper;
let Runner = window.Mocha.Runner;

Runner.prototype.emit = _.wrap(Runner.prototype.emit, function (emit, event, test, err) {
if (err && mapper) err = mapper.mapError(err);
return emit.call(this, event, test, err);
});

return StackTraceMapper.getInstance({
'/bundles/tests.bundle.js': '/bundles/tests.bundle.js.map'
}).then(function (instance) {
mapper = instance;
});
});


before(function () {
// prevent accidental ajax requests
before(() => {
sinon.useFakeXMLHttpRequest();
});

Expand All @@ -63,8 +28,7 @@ beforeEach(function () {
}
});


/*** Kick off mocha, called at the end of test entry files ***/
exports.bootstrap = function () {
// Kick off mocha, called at the end of test entry files
exports.bootstrap = () => {
chrome.setupAngular();
};

0 comments on commit adc95d0

Please sign in to comment.