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

Build: Use mocks in telemetry test #28840

Merged
merged 1 commit into from
Aug 8, 2024
Merged

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Aug 8, 2024

Closes #

What I did

This PR fixes a test that was running a command against the codebase which was causing "flake". The test now runs against a fixed mock so the results are always consistent.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 76.3 MB 76.3 MB -27.8 kB -2 0%
initSize 171 MB 171 MB 194 kB -0.55 0.1%
diffSize 95 MB 95.2 MB 222 kB -0.55 0.2%
buildSize 7.42 MB 7.42 MB 0 B -1 0%
buildSbAddonsSize 1.61 MB 1.61 MB 0 B -1 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 2.29 MB 2.29 MB 0 B -0.5 0%
buildSbPreviewSize 351 kB 351 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 4.45 MB 4.45 MB 0 B -0.95 0%
buildPreviewSize 2.97 MB 2.97 MB 0 B -1 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 17.8s 14.6s -3s -178ms -0.31 -21.7%
generateTime 20.9s 21.5s 618ms -0.37 2.9%
initTime 18s 23.4s 5.4s 1.43 🔺23.1%
buildTime 13.2s 14.5s 1.3s 0.82 9%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 8.7s 9.2s 507ms 0.58 5.5%
devManagerResponsive 5.1s 5.2s 74ms -0.15 1.4%
devManagerHeaderVisible 797ms 843ms 46ms -0.13 5.5%
devManagerIndexVisible 822ms 875ms 53ms -0.14 6.1%
devStoryVisibleUncached 1.2s 1.5s 329ms 1.62 🔺21%
devStoryVisible 838ms 908ms 70ms -0.1 7.7%
devAutodocsVisible 720ms 1s 289ms 2.24 🔺28.6%
devMDXVisible 710ms 923ms 213ms 1.75 🔺23.1%
buildManagerHeaderVisible 753ms 868ms 115ms 0.81 13.2%
buildManagerIndexVisible 756ms 870ms 114ms 0.73 13.1%
buildStoryVisible 801ms 912ms 111ms 0.67 12.2%
buildAutodocsVisible 669ms 819ms 150ms 0.97 18.3%
buildMDXVisible 652ms 901ms 249ms 1.97 🔺27.6%

Greptile Summary

The pull request aims to fix a flaky test by using mock files for consistent results.

  • Added code/core/src/__mocks__/composeStories.txt and code/core/src/__mocks__/composeStory.txt to provide stable mock data.
  • Modified code/core/src/telemetry/get-portable-stories-usage.test.ts to use the new mock files, ensuring consistent test outcomes.
  • Updated code/core/src/telemetry/get-portable-stories-usage.ts to accept an optional path parameter, enhancing flexibility and targeting specific directories for testing.

@yannbf yannbf added build Internal-facing build tooling & test updates ci:normal labels Aug 8, 2024
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

LGTM

4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

nx-cloud bot commented Aug 8, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit f3e431a. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Nice one!!! 🚀

@shilman shilman merged commit f139b54 into next Aug 8, 2024
54 of 58 checks passed
@shilman shilman deleted the yann/improve-telemetry-test branch August 8, 2024 15:08
@github-actions github-actions bot mentioned this pull request Aug 8, 2024
29 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Internal-facing build tooling & test updates ci:normal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants