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

Porting over Devin's auto snapshots work #8

Merged
merged 6 commits into from
Dec 16, 2020

Conversation

lesliecodes
Copy link
Contributor

Renamed anthology to be consistent with the current naming.
Added a test so we can see it working

@lesliecodes
Copy link
Contributor Author

lesliecodes commented Dec 11, 2020

Not sure why it's complaining about ChildNode which already comes with Typescript...

packages/story-utils/src/generateSnapshot.ts:13:16 - error TS2304: Cannot find name 'ChildNode'.

13   ) => Promise<ChildNode | null> | ChildNode | null;
                  ~~~~~~~~~

packages/story-utils/src/generateSnapshot.ts:13:36 - error TS2304: Cannot find name 'ChildNode'.

13   ) => Promise<ChildNode | null> | ChildNode | null;
                                      ~~~~~~~~~

packages/story-utils/src/generateSnapshot.ts:21:28 - error TS2339: Property 'firstChild' does not exist on type 'HTMLElement'.

21   return wrapper.container.firstChild;
                              ~~~~~~~~~~

Copy link
Contributor

@ahuth ahuth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🤘

packages/story-utils/README.md Show resolved Hide resolved
const stories = getStoriesFromStoryFileExports(storyFileExports);

for (const [storyName, story] of Object.entries<StoryData>(stories)) {
if (story.parameters?.snapshot?.disabled) continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary now (especially since this is a port from Along), but at some point we should skip disabled tests, so that test runs display how many were skipped.

const testFn = story.parameters?.snapshot?.disabled ? test.skip : test;

testFn(`${storyName} is cool`, () => {
  // ...
});

We used to do something similar in axe-storybook-testing: https://github.com/chanzuckerberg/axe-storybook-testing/blob/894e39a5bf4f96c791d5aefa486d9ff568002ec6/src/Suite.ts#L31

@lesliecodes
Copy link
Contributor Author

@ahuth @dcwither fixed up some things. Can you look over it one last time? Thanks!

Copy link
Contributor

@ahuth ahuth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤘

@lesliecodes lesliecodes merged commit d752bdb into main Dec 16, 2020
@lesliecodes lesliecodes deleted the leslie/auto-generate-snaps branch December 16, 2020 20:51
@lesliecodes
Copy link
Contributor Author

Thanks @ahuth! Could you publish 🙏

@ahuth
Copy link
Contributor

ahuth commented Dec 16, 2020

Will do, @lesliecodes! I'm going to make another change today, and then will publish. (Unless you need it on NPM ASAP)

@lesliecodes
Copy link
Contributor Author

Nope, it can wait. :) Thanks!

@ahuth
Copy link
Contributor

ahuth commented Dec 17, 2020

Published in v1.2.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants