From 2b7a0e45d233515435de56193e1042a0a6b07996 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 6 Dec 2017 20:54:11 -0600 Subject: WIP: debugging typeerrors --- .../javascripts/notes/components/issue_note.vue | 4 ++-- config/karma.config.js | 2 ++ .../notes/components/issue_note_app_spec.js | 4 ++-- spec/javascripts/test_bundle.js | 20 ++++++++++++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/notes/components/issue_note.vue b/app/assets/javascripts/notes/components/issue_note.vue index 8c81c5d6df3..0b0fce5f934 100644 --- a/app/assets/javascripts/notes/components/issue_note.vue +++ b/app/assets/javascripts/notes/components/issue_note.vue @@ -122,9 +122,9 @@ // we need to do this to prevent noteForm inconsistent content warning // this is something we intentionally do so we need to recover the content this.note.note = noteText; - if (this.$refs.noteBody) { + //if (this.$refs.noteBody) { this.$refs.noteBody.$refs.noteForm.note = noteText; // TODO: This could be better - } + //} }, }, created() { diff --git a/config/karma.config.js b/config/karma.config.js index 9f018d14b8f..38641459bfa 100644 --- a/config/karma.config.js +++ b/config/karma.config.js @@ -3,6 +3,8 @@ var webpack = require('webpack'); var webpackConfig = require('./webpack.config.js'); var ROOT_PATH = path.resolve(__dirname, '..'); +console.log('now in karma.config.js'); + // remove problematic plugins if (webpackConfig.plugins) { webpackConfig.plugins = webpackConfig.plugins.filter(function (plugin) { diff --git a/spec/javascripts/notes/components/issue_note_app_spec.js b/spec/javascripts/notes/components/issue_note_app_spec.js index 8e43037f356..b6e88452dd8 100644 --- a/spec/javascripts/notes/components/issue_note_app_spec.js +++ b/spec/javascripts/notes/components/issue_note_app_spec.js @@ -3,7 +3,7 @@ import issueNotesApp from '~/notes/components/issue_notes_app.vue'; import service from '~/notes/services/notes_service'; import * as mockData from '../mock_data'; -describe('issue_note_app', () => { +fdescribe('issue_note_app', () => { let mountComponent; let vm; @@ -183,7 +183,7 @@ describe('issue_note_app', () => { }, 0); }); - it('updates the note and resets the edit form', (done) => { + fit('updates the note and resets the edit form', (done) => { setTimeout(() => { vm.$el.querySelector('.js-note-edit').click(); Vue.nextTick(() => { diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js index fd7aa332d17..609b238cdde 100644 --- a/spec/javascripts/test_bundle.js +++ b/spec/javascripts/test_bundle.js @@ -11,11 +11,16 @@ const isHeadlessChrome = /\bHeadlessChrome\//.test(navigator.userAgent); Vue.config.devtools = !isHeadlessChrome; Vue.config.productionTip = false; +const nonce = 9999 * Math.random(); +console.log('test_bundle.js', nonce, isHeadlessChrome, new Error().stack); + let hasVueWarnings = false; +/* * / Vue.config.warnHandler = (msg, vm, trace) => { hasVueWarnings = true; fail(`${msg}${trace}`); }; +/* */ Vue.use(VueResource); @@ -40,6 +45,21 @@ window.addEventListener('unhandledrejection', (event) => { console.error(event.reason.stack || event.reason); }); +beforeAll(() => { + /* */ + const origError = console.error; + spyOn(console, 'error').and.callFake((message) => { + console.log(`console error message ${nonce} |||${message}|||`, new Error().stack); + if (/^\[Vue warn\]/.test(message)) { + console.log('we found a Vue warn!!!'); + //fail(message); + } else { + origError(message); + } + }); + /* */ +}); + // HACK: Chrome 59 disconnects if there are too many synchronous tests in a row // because it appears to lock up the thread that communicates to Karma's socket // This async beforeEach gets called on every spec and releases the JS thread long -- cgit v1.2.1