Skip to content

Commit

Permalink
CSF: Ignore __esModule export (#8317)
Browse files Browse the repository at this point in the history
CSF: Ignore __esModule export
  • Loading branch information
shilman committed Oct 14, 2019
1 parent c3b20db commit 81335e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/core/src/client/preview/start.js
Expand Up @@ -31,6 +31,8 @@ function matches(storyKey, arrayOrRegex) {

export function isExportStory(key, { includeStories, excludeStories }) {
return (
// https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs
key !== '__esModule' &&
(!includeStories || matches(key, includeStories)) &&
(!excludeStories || !matches(key, excludeStories))
);
Expand Down
4 changes: 4 additions & 0 deletions lib/core/src/client/preview/start.test.js
Expand Up @@ -144,6 +144,10 @@ describe('STORY_INIT', () => {
});

describe('story filters for module exports', () => {
it('should exclude __esModule', () => {
expect(isExportStory('__esModule', {})).toBeFalsy();
});

it('should include all stories when there are no filters', () => {
expect(isExportStory('a', {})).toBeTruthy();
});
Expand Down

0 comments on commit 81335e2

Please sign in to comment.