File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ if (typeof console === 'undefined') {
55 }
66}
77
8+ let asserted
89function hasWarned ( msg ) {
910 var count = console . error . calls . count ( )
1011 var args
@@ -23,11 +24,13 @@ function hasWarned (msg) {
2324
2425// define custom matcher for warnings
2526beforeEach ( ( ) => {
27+ asserted = [ ]
2628 spyOn ( console , 'error' )
2729 jasmine . addMatchers ( {
2830 toHaveBeenWarned : ( ) => {
2931 return {
3032 compare : msg => {
33+ asserted = asserted . concat ( msg )
3134 var warned = Array . isArray ( msg )
3235 ? msg . some ( hasWarned )
3336 : hasWarned ( msg )
@@ -42,3 +45,17 @@ beforeEach(() => {
4245 }
4346 } )
4447} )
48+
49+ afterEach ( done => {
50+ const warned = msg => asserted . some ( assertedMsg => msg . indexOf ( assertedMsg ) > - 1 )
51+ let count = console . error . calls . count ( )
52+ let args
53+ while ( count -- ) {
54+ args = console . error . calls . argsFor ( count )
55+ if ( ! warned ( args [ 0 ] ) ) {
56+ done . fail ( `Unexpected console.error message: ${ args [ 0 ] } ` )
57+ return
58+ }
59+ }
60+ done ( )
61+ } )
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ window.waitForUpdate = initialCb => {
4040
4141 Vue . nextTick ( ( ) => {
4242 if ( ! queue . length || ! queue [ queue . length - 1 ] . fail ) {
43- console . warn ( 'waitForUpdate chain is missing .then(done)' )
43+ throw new Error ( 'waitForUpdate chain is missing .then(done)' )
4444 }
4545 shift ( )
4646 } )
You can’t perform that action at this time.
0 commit comments