mthuret / storybook-addon-specifications

:book: Write tests next to your stories and display their results inside storybook interface
457 stars 54 forks source link

use with vue cause HMR broken #114

Open yoyoys opened 5 years ago

yoyoys commented 5 years ago

Here is my story:

import { storiesOf } from '@storybook/vue';
import { ComponentOptions } from 'vue';
import SomeComponent from './SomeComponent.vue';
import { specs } from 'storybook-addon-specifications';
import test from './some-component.spec';

storiesOf('Form|Project', module)
  .add(
    'Add Form',
    (() => {
      const story: ComponentOptions<any> = {
        components: {
          SomeComponent,
        },
        data() {
          return {
            form: {
              name: '',
              description: '',
            },
          };
        },
        template: `
          <div class="default-view">
            <h3>form: {{ form }}</h3>
            <hr/>
            <SomeComponent v-model="form" />
          </div>
        `,
      };
      specs(() => test);

      return story;
    }),
  );

if I remove specs(() => test);, HMR works as except. if don't, HMR only works on style update.