Skip to content

@W-18852148 - NUT test for the cmp local preview #434

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

Closed
wants to merge 4 commits into from

Conversation

Shinoni
Copy link
Collaborator

@Shinoni Shinoni commented Jun 24, 2025

What does this PR do?

This PR introduces a comprehensive integration test for the local component preview functionality. The test file test/commands/lightning/dev/componentLocalPreview.nut.ts provides end-to-end validation of the sf lightning dev component command by:

  • Creating a complete SFDX project environment with a test LWC component (helloWorld)
  • Spawning an actual Lightning Dev Server process
  • Making real HTTP requests to verify the server responds correctly at http://localhost:3000/c-hello-world/
  • Validating proper kebab-case URL formatting (helloWorld → hello-world)
  • Testing server startup, HTTP 200 responses, and process cleanup
  • Including supporting utilities for test project setup and server management

What issues does this PR fix or reference?

Some of the ts compilation errors.

@@ -104,6 +105,7 @@ export default class LightningDevComponent extends SfCommand<void> {
port,
name: name ? `c/${name}` : undefined,
namespacePaths,
open: process.env.OPEN_BROWSER ? process.env.OPEN_BROWSER === 'true' : false,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if this is a correct approach but I had to find some option not to open a browser.

@@ -6,21 +6,5 @@
"flagChars": ["i", "n", "o", "t"],
"flags": ["device-id", "device-type", "flags-dir", "name", "target-org"],
"plugin": "@salesforce/plugin-lightning-dev"
},
{
"alias": [],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had to update as it was failing.

@Shinoni Shinoni marked this pull request as ready for review June 24, 2025 17:54
@Shinoni Shinoni requested review from a team as code owners June 24, 2025 17:54
@Shinoni Shinoni closed this Jun 24, 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