Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Update index.ts
Browse files Browse the repository at this point in the history
 **Describe the bug** 
When running `composeStories` in stories that have certain addons, such as storybook-addons-design, the tests break with the following error:
 
 ```shell
 Error: Uncaught [Error: Accessing non-existent addons channel, see https://storybook.js.org/basics/faq/#why-is-there-no-addons-channel]
 ```
 **Expected behavior** 
Addons channel should not present error in the tests
  • Loading branch information
AlmarAubel authored Jan 3, 2022
1 parent 5f3592c commit 940aa34
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { combineParameters } from "@storybook/client-api";
import addons, { mockChannel } from '@storybook/addons';
import type { Story, Meta, StoryContext } from "@storybook/vue3";
import type { StoryFnVueReturnType, ContextedStory, GlobalConfig, StoriesWithPartialProps } from "./types";

import decorateStory from "./decorateStory";

let globalStorybookConfig: GlobalConfig = {};

// Some addons use the channel api to communicate between manager/preview, and this is a client only feature, therefore we must mock it.
addons.setChannel(mockChannel());

export function setGlobalConfig(config: GlobalConfig) {
globalStorybookConfig = config;
}
Expand Down

0 comments on commit 940aa34

Please sign in to comment.