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

Docs: Module mocking, and more #26858

Merged
merged 48 commits into from May 6, 2024
Merged

Docs: Module mocking, and more #26858

merged 48 commits into from May 6, 2024

Conversation

kylegach
Copy link
Contributor

@kylegach kylegach commented Apr 17, 2024

Closes #26795, closes #26796, closes #26797

What I did

Add or update docs for:

  • Storybook for Next.js
    • Add or adjust sections for:
      • Module aliases
      • Subpath imports
      • Mocking modules
      • Portable stories
      • Exported modules API
  • Decorators
    • Focus "Context" for mocking section on just the second argument
      • Move rest to Story rendering
  • Build pages with Storybook
    • Simplify to reference new mocking guides
  • Mocking data and modules - all new
    • Mocking providers
    • Mocking network requests
    • Mocking modules
  • Interaction testing
    • Add sections for:
      • Run code before each test
      • Mocked modules
  • Story rendering
    • Add section for Running code for every story
      • Move some of "Context" for mocking examples and snippets here
  • Parameters API reference
    • Add test properties

Checklist for Contributors

Testing

Manual testing

  1. Follow the steps in the contributing instructions for this branch, module-mocking-docs

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>

kylegach and others added 8 commits April 15, 2024 12:24
- Providers
    - Configuring mocked providers with parameters
- Network requests
    - Bad link
- Modules
    - Better mock files section
    - Using mocked files in stories
- Warning for absolute imports & mocking
- Module aliases
- Subpath imports
- Mocking modules
- `@storybook/nextjs/cache.mock` module API
- Decorators
    - Focus the "context" section on only that argument
    - Move irrelevant examples and snippets to the Story rendering page
- Interaction Testing
    - Under the Write an interaction test section, add:
        - Run code before each test section
        - Mocked modules section
Copy link

nx-cloud bot commented Apr 17, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 2a0d245. 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
Contributor

@JReinhold JReinhold left a comment

Choose a reason for hiding this comment

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

Fantastic job. ❤️

docs/get-started/nextjs.md Show resolved Hide resolved
docs/writing-stories/build-pages-with-storybook.md Outdated Show resolved Hide resolved
docs/writing-stories/mocking-modules.md Outdated Show resolved Hide resolved
docs/writing-stories/mocking-modules.md Outdated Show resolved Hide resolved
docs/writing-stories/mocking-modules.md Outdated Show resolved Hide resolved
docs/writing-stories/mocking-modules.md Outdated Show resolved Hide resolved
docs/writing-tests/interaction-testing.md Outdated Show resolved Hide resolved
docs/writing-tests/interaction-testing.md Outdated Show resolved Hide resolved
docs/get-started/nextjs.md Outdated Show resolved Hide resolved
docs/get-started/nextjs.md Outdated Show resolved Hide resolved
- Next.js
    - Add portable stories section
- Mocking modules
    - Clarify requirements of mock files
    - Prose and snippet tweaks
- Interaction testing
    - Bring over `mockdate` example
    - Prose and snippet tweaks
docs/api/parameters.md Outdated Show resolved Hide resolved
JReinhold and others added 2 commits April 18, 2024 13:24
Other improvements:
- Consistency improvements in snippets throughout
- Prose tweaks
kasperpeulen and others added 6 commits April 30, 2024 13:54
Co-authored-by: jonniebigodes <joaocontadesenvolvimento@gmail.com>
- Re-order TOC items
- Fix conditional content
- Improve nextjs module API references
- Make example snippets more consistent
- Re-organize subpath imports section of module mocking guide
- Fix typos, grammar
Base automatically changed from kasper/module-mocking to next May 1, 2024 13:40
- Make nextjs module alias usage more clear
- Update msw graphql snippets
- Add preact support for mocking providers
- Prose improvements
Copy link
Contributor

@jonniebigodes jonniebigodes left a comment

Choose a reason for hiding this comment

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

We're getting there. Left some minor items for you to look into when you have a moment.

docs/api/parameters.md Outdated Show resolved Hide resolved
docs/writing-stories/mocking-modules.md Outdated Show resolved Hide resolved
docs/writing-stories/mocking-modules.md Show resolved Hide resolved
docs/writing-tests/interaction-testing.md Outdated Show resolved Hide resolved
- Snippet consistency
- Prose tweaks
Copy link
Contributor

@jonniebigodes jonniebigodes left a comment

Choose a reason for hiding this comment

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

One small item to address and this is good to go. Appreciate you addressing the feedback so promptly 🙏

@kylegach kylegach merged commit 8648002 into next May 6, 2024
17 checks passed
@kylegach kylegach deleted the module-mocking-docs branch May 6, 2024 15:13
@github-actions github-actions bot mentioned this pull request May 6, 2024
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:docs Run the CI jobs for documentation checks only. documentation
Projects
None yet
5 participants