test-runner icon indicating copy to clipboard operation
test-runner copied to clipboard

`test-storybook` is displaying `PASS` when the story has a TypeError

Open virtuoushub opened this issue 3 years ago • 2 comments

Describe the bug

test-storybook is displaying PASS when the story has a TypeError(s).

Steps to reproduce the behavior

  1. create a story that has type errors, e.g. BlogPost.stories.tsx
// BlogPost.stories.tsx
import BlogPost from './BlogPost'

export const generated = () => {
  return <BlogPost />
}

export default { title: 'Components/BlogPost' }
// BlogPost.tsx
interface Props {
  post: { id: number, title: string, body: string, createdAt: string }
}


const BlogPost = ({ post }: Props) => {
  return (

    <article>
      <header className="mt-4">
        <p className="text-sm">
          {new Intl.DateTimeFormat('en-US', {  year: 'numeric', month: 'long', day: 'numeric' }).format(new Date(post.createdAt))}
        </p>
        <h2 className="text-xl mt-2 font-semibold">
          <div className="hover:text-blue-600">{post.title}</div>
        </h2>
      </header>
      <div className="mt-2 mb-4 text-gray-900 font-light">{post.body}</div>
    </article>

  );
}

export default BlogPost
  1. run test-storybook

Expected behavior

test-storybook fails for those stories which have a TypeError(s)

Screenshots and/or logs

image

image

$ yarn workspace web test-storybook
yarn workspace v1.23.0-20211220.1904
yarn run v1.23.0-20211220.1904
$ test-storybook
page loaded in 1847ms.
page loaded in 1943ms.
page loaded in 2047ms.
page loaded in 1919ms.
page loaded in 2193ms.
page loaded in 2281ms.
page loaded in 2230ms.
page loaded in 2289ms.
 PASS   browser: chromium  src/pages/ContactPage/ContactPage.stories.tsx
 PASS   browser: chromium  src/pages/AboutPage/AboutPage.stories.tsx (5.231 s)
 PASS   browser: chromium  src/pages/BlogPostPage/BlogPostPage.stories.tsx (5.235 s)
 PASS   browser: chromium  src/components/BlogPost/BlogPost.stories.tsx (5.101 s)
 PASS   browser: chromium  src/layouts/BlogLayout/BlogLayout.stories.tsx (5.221 s)
 PASS   browser: chromium  src/pages/HomePage/HomePage.stories.tsx (5.186 s)
 PASS   browser: chromium  src/components/BlogPostCell/BlogPostCell.stories.tsx (5.441 s)
 PASS   browser: chromium  src/components/BlogPostsCell/BlogPostsCell.stories.tsx (5.061 s)

Test Suites: 8 passed, 8 total
Tests:       14 passed, 14 total
Snapshots:   0 total
Time:        8.308 s
Ran all test suites.
Done in 10.74s.
Done in 11.12s.

virtuoushub avatar Jan 12 '22 00:01 virtuoushub

@virtuoushub Can you share how to reproduce this? I tried adding your example above to a simple CRA project and it worked as expected (the test failed with the same error as is being shown in the browser)

shilman avatar Jan 12 '22 08:01 shilman

@shilman - attempting to get a repo to help repro this; this resulted from an advanced webpack 5 config ( redwood: https://github.com/redwoodjs/redwood/blob/main/packages/testing/config/storybook/main.js )

might take me a little to get something stood up for you to test this.

virtuoushub avatar Jan 13 '22 04:01 virtuoushub