Skip to content

Conversation

@joshblack
Copy link
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 broccolinisoup November 3, 2022 15:59
@changeset-bot
Copy link

changeset-bot bot commented Nov 3, 2022

⚠️ 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
Copy link
Contributor

github-actions bot commented Nov 3, 2022

size-limit report 📦

Path Size
dist/browser.esm.js 78.87 KB (0%)
dist/browser.umd.js 79.52 KB (0%)

@joshblack joshblack 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
Member Author

@broccolinisoup let me know if you have any questions!

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

@broccolinisoup broccolinisoup left a comment

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 main Nov 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 free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants