question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with theme library causing test failures

See original GitHub issue

Environment Information

  • Package version(s):
    "@fluentui-react-native/apple-theme": "^0.7.23",
    "@fluentui-react-native/default-theme": "^0.8.3",
    "@fluentui-react-native/theme": "^0.5.19",
    "@fluentui-react-native/theme-types": "^0.12.1",
    "@fluentui-react-native/win32-theme": "^0.13.2",
    "@fluentui/react-native": "0.25.13",
  • Platform: all

Please provide a reproduction of the bug:

when running a test

    const theme = createDefaultTheme();

    const tree = renderer
      .create(
        <ThemeProvider theme={theme}>
          <Component>
        </ThemeProvider>,
      )
      .toJSON();
    expect(tree).toMatchSnapshot();

I get this error

    Unhandled discriminated union member: undefined

      at Object.assertNever (../../common/temp/node_modules/.pnpm/assert-never@1.2.1/node_modules/assert-never/index.js:32:11)
      at ../../common/temp/node_modules/.pnpm/@fluentui-react-native/default-theme@0.8.3_d1c53b50ef9cfe887d69c9bf99b2b704/node_modules/@fluentui-react-native/default-theme/src/createDefaultTheme.ts:19:20
      at ThemeReference.get [as theme] (../../common/temp/node_modules/.pnpm/@fluentui-react-native/theme@0.5.19_e6f6aee82b874cf5b3bad5d449c8dc73/node_modules/@fluentui-react-native/theme/src/themeReference.ts:61:66)
      at ../../common/temp/node_modules/.pnpm/@fluentui-react-native/theme@0.5.19_e6f6aee82b874cf5b3bad5d449c8dc73/node_modules/@fluentui-react-native/theme/src/ThemeProvider.tsx:14:9
      at mountState (../../common/temp/node_modules/.pnpm/react-test-renderer@16.13.1_react@16.13.1/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:5971:20)
      at Object.useState (../../common/temp/node_modules/.pnpm/react-test-renderer@16.13.1_react@16.13.1/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6516:16)
      at Object.useState (../../common/temp/node_modules/.pnpm/react@16.13.1/node_modules/react/cjs/react.development.js:1497:21)
      at Object.<anonymous>.exports.ThemeProvider (../../common/temp/node_modules/.pnpm/@fluentui-react-native/theme@0.5.19_e6f6aee82b874cf5b3bad5d449c8dc73/node_modules/@fluentui-react-native/theme/src/ThemeProvider.tsx:14:9)
      at renderWithHooks (../../common/temp/node_modules/.pnpm/react-test-renderer@16.13.1_react@16.13.1/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:5552:18)
      at mountIndeterminateComponent (../../common/temp/node_modules/.pnpm/react-test-renderer@16.13.1_react@16.13.1/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7918:13)

Hypothesis

I think this might be some weird interaction of passing a partial theme to the theme provider,

Priorities and help requested:

Are you willing to submit a PR to fix? No

Requested priority: Blocking

Products/applications affected: (if applicable) Excel Taskpane

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rurikoarakicommented, Sep 13, 2021

Hmm the " || light" should’ve taken care of that, but I guess it’s causing an issue. I’ll take a look.

0reactions
rychomiscommented, Sep 13, 2021

@rurikoaraki I’m testing the default and the createOfficeTheme

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failing tests in non-TS app due to undefined vars #419 - GitHub
I am building a new component library in TS, with Vanilla-extract. It is meant to be consumed in a non-TS application, and based...
Read more >
Testing for a Theme/Plugin Conflict
Testing for Plugin Conflicts. To test for a plugin conflict: Deactivate ALL plugins; Activate Gravity Forms; Check to see if the issue occurs....
Read more >
My struggles with React Testing Library - Hao's learning log
Open any software development book, and there is probably a section on testing and why it is essential. Testing is a great feedback...
Read more >
Fix Your Failing Tests: A Debugging Checklist for React ...
Probably the most common cause of tests that fail when ran together is a missing async . When a test runs an operation...
Read more >
How to Fix Divi - A Complete Guide To Solve Issues and ...
The complete guide on how to solve issues and problems with the Divi Theme or Builder from Elegant Themes. Learn which steps to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found