Skip to content

Commit

Permalink
Merge pull request #41 from danfo/master
Browse files Browse the repository at this point in the history
Prepare the channel for addons before the storybook is loaded
  • Loading branch information
roonyh authored Oct 20, 2016
2 parents a74be5c + 9e5ebbe commit bbe7b62
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ const runner = new Runner(program);

async function main() {
try {
// Channel for addons is created by storybook manager from the client side.
// We need to polyfill it for the server side.
const addons = require('@kadira/storybook-addons').default;
const channel = new EventEmitter();
addons.setChannel(channel);

const content = babel.transformFileSync(configPath, babelConfig).code;
const contextOpts = {
filename: configPath,
dirname: path.resolve(configDir),
};
runWithRequireContext(content, contextOpts);
const storybook = require('@kadira/storybook').getStorybook();
const addons = require('@kadira/storybook-addons').default;

// Channel for addons is created by storybook manager from the client side.
// We need to polyfill it for the server side.
const channel = new EventEmitter();
addons.setChannel(channel);
const result = await runner.run(filterStorybook(storybook, grep, exclude));
const fails = result.errored + result.unmatched;
const exitCode = fails > 0 ? 1: 0;
Expand Down

0 comments on commit bbe7b62

Please sign in to comment.