Skip to content

fix: should throw error when unknown environment#439

Merged
9aoy merged 1 commit intomainfrom
unknown-environment
Aug 4, 2025
Merged

fix: should throw error when unknown environment#439
9aoy merged 1 commit intomainfrom
unknown-environment

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Aug 4, 2025

Summary

should throw error when unknown environment.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings August 4, 2025 07:29
@netlify
Copy link
Copy Markdown

netlify bot commented Aug 4, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 1d07252
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/68906178f091430008aad909
😎 Deploy Preview https://deploy-preview-439--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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 adds error handling for unknown test environments by implementing validation that throws an error when an unrecognized environment is specified. The change ensures the system fails gracefully with a clear error message instead of silently ignoring unknown environments.

  • Refactored environment handling from if-else to switch-case pattern for better maintainability
  • Added explicit error throwing for unknown test environments
  • Updated test utilities to support string type for custom environment testing

Reviewed Changes

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

File Description
tests/dom/utils.ts Updated type signature to allow string for testing unknown environments
tests/dom/handledError.test.ts Added test case to verify error handling for unknown environments
packages/core/src/runtime/worker/index.ts Implemented switch-case pattern with error throwing for unknown environments
Comments suppressed due to low confidence (1)

packages/core/src/runtime/worker/index.ts:124

  • The 'node' environment case is added but there's no corresponding test coverage for this environment type. Consider adding a test case to verify the node environment path.
    case 'node':

@9aoy 9aoy merged commit 28d3316 into main Aug 4, 2025
17 checks passed
@9aoy 9aoy deleted the unknown-environment branch August 4, 2025 09:15
@9aoy 9aoy mentioned this pull request Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants