Skip to content

Build: Refactor tests for windows#34714

Merged
ndelangen merged 1 commit into
nextfrom
norbert/fix-windows-rn-tests
May 5, 2026
Merged

Build: Refactor tests for windows#34714
ndelangen merged 1 commit into
nextfrom
norbert/fix-windows-rn-tests

Conversation

@ndelangen
Copy link
Copy Markdown
Member

@ndelangen ndelangen commented May 5, 2026

What I did

The tests I added for RN were not platform agnostic, so they failed on windows, this solves that problem.

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

I do not think it's needed.

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-storybook/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 publish.yml --field pr=<PR_NUMBER>

…nt tests and update regex for prompt loading test
Copilot AI review requested due to automatic review settings May 5, 2026 07:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes recently added React Native and eval tests platform-agnostic so they pass on Windows as well as POSIX environments. It fits into the repo’s cross-platform test stability work by removing path-separator assumptions from assertions.

Changes:

  • Updated a prompt-loading test to accept either / or \ in the expected dispatcher path.
  • Added a small path-normalization helper in the React Native entrypoint tests.
  • Normalized path.relative(...) results before snapshot assertions so snapshots remain stable across platforms.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
scripts/eval/lib/utils.test.ts Makes the prompt path assertion accept Windows and POSIX separators.
code/lib/create-storybook/src/generators/REACT_NATIVE/generateEntrypoint.test.ts Normalizes relative paths before snapshot checks in RN entrypoint tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ndelangen ndelangen self-assigned this May 5, 2026
@ndelangen ndelangen added react-native build Internal-facing build tooling & test updates ci:normal labels May 5, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 93423287-3f55-4826-b09f-f4fad1454236

📥 Commits

Reviewing files that changed from the base of the PR and between 1d84ef6 and 0eddec2.

📒 Files selected for processing (2)
  • code/lib/create-storybook/src/generators/REACT_NATIVE/generateEntrypoint.test.ts
  • scripts/eval/lib/utils.test.ts

📝 Walkthrough

Walkthrough

The PR updates test code to handle cross-platform path separators, making snapshot assertions and path-matching regex patterns insensitive to OS differences. A normalizePath helper is added to normalize Windows backslashes to forward slashes in React Native tests, and a regex is updated in eval utils tests to accept either separator style.

Changes

Cross-Platform Test Path Normalization

Layer / File(s) Summary
Path Normalization Helper
code/lib/create-storybook/src/generators/REACT_NATIVE/generateEntrypoint.test.ts
Added local normalizePath helper that converts OS-specific path separators to forward slashes.
Snapshot Assertions
code/lib/create-storybook/src/generators/REACT_NATIVE/generateEntrypoint.test.ts
Applied normalizePath to path.relative() calls in three inline snapshot assertions (TypeScript, JavaScript, and Expo variants) to handle Windows backslashes.
Regex Path Matching
scripts/eval/lib/utils.test.ts
Updated regex pattern in loadPrompt test to accept both POSIX (/) and Windows (\) directory separators when matching the dispatcher.js command path.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

@ndelangen ndelangen merged commit 97489ec into next May 5, 2026
133 of 137 checks passed
@ndelangen ndelangen deleted the norbert/fix-windows-rn-tests branch May 5, 2026 07:38
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 react-native

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants