File tree Expand file tree Collapse file tree 3 files changed +5
-27
lines changed Expand file tree Collapse file tree 3 files changed +5
-27
lines changed Original file line number Diff line number Diff line change @@ -6,18 +6,6 @@ import config from '../config'
66
77const hasConsole = typeof console !== 'undefined'
88
9- /**
10- * Log a message.
11- *
12- * @param {String } msg
13- */
14-
15- export function log ( msg ) {
16- if ( hasConsole && config . debug ) {
17- console . log ( '[Vue info]: ' + msg )
18- }
19- }
20-
219/**
2210 * We've got a problem here.
2311 *
@@ -29,7 +17,11 @@ export function warn (msg, e) {
2917 console . warn ( '[Vue warn]: ' + msg )
3018 /* istanbul ignore if */
3119 if ( config . debug ) {
32- console . warn ( ( e || new Error ( 'Warning Stack Trace' ) ) . stack )
20+ if ( e ) {
21+ throw e
22+ } else {
23+ console . warn ( ( new Error ( 'Warning Stack Trace' ) ) . stack )
24+ }
3325 }
3426 }
3527}
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ describe('el', function () {
77 beforeEach ( function ( ) {
88 el = document . createElement ( 'div' )
99 spyWarns ( )
10- spyOn ( _ , 'log' )
1110 } )
1211
1312 it ( 'normal' , function ( done ) {
Original file line number Diff line number Diff line change 11var _ = require ( '../../../../src/util' )
22var config = require ( '../../../../src/config' )
3- var infoPrefix = '[Vue info]: '
43var warnPrefix = '[Vue warn]: '
54
65if ( typeof console !== 'undefined' ) {
@@ -15,18 +14,6 @@ if (typeof console !== 'undefined') {
1514 }
1615 } )
1716
18- it ( 'log when debug is true' , function ( ) {
19- config . debug = true
20- _ . log ( 'hello' )
21- expect ( console . log ) . toHaveBeenCalledWith ( infoPrefix + 'hello' )
22- } )
23-
24- it ( 'not log when debug is false' , function ( ) {
25- config . debug = false
26- _ . log ( 'bye' )
27- expect ( console . log ) . not . toHaveBeenCalled ( )
28- } )
29-
3017 it ( 'warn when silent is false' , function ( ) {
3118 config . silent = false
3219 _ . warn ( 'oops' )
You can’t perform that action at this time.
0 commit comments