File tree Expand file tree Collapse file tree 7 files changed +92
-8
lines changed
docs/markdown/misc/settings Expand file tree Collapse file tree 7 files changed +92
-8
lines changed Original file line number Diff line number Diff line change
1
+ # Miscellaneous Settings
2
+
3
+ ## Disabling BootstrapVue console warnings
4
+
5
+ BootstrapVue will warn (via ` console.warn ` ) when you try and use a depreated prop, or pass
6
+ an invalid value to certain props. These warnings are provided to help you ensure that your
7
+ application is using the correct props and values.
8
+
9
+ In some cases, you may want to disable these warnings (not recommended). You can do so by
10
+ setting the following process envinronment variable:
11
+
12
+ <!-- eslint-disable no-unused-vars -->
13
+
14
+ ``` js
15
+ process .env .BOOTSTRAP_VUE_NO_WARN = true
16
+ ```
17
+
18
+ By ignoring warnings, you may find that your project fails/breaks when using future releases
19
+ of bootstrapVue where deprecated props have been removed.
20
+
21
+ Warnings should be corrected before moving your project into production!
Original file line number Diff line number Diff line change
1
+ {
2
+ "title" : " Settings"
3
+ }
Original file line number Diff line number Diff line change 118
118
"nuxt" : " ^2.5.1" ,
119
119
"postcss-cli" : " ^6.1.2" ,
120
120
"prettier" : " 1.14.3" ,
121
- "rollup" : " ^1.7.0 " ,
121
+ "rollup" : " ^1.7.2 " ,
122
122
"rollup-plugin-babel" : " ^4.3.2" ,
123
123
"rollup-plugin-commonjs" : " ^9.2.1" ,
124
124
"rollup-plugin-node-resolve" : " ^4.0.1" ,
Original file line number Diff line number Diff line change 1
1
// Info about the current environment
2
2
3
+ // Constants
4
+
3
5
export const inBrowser = typeof document !== 'undefined' && typeof window !== 'undefined'
4
6
5
7
export const isServer = ! inBrowser
@@ -8,3 +10,7 @@ export const hasTouchSupport =
8
10
inBrowser && ( 'ontouchstart' in document . documentElement || navigator . maxTouchPoints > 0 )
9
11
10
12
export const hasPointerEvent = inBrowser && Boolean ( window . PointerEvent || window . MSPointerEvent )
13
+
14
+ // Getters
15
+
16
+ export const getNoWarn = ( ) => process && process . env && process . env . BOOTSTRAP_VUE_NO_WARN
Original file line number Diff line number Diff line change
1
+ import { getNoWarn } from './env'
2
+
1
3
/**
2
4
* Log a warning message to the console with bootstrap-vue formatting sugar.
3
5
* @param {string } message
4
6
*/
5
7
/* istanbul ignore next */
6
8
const warn = message => {
7
- console . warn ( `[BootstrapVue warn]: ${ message } ` )
9
+ if ( ! getNoWarn ( ) ) {
10
+ console . warn ( `[BootstrapVue warn]: ${ message } ` )
11
+ }
8
12
}
9
13
10
14
export default warn
Original file line number Diff line number Diff line change
1
+ import warn from './warn'
2
+
3
+ describe ( 'utils/warn' , ( ) => {
4
+ const dummyWarning = 'A Rush Of Blood To The Head'
5
+
6
+ let originalProcess
7
+
8
+ beforeAll ( ( ) => {
9
+ jest . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
10
+ originalProcess = global . process
11
+ } )
12
+
13
+ afterEach ( ( ) => {
14
+ console . warn . mockClear ( )
15
+ global . process = originalProcess
16
+ } )
17
+
18
+ describe ( 'with BOOTSTRAP_VUE_NO_WARN environment variable set' , ( ) => {
19
+ beforeEach ( ( ) => {
20
+ global . process = {
21
+ env : {
22
+ BOOTSTRAP_VUE_NO_WARN : true
23
+ }
24
+ }
25
+ } )
26
+
27
+ it ( 'does not call console.warn()' , ( ) => {
28
+ warn ( dummyWarning )
29
+
30
+ expect ( console . warn ) . not . toHaveBeenCalled ( )
31
+ } )
32
+ } )
33
+
34
+ describe ( 'without process object' , ( ) => {
35
+ beforeEach ( ( ) => {
36
+ global . process = null
37
+ } )
38
+
39
+ it ( 'calls console.warn()' , ( ) => {
40
+ warn ( dummyWarning )
41
+
42
+ expect ( console . warn ) . toHaveBeenCalledWith ( `[BootstrapVue warn]: ${ dummyWarning } ` )
43
+ } )
44
+ } )
45
+ } )
Original file line number Diff line number Diff line change 1472
1472
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
1473
1473
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
1474
1474
1475
- " @types/node@*" , "@types/node@^11.9.5" :
1475
+ " @types/node@* " :
1476
1476
version "11.11.4"
1477
1477
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.4.tgz#8808bd5a82bbf6f5d412eff1c228d178e7c24bb3"
1478
1478
integrity sha512-02tIL+QIi/RW4E5xILdoAMjeJ9kYq5t5S2vciUdFPXv/ikFTb0zK8q9vXkg4+WAJuYXGiVT1H28AkD2C+IkXVw==
1479
1479
1480
+ " @types/node@^11.11.6 " :
1481
+ version "11.11.6"
1482
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.6.tgz#df929d1bb2eee5afdda598a41930fe50b43eaa6a"
1483
+ integrity sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==
1484
+
1480
1485
" @types/q@^1.5.1 " :
1481
1486
version "1.5.2"
1482
1487
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8"
@@ -9493,13 +9498,13 @@ rollup-watch@^4.3.1:
9493
9498
require-relative "0.8.7"
9494
9499
rollup-pluginutils "^2.0.1"
9495
9500
9496
- rollup@^1.7.0 :
9497
- version "1.7.0 "
9498
- resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.7.0 .tgz#2f5063c0f344f2225d1077655dc54d105a512bb2 "
9499
- integrity sha512-hjuWSCgoQsFSTsmsNP4AH1l1kfkFqW82gW00V9nL81Zr3JtnKn3rvxh18jUAAEMb7qNoHj21PR5SqbK2mhBgMg ==
9501
+ rollup@^1.7.2 :
9502
+ version "1.7.2 "
9503
+ resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.7.2 .tgz#6a2c50843915cba2c1432028e741f2ccb39e8ca3 "
9504
+ integrity sha512-HdbjbHsvoLDwJU/lWEyktVlLdXR7mtnNxRnzaDb+fiNiboAxDYCpwLz1zLGI3+k890PacAptSGrqJLJnABMKJg ==
9500
9505
dependencies :
9501
9506
" @types/estree" " 0.0.39"
9502
- " @types/node" " ^11.9.5 "
9507
+ " @types/node" " ^11.11.6 "
9503
9508
acorn "^6.1.1"
9504
9509
9505
9510
rsvp@^4.8.4 :
You can’t perform that action at this time.
0 commit comments