-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: add BOOTSTRAP_VUE_NO_WARN environment variable to hide warnings #2826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
0072780
feat: add BOOTSTRAP_VUE_NO_WARN environment variable to hide warnings
5dc228b
Merge branch 'dev' into winh-custom-warnhandler
jacobmllr95 1624ee1
Merge branch 'dev' into winh-custom-warnhandler
jacobmllr95 d3b2822
Merge branch 'dev' into winh-custom-warnhandler
jacobmllr95 877b0a0
Merge branch 'dev' into winh-custom-warnhandler
jacobmllr95 54fd614
Merge branch 'dev' into winh-custom-warnhandler
tmorehouse cd7014a
Merge branch 'dev' into winh-custom-warnhandler
tmorehouse 4e16c51
Merge branch 'dev' into winh-custom-warnhandler
tmorehouse af41830
Update env.js
tmorehouse a663dbd
Update warn.js
tmorehouse 75eed30
Update env.js
tmorehouse 59c75bf
Update warn.js
tmorehouse e851a12
Create README.md
tmorehouse 1839e3f
Create meta.json
tmorehouse 733944a
Update README.md
tmorehouse 1405f66
Update README.md
tmorehouse 9f1dd0c
Update README.md
tmorehouse 7bc3508
Merge branch 'dev' into winh-custom-warnhandler
tmorehouse 3a424e6
Merge branch 'dev' into winh-custom-warnhandler
jacobmllr95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Miscellaneous Settings | ||
|
||
## Disabling BootstrapVue console warnings | ||
|
||
BootstrapVue will warn (via `console.warn`) when you try and use a depreated prop, or pass | ||
an invalid value to certain props. These warnings are provided to help you ensure that your | ||
application is using the correct props and values. | ||
|
||
In some cases, you may want to disable these warnings (not recommended). You can do so by | ||
setting the following process envinronment variable: | ||
|
||
<!-- eslint-disable no-unused-vars --> | ||
|
||
```js | ||
process.env.BOOTSTRAP_VUE_NO_WARN = true | ||
``` | ||
|
||
By ignoring warnings, you may find that your project fails/breaks when using future releases | ||
of bootstrapVue where deprecated props have been removed. | ||
|
||
Warnings should be corrected before moving your project into production! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"title": "Settings" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import { getNoWarn } from './env' | ||
|
||
/** | ||
* Log a warning message to the console with bootstrap-vue formatting sugar. | ||
* @param {string} message | ||
*/ | ||
/* istanbul ignore next */ | ||
const warn = message => { | ||
console.warn(`[BootstrapVue warn]: ${message}`) | ||
if (!getNoWarn()) { | ||
console.warn(`[BootstrapVue warn]: ${message}`) | ||
} | ||
tmorehouse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
export default warn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import warn from './warn' | ||
|
||
describe('utils/warn', () => { | ||
const dummyWarning = 'A Rush Of Blood To The Head' | ||
|
||
let originalProcess | ||
|
||
beforeAll(() => { | ||
jest.spyOn(console, 'warn').mockImplementation(() => {}) | ||
originalProcess = global.process | ||
}) | ||
|
||
afterEach(() => { | ||
console.warn.mockClear() | ||
global.process = originalProcess | ||
}) | ||
|
||
describe('with BOOTSTRAP_VUE_NO_WARN environment variable set', () => { | ||
beforeEach(() => { | ||
global.process = { | ||
env: { | ||
BOOTSTRAP_VUE_NO_WARN: true | ||
} | ||
} | ||
}) | ||
|
||
it('does not call console.warn()', () => { | ||
warn(dummyWarning) | ||
|
||
expect(console.warn).not.toHaveBeenCalled() | ||
}) | ||
}) | ||
|
||
describe('without process object', () => { | ||
beforeEach(() => { | ||
global.process = null | ||
tmorehouse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}) | ||
|
||
it('calls console.warn()', () => { | ||
warn(dummyWarning) | ||
|
||
expect(console.warn).toHaveBeenCalledWith(`[BootstrapVue warn]: ${dummyWarning}`) | ||
}) | ||
}) | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.