Skip to content

Commit 73d7ce4

Browse files
authored
Merge branch 'dev' into tmorehouse/config
2 parents 74279e6 + 44d0351 commit 73d7ce4

File tree

7 files changed

+92
-8
lines changed

7 files changed

+92
-8
lines changed

docs/markdown/misc/settings/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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!

docs/markdown/misc/settings/meta.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"title": "Settings"
3+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
"nuxt": "^2.5.1",
119119
"postcss-cli": "^6.1.2",
120120
"prettier": "1.14.3",
121-
"rollup": "^1.7.0",
121+
"rollup": "^1.7.2",
122122
"rollup-plugin-babel": "^4.3.2",
123123
"rollup-plugin-commonjs": "^9.2.1",
124124
"rollup-plugin-node-resolve": "^4.0.1",

src/utils/env.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Info about the current environment
22

3+
// Constants
4+
35
export const inBrowser = typeof document !== 'undefined' && typeof window !== 'undefined'
46

57
export const isServer = !inBrowser
@@ -8,3 +10,7 @@ export const hasTouchSupport =
810
inBrowser && ('ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0)
911

1012
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

src/utils/warn.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
import { getNoWarn } from './env'
2+
13
/**
24
* Log a warning message to the console with bootstrap-vue formatting sugar.
35
* @param {string} message
46
*/
57
/* istanbul ignore next */
68
const warn = message => {
7-
console.warn(`[BootstrapVue warn]: ${message}`)
9+
if (!getNoWarn()) {
10+
console.warn(`[BootstrapVue warn]: ${message}`)
11+
}
812
}
913

1014
export default warn

src/utils/warn.spec.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
})

yarn.lock

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,11 +1472,16 @@
14721472
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
14731473
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
14741474

1475-
"@types/node@*", "@types/node@^11.9.5":
1475+
"@types/node@*":
14761476
version "11.11.4"
14771477
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.4.tgz#8808bd5a82bbf6f5d412eff1c228d178e7c24bb3"
14781478
integrity sha512-02tIL+QIi/RW4E5xILdoAMjeJ9kYq5t5S2vciUdFPXv/ikFTb0zK8q9vXkg4+WAJuYXGiVT1H28AkD2C+IkXVw==
14791479

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+
14801485
"@types/q@^1.5.1":
14811486
version "1.5.2"
14821487
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8"
@@ -9493,13 +9498,13 @@ rollup-watch@^4.3.1:
94939498
require-relative "0.8.7"
94949499
rollup-pluginutils "^2.0.1"
94959500

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==
95009505
dependencies:
95019506
"@types/estree" "0.0.39"
9502-
"@types/node" "^11.9.5"
9507+
"@types/node" "^11.11.6"
95039508
acorn "^6.1.1"
95049509

95059510
rsvp@^4.8.4:

0 commit comments

Comments
 (0)