Commit c1fac478 authored by Eric Eastwood's avatar Eric Eastwood

Add Vue errorHandlor to remove rogue logged TypeErrors

See https://gitlab.com/gitlab-org/gitlab-ce/issues/37619#note_50422859
parent 7fabc892
...@@ -17,6 +17,12 @@ Vue.config.warnHandler = (msg, vm, trace) => { ...@@ -17,6 +17,12 @@ Vue.config.warnHandler = (msg, vm, trace) => {
fail(`${msg}${trace}`); fail(`${msg}${trace}`);
}; };
let hasVueErrors = false;
Vue.config.errorHandler = function (err) {
hasVueErrors = true;
fail(err);
};
Vue.use(VueResource); Vue.use(VueResource);
// enable test fixtures // enable test fixtures
...@@ -72,7 +78,7 @@ testsContext.keys().forEach(function (path) { ...@@ -72,7 +78,7 @@ testsContext.keys().forEach(function (path) {
describe('test errors', () => { describe('test errors', () => {
beforeAll((done) => { beforeAll((done) => {
if (hasUnhandledPromiseRejections || hasVueWarnings) { if (hasUnhandledPromiseRejections || hasVueWarnings || hasVueErrors) {
setTimeout(done, 1000); setTimeout(done, 1000);
} else { } else {
done(); done();
...@@ -86,6 +92,10 @@ describe('test errors', () => { ...@@ -86,6 +92,10 @@ describe('test errors', () => {
it('has no Vue warnings', () => { it('has no Vue warnings', () => {
expect(hasVueWarnings).toBe(false); expect(hasVueWarnings).toBe(false);
}); });
it('has no Vue error', () => {
expect(hasVueErrors).toBe(false);
});
}); });
// if we're generating coverage reports, make sure to include all files so // if we're generating coverage reports, make sure to include all files so
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment