Skip to content

test(ThemeProvider): update tests to catch console.error - #2526

Merged
joshblack merged 3 commits into
mainfrom
test/update-theme-provider
Nov 8, 2022
Merged

test(ThemeProvider): update tests to catch console.error#2526
joshblack merged 3 commits into
mainfrom
test/update-theme-provider

Conversation

@joshblack

Copy link
Copy Markdown
Member

Update ThemeProvider test to catch console.error() calls that show up when an invalid color scheme is provided.

This prevents the following logs from being shown in the test suite:

Logs
 console.error
`foo` scheme not defined in`theme.colorSchemes`
224 |if (!theme.colorSchemes[colorScheme]) {
225 | // eslint-disable-next-line no-console
> 226 | console.error(`\`${colorScheme}\` scheme not defined in\`theme.colorSchemes\``)
| ^
227 |
228 | // Apply the first defined color scheme
229 | const defaultColorScheme = Object.keys(theme.colorSchemes)[0]
at error (src/ThemeProvider.tsx:226:13)
at applyColorScheme (src/ThemeProvider.tsx:73:11)
at mountMemo (node_modules/react-dom/cjs/react-dom.development.js:15846:19)
at Object.useMemo (node_modules/react-dom/cjs/react-dom.development.js:16219:16)
at Object.useMemo (node_modules/react/cjs/react.development.js:1532:21)
at useMemo (src/ThemeProvider.tsx:72:54)
at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:14985:18)
console.error
`totally-invalid-colorscheme` scheme not defined in`theme.colorSchemes`
224 |if (!theme.colorSchemes[colorScheme]) {
225 | // eslint-disable-next-line no-console
> 226 | console.error(`\`${colorScheme}\` scheme not defined in\`theme.colorSchemes\``)
| ^
227 |
228 | // Apply the first defined color scheme
229 | const defaultColorScheme = Object.keys(theme.colorSchemes)[0]
at error (src/ThemeProvider.tsx:226:13)
at applyColorScheme (src/ThemeProvider.tsx:73:11)
at mountMemo (node_modules/react-dom/cjs/react-dom.development.js:15846:19)
at Object.useMemo (node_modules/react-dom/cjs/react-dom.development.js:16219:16)
at Object.useMemo (node_modules/react/cjs/react.development.js:1532:21)
at useMemo (src/ThemeProvider.tsx:72:54)
at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:14985:18)
console.error
`totally-invalid-colorscheme` scheme not defined in`theme.colorSchemes`
224 |if (!theme.colorSchemes[colorScheme]) {
225 | // eslint-disable-next-line no-console
> 226 | console.error(`\`${colorScheme}\` scheme not defined in\`theme.colorSchemes\``)
| ^
227 |
228 | // Apply the first defined color scheme
229 | const defaultColorScheme = Object.keys(theme.colorSchemes)[0]
at error (src/ThemeProvider.tsx:226:13)
at applyColorScheme (src/ThemeProvider.tsx:73:11)
at mountMemo (node_modules/react-dom/cjs/react-dom.development.js:15846:19)
at Object.useMemo (node_modules/react-dom/cjs/react-dom.development.js:16219:16)
at Object.useMemo (node_modules/react/cjs/react.development.js:1532:21)
at useMemo (src/ThemeProvider.tsx:72:54)
at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:14985:18)
console.error
`totally-invalid-colorscheme` scheme not defined in`theme.colorSchemes`
224 |if (!theme.colorSchemes[colorScheme]) {
225 | // eslint-disable-next-line no-console
> 226 | console.error(`\`${colorScheme}\` scheme not defined in\`theme.colorSchemes\``)
| ^
227 |
228 | // Apply the first defined color scheme
229 | const defaultColorScheme = Object.keys(theme.colorSchemes)[0]
at error (src/ThemeProvider.tsx:226:13)
at applyColorScheme (src/ThemeProvider.tsx:73:11)
at mountMemo (node_modules/react-dom/cjs/react-dom.development.js:15846:19)
at Object.useMemo (node_modules/react-dom/cjs/react-dom.development.js:16219:16)
at Object.useMemo (node_modules/react/cjs/react.development.js:1532:21)
at useMemo (src/ThemeProvider.tsx:72:54)
at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:14985:18)

@joshblack
joshblack requested review from a team and broccolinisoupNovember 3, 2022 15:59
@changeset-bot

changeset-botBot commented Nov 3, 2022

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1c74c03

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actionsBot commented Nov 3, 2022

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
dist/browser.esm.js78.87 KB (0%)
dist/browser.umd.js79.52 KB (0%)

@joshblackjoshblack added the skip changeset This change does not need a changelog label Nov 3, 2022
@joshblack
joshblack temporarily deployed to github-pages November 3, 2022 16:08 Inactive
@joshblack

Copy link
Copy Markdown
MemberAuthor

@broccolinisoup let me know if you have any questions!

@joshblack
joshblack temporarily deployed to github-pages November 7, 2022 23:12 Inactive

@broccolinisoupbroccolinisoup left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 🚀

@joshblack
joshblack enabled auto-merge (squash) November 8, 2022 15:42
@joshblack
joshblack merged commit daecbb4 into mainNov 8, 2022
@joshblack
joshblack deleted the test/update-theme-provider branch November 8, 2022 15:48
@joshblack
joshblack temporarily deployed to github-pages November 8, 2022 15:49 Inactive
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changesetThis change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@joshblack@broccolinisoup