-
Notifications
You must be signed in to change notification settings - Fork 645
Add update-snapshot VScode task
#6377
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
Conversation
|
There was a problem hiding this 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 a VS Code task for updating e2e snapshots and modifies the IconButton test to use an older snapshot format. The changes aim to improve developer workflow by providing a convenient way to update test snapshots through VS Code's task runner.
- Adds a new VS Code task that allows developers to update e2e snapshots for specific components
- Changes IconButton test from
toHaveScreenshottotoMatchSnapshotapproach - Includes Docker availability checks in the new task
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.vscode/tasks.json |
Adds new task for updating e2e snapshots with Docker checks and component name input |
e2e/components/IconButton.test.ts |
Changes screenshot assertion method from toHaveScreenshot to toMatchSnapshot |
| "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 --update-snapshots\"" |
Copilot
AI
Jul 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This single-line bash command is extremely complex and difficult to read or maintain. Consider breaking it into multiple lines or extracting it to a separate script file that can be called from the task.
| "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 --update-snapshots\"" |
Copilot
AI
Jul 24, 2025
There was a problem hiding this comment.
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 providing cross-platform alternatives for starting Docker.
| "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 --update-snapshots\"" | |
| "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...\"; case \"$(uname -s)\" in Darwin) open -a Docker ;; Linux) sudo systemctl start docker ;; CYGWIN*|MINGW32*|MSYS*|MINGW*) powershell.exe -Command \"Start-Process 'Docker Desktop' -Verb RunAs\" ;; *) echo \"Unsupported platform. Please start Docker manually.\"; exit 1 ;; esac; 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 --update-snapshots\"" |
size-limit report 📦
|
Add a task to update snaps + try old format in IconButton