Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Storybook published messaging #920

Merged
merged 4 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/chromatic-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
onlyChanged: true
traceChanged: true
diagnostics: true
debug: true
env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
- uses: actions/upload-artifact@v2
Expand Down
5 changes: 2 additions & 3 deletions node-src/tasks/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ export const publishBuild = async (ctx: Context) => {
setExitCode(ctx, exitCodes.BUILD_FAILED, false);
throw new Error(publishFailed().output);
}

ctx.log.info(storybookPublished(ctx));
};

const StartedBuildQuery = `
Expand Down Expand Up @@ -244,12 +242,13 @@ export const verifyBuild = async (ctx: Context, task: Task) => {
}
}

ctx.log.info(storybookPublished(ctx));
tevanoff marked this conversation as resolved.
Show resolved Hide resolved

transitionTo(success, true)(ctx, task);

if (list || ctx.isPublishOnly || matchesBranch(ctx.options.exitOnceUploaded)) {
setExitCode(ctx, exitCodes.OK);
ctx.skipSnapshots = true;
ctx.log.info(storybookPublished(ctx));
}
};

Expand Down
15 changes: 15 additions & 0 deletions node-src/ui/messages/info/storybookPublished.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,18 @@ export const StorybookPrepared = () =>
},
storybookUrl: 'https://5d67dc0374b2e300209c41e7-pfkaemtlit.chromatic.com/',
} as any);

export const StorybookPreparedWithIncompleteBuild = () =>
storybookPublished({
build: {
actualCaptureCount: undefined,
actualTestCount: undefined,
testCount: undefined,
changeCount: undefined,
errorCount: undefined,
componentCount: undefined,
specCount: undefined,
storybookUrl: 'https://5d67dc0374b2e300209c41e7-pfkaemtlit.chromatic.com/',
},
storybookUrl: 'https://5d67dc0374b2e300209c41e7-pfkaemtlit.chromatic.com/',
} as any);
5 changes: 4 additions & 1 deletion node-src/ui/messages/info/storybookPublished.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import link from '../../components/link';
import { stats } from '../../tasks/snapshot';

export default ({ build, storybookUrl }: Pick<Context, 'build' | 'storybookUrl'>) => {
if (build) {
// `ctx.build` is initialized and overwritten in many ways, which means that
// this can be any kind of build without component and stories information,
// like PASSED builds, for example
Copy link
Member

Choose a reason for hiding this comment

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

I don't see why PASSED builds would not have component and story information. They were tested after all.

if (build?.componentCount && build?.specCount) {
const { components, stories } = stats({ build });
return dedent(chalk`
${success} {bold Storybook published}
Expand Down
Loading