teambit / bit

A build system for development of composable software.
https://bit.dev
Other
17.84k stars 924 forks source link

how to write unit test when a component imported another bit component #4767

Closed leslie555 closed 1 year ago

leslie555 commented 3 years ago
...
import Button, { ButtonGroup } from '@vungle/creativebuilder.ui.vun-button';

...
return (
   <ButtonGroup>
        <Button
          styles={styles}
          onClick={this.handleBold}
          type={isBold && 'primary'}
        >
          B
        </Button>
        <Button
          styles={styles}
          onClick={this.handleItalic}
          type={isItalic && 'primary'}
        >
          I
        </Button>
     </ButtonGroup>
)
...

when I shallow or Mount this component, an error occurred image

GiladShoham commented 3 years ago

When running bit show button-group do you see button in the dependencies?

leslie555 commented 3 years ago

I have updated some info, I guess it's a problem about commonjs and esmodule

GiladShoham commented 3 years ago

Yes but bit should have been handle this during compilation phase. What is your bit env?

leslie555 commented 3 years ago

image vungle.creativebuilder/env/vun-react@0.0.17 is a plugin to enhance function so that we have the ability to access the global CSS. But I think it's not the plugins' business in there.

GiladShoham commented 3 years ago

can you please share your env code?

leslie555 commented 3 years ago

@GiladShoham please click this link: https://drive.google.com/file/d/14r_VUaIHIqH4jc7O9k2t3giSwUtV7qmV/view?usp=sharing

leslie555 commented 3 years ago

@GiladShoham any progress?

itaymendel commented 1 year ago

can't reproduce the issue.