summaryrefslogtreecommitdiff
path: root/spec/javascripts/test_bundle.js
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2017-06-20 08:05:55 +0000
committerPhil Hughes <me@iamphill.com>2017-06-20 08:05:55 +0000
commit2955e956044efda161ae6df8c97613357c657410 (patch)
tree49a28525a7b0da32137d034554871c2e9af41e10 /spec/javascripts/test_bundle.js
parent50d4050d7e14d6c89132c7c3844f4fe6bab708cd (diff)
downloadgitlab-ce-2955e956044efda161ae6df8c97613357c657410.tar.gz
Clean up Vue warnings in tests
Diffstat (limited to 'spec/javascripts/test_bundle.js')
-rw-r--r--spec/javascripts/test_bundle.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js
index 729db02e06c..f0d51bd0902 100644
--- a/spec/javascripts/test_bundle.js
+++ b/spec/javascripts/test_bundle.js
@@ -1,8 +1,14 @@
+/* eslint-disable jasmine/no-global-setup */
import $ from 'jquery';
import _ from 'underscore';
import 'jasmine-jquery';
import '~/commons';
+import Vue from 'vue';
+import VueResource from 'vue-resource';
+
+Vue.use(VueResource);
+
// enable test fixtures
jasmine.getFixtures().fixturesPath = '/base/spec/javascripts/fixtures';
jasmine.getJSONFixtures().fixturesPath = '/base/spec/javascripts/fixtures';
@@ -22,7 +28,25 @@ window.gon = window.gon || {};
// enough for the socket to continue to communicate.
// The downside is that it creates a minor performance penalty in the time it takes
// to run our unit tests.
-beforeEach(done => done()); // eslint-disable-line jasmine/no-global-setup
+beforeEach(done => done());
+
+beforeAll(() => {
+ const origError = console.error;
+ spyOn(console, 'error').and.callFake((message) => {
+ if (/^\[Vue warn\]/.test(message)) {
+ fail(message);
+ } else {
+ origError(message);
+ }
+ });
+});
+
+const builtinVueHttpInterceptors = Vue.http.interceptors.slice();
+
+beforeEach(() => {
+ // restore interceptors so we have no remaining ones from previous tests
+ Vue.http.interceptors = builtinVueHttpInterceptors.slice();
+});
// render all of our tests
const testsContext = require.context('.', true, /_spec$/);