Skip to content

Comments

@W-18852148 feat: off-core integration test on your local #435

Merged
Shinoni merged 15 commits intomainfrom
nut-test
Jul 15, 2025
Merged

@W-18852148 feat: off-core integration test on your local #435
Shinoni merged 15 commits intomainfrom
nut-test

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?
@W-18852148@

@Shinoni Shinoni requested review from a team as code owners June 24, 2025 20:12
@Shinoni Shinoni changed the title @W-18852148 off-core integration test @W-18852148: off-core integration test Jun 24, 2025
@Shinoni Shinoni changed the title @W-18852148: off-core integration test @W-18852148: off-core integration test on your local Jun 24, 2025
@nrkruk nrkruk changed the title @W-18852148: off-core integration test on your local feat(component): off-core integration test on your local @W-18852148 Jun 27, 2025
"flagAliases": [],
"flagChars": ["l", "n", "o"],
"flags": ["flags-dir", "get-latest", "guest", "name", "target-org"],
"plugin": "@salesforce/plugin-lightning-dev"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There was an error about command-snapshot and I had to update it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nrkruk , can you run bin/dev.js snapshot:compare?

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 just reverted the change. Weird.

package.json Outdated
"type": "module",
"volta": {
"node": "20.11.0",
"node": "20.19.3",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For some reason, the Node version in Volta is different from the one used in CI.

lesya7 added 14 commits July 11, 2025 16:59
- Small comment added to README to trigger CI
- Testing if @lwrjs/api issue exists in main branch CI
- This will help isolate whether the TypeScript error is pre-existing or introduced by our changes
- Downgraded @oclif/plugin-command-snapshot from ^5.3.3 to ^5.3.2
- Added @salesforce/cli ^2.93.7 and dotenv ^16.5.0 dependencies
- Added test:nut:local script
- Updated volta Node.js version from 20.11.0 to 20.19.3
- Added yarn resolutions for @salesforce/core ^8.15.0

Testing if these package.json changes cause the @lwrjs/api TypeScript error in CI.
- Updated tsconfig.json to include ./src/**/*.d.ts files
- Updated test/tsconfig.json to include ./**/*.nut.ts files
- Testing if these TypeScript configuration changes cause @lwrjs/api module resolution issues in CI
- Added src/lwrjs-api.d.ts with type declarations for @lwrjs/api
- Declares SitesLocalDevOptions type and expDev/setupDev functions
- Testing if this TypeScript declaration file causes @lwrjs/api module resolution issues in CI
- This is the most likely culprit for the TS7016 error
- Reverted yarn.lock to remove problematic dependencies from earlier package.json changes
- This should resolve the mocha/cliui dependency conflict in CI
- Now we can properly test if the TypeScript declaration file causes @lwrjs/api issues
- Added componentLocalPreview.nut.ts and supporting test infrastructure
- Includes test helpers, test data, and test projects
- Contains fixed dotenv import pattern (import * as dotenv)
- Testing if NUT test files cause @lwrjs/api module resolution issues in CI
- Added dotenv ^16.5.0 to devDependencies
- Required for componentLocalPreview.nut.ts test
- Only adding dotenv, not other problematic dependencies
…icts

- Removed dotenv import and config() call from componentLocalPreview.nut.ts
- Using process.env directly instead of dotenv.config()
- This avoids the mocha/cliui dependency conflict that was preventing CI tests
- Now we can test if NUT test files cause @lwrjs/api issues without package.json changes
- Removed src/lwrjs-api.d.ts declaration file
- Cleaned up tsconfig.json to remove .d.ts includes
- Cleaned up test/tsconfig.json to remove .nut.ts includes
- Testing if dependency fixes alone resolve @lwrjs/api issue without TypeScript declarations
- Fix mocha/cliui dependency conflict by adding cliui@7.0.4 resolution
- Restore dotenv functionality for .nut.ts test files
- Update test/tsconfig.json to properly include .nut.ts files
- All 56 tests passing with dependencies resolved
- Added prerequisite that SF CLI must be installed before running integration tests locally
- Clarifies that sf command must be available during local test execution
- Provides installation link and verification command
@nrkruk nrkruk changed the title feat(component): off-core integration test on your local @W-18852148 feat: off-core integration test on your local @W-18852148@ Jul 14, 2025
@Shinoni Shinoni enabled auto-merge (squash) July 15, 2025 19:41
@Shinoni Shinoni changed the title feat: off-core integration test on your local @W-18852148@ @W-18852148 feat: off-core integration test on your local Jul 15, 2025
@Shinoni Shinoni merged commit 34ed97f into main Jul 15, 2025
12 checks passed
@Shinoni Shinoni deleted the nut-test branch July 15, 2025 22:58
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.

4 participants