Skip to content

Add vscode task for test-e2e #6337

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

Merged
merged 2 commits into from
Jul 23, 2025
Merged

Add vscode task for test-e2e #6337

merged 2 commits into from
Jul 23, 2025

Conversation

langermank
Copy link
Contributor

Adds a vscode task to run test-e2e.

  • Looks for a docker instance
  • If it doesn't exist, suggests a download
  • If it exists but isn't running, starts it up

@Copilot Copilot AI review requested due to automatic review settings July 17, 2025 22:05
@langermank langermank requested a review from a team as a code owner July 17, 2025 22:05
@langermank langermank requested a review from joshblack July 17, 2025 22:05
Copy link

changeset-bot bot commented Jul 17, 2025

⚠️ No Changeset found

Latest commit: b2950b9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@langermank langermank added the skip changeset This change does not need a changelog label Jul 17, 2025
Copy link
Contributor

@Copilot 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 VS Code tasks to run end-to-end tests with Docker management functionality. It replaces the existing "Generate e2e tests" task with two new tasks that can run e2e tests either for all components or for a specific component.

  • Adds Docker detection and automatic startup functionality
  • Creates two new tasks: one for running all e2e tests and another for running tests on a specific component
  • Includes input prompts for component selection when running specific tests

"type": "shell",
"args": [
"script/generate-e2e-tests.js"
"-c",
"if ! docker --version >/dev/null 2>&1; then echo \"Docker is required for this script to run. Install Docker Desktop from https://www.docker.com/products/docker-desktop/\"; exit 1; elif ! docker info >/dev/null 2>&1; then echo \"Docker installed but not running. Starting Docker Desktop...\"; open -a Docker && echo \"Waiting for Docker to start...\" && while ! docker info >/dev/null 2>&1; do sleep 2; done && echo \"Docker is now running\"; fi; ./script/test-e2e"
Copy link
Preview

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

This one-liner bash script is extremely difficult to read and maintain. Consider extracting this logic into a separate shell script file (e.g., script/run-e2e-with-docker.sh) and calling that script instead.

Copilot uses AI. Check for mistakes.

"type": "shell",
"args": [
"-c",
"COMPONENT=\"${input:componentName}\"; if [[ \"$COMPONENT\" == *.test.ts ]]; then TEST_FILE=\"$COMPONENT\"; else TEST_FILE=\"e2e/components/$COMPONENT.test.ts\"; fi; if ! docker --version >/dev/null 2>&1; then echo \"Docker is required for this script to run. Install Docker Desktop from https://www.docker.com/products/docker-desktop/\"; exit 1; elif ! docker info >/dev/null 2>&1; then echo \"Docker installed but not running. Starting Docker Desktop...\"; open -a Docker && echo \"Waiting for Docker to start...\" && while ! docker info >/dev/null 2>&1; do sleep 2; done && echo \"Docker is now running\"; fi; ./script/test-e2e \"$TEST_FILE\""
Copy link
Preview

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

This one-liner contains duplicated Docker management logic and is extremely difficult to read and maintain. The Docker checking logic is repeated from the previous task. Consider extracting both the Docker management and component resolution logic into separate shell scripts.

Copilot uses AI. Check for mistakes.

"type": "shell",
"args": [
"-c",
"COMPONENT=\"${input:componentName}\"; if [[ \"$COMPONENT\" == *.test.ts ]]; then TEST_FILE=\"$COMPONENT\"; else TEST_FILE=\"e2e/components/$COMPONENT.test.ts\"; fi; if ! docker --version >/dev/null 2>&1; then echo \"Docker is required for this script to run. Install Docker Desktop from https://www.docker.com/products/docker-desktop/\"; exit 1; elif ! docker info >/dev/null 2>&1; then echo \"Docker installed but not running. Starting Docker Desktop...\"; open -a Docker && echo \"Waiting for Docker to start...\" && while ! docker info >/dev/null 2>&1; do sleep 2; done && echo \"Docker is now running\"; fi; ./script/test-e2e \"$TEST_FILE\""
Copy link
Preview

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

The open -a Docker command is macOS-specific and will fail on Windows or Linux systems. Consider adding platform detection or documenting that this task only works on macOS.

Suggested change
"COMPONENT=\"${input:componentName}\"; if [[ \"$COMPONENT\" == *.test.ts ]]; then TEST_FILE=\"$COMPONENT\"; else TEST_FILE=\"e2e/components/$COMPONENT.test.ts\"; fi; if ! docker --version >/dev/null 2>&1; then echo \"Docker is required for this script to run. Install Docker Desktop from https://www.docker.com/products/docker-desktop/\"; exit 1; elif ! docker info >/dev/null 2>&1; then echo \"Docker installed but not running. Starting Docker Desktop...\"; open -a Docker && echo \"Waiting for Docker to start...\" && while ! docker info >/dev/null 2>&1; do sleep 2; done && echo \"Docker is now running\"; fi; ./script/test-e2e \"$TEST_FILE\""
"COMPONENT=\"${input:componentName}\"; if [[ \"$COMPONENT\" == *.test.ts ]]; then TEST_FILE=\"$COMPONENT\"; else TEST_FILE=\"e2e/components/$COMPONENT.test.ts\"; fi; if ! docker --version >/dev/null 2>&1; then echo \"Docker is required for this script to run. Install Docker Desktop from https://www.docker.com/products/docker-desktop/\"; exit 1; elif ! docker info >/dev/null 2>&1; then echo \"Docker installed but not running.\"; if [[ $(uname) == \"Darwin\" ]]; then echo \"Starting Docker Desktop on macOS...\"; open -a Docker && echo \"Waiting for Docker to start...\" && while ! docker info >/dev/null 2>&1; do sleep 2; done && echo \"Docker is now running\"; else echo \"Please start Docker manually on your platform.\"; exit 1; fi; fi; ./script/test-e2e \"$TEST_FILE\""

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Someone tell me if this is a good suggestion.. copilot suggesting changes to its own code, so fun 😄

Comment on lines +43 to +44
},
],
Copy link
Preview

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

There is a trailing comma after the tasks array which is not valid JSON syntax.

Suggested change
},
],
}
]

Copilot uses AI. Check for mistakes.

Copy link
Contributor

github-actions bot commented Jul 17, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 91.9 KB (0%)
packages/react/dist/browser.umd.js 92.23 KB (0%)

@langermank langermank added this pull request to the merge queue Jul 22, 2025
Merged via the queue into main with commit f9b0d15 Jul 23, 2025
43 checks passed
@langermank langermank deleted the add-e2e-tasj branch July 23, 2025 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changeset This change does not need a changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants