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'
6
6
7
7
const hasConsole = typeof console !== 'undefined'
8
8
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
-
21
9
/**
22
10
* We've got a problem here.
23
11
*
@@ -29,7 +17,11 @@ export function warn (msg, e) {
29
17
console . warn ( '[Vue warn]: ' + msg )
30
18
/* istanbul ignore if */
31
19
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
+ }
33
25
}
34
26
}
35
27
}
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ describe('el', function () {
7
7
beforeEach ( function ( ) {
8
8
el = document . createElement ( 'div' )
9
9
spyWarns ( )
10
- spyOn ( _ , 'log' )
11
10
} )
12
11
13
12
it ( 'normal' , function ( done ) {
Original file line number Diff line number Diff line change 1
1
var _ = require ( '../../../../src/util' )
2
2
var config = require ( '../../../../src/config' )
3
- var infoPrefix = '[Vue info]: '
4
3
var warnPrefix = '[Vue warn]: '
5
4
6
5
if ( typeof console !== 'undefined' ) {
@@ -15,18 +14,6 @@ if (typeof console !== 'undefined') {
15
14
}
16
15
} )
17
16
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
-
30
17
it ( 'warn when silent is false' , function ( ) {
31
18
config . silent = false
32
19
_ . warn ( 'oops' )
You can’t perform that action at this time.
0 commit comments