Skip to content

Enhance validateMethod to Include File Paths in Duplicate Command Errors#4324

Open
STAR-173 wants to merge 3 commits into
nightwatchjs:mainfrom
STAR-173:enhancement/show-duplicate-command-paths
Open

Enhance validateMethod to Include File Paths in Duplicate Command Errors#4324
STAR-173 wants to merge 3 commits into
nightwatchjs:mainfrom
STAR-173:enhancement/show-duplicate-command-paths

Conversation

@STAR-173

@STAR-173 STAR-173 commented Dec 8, 2024

Copy link
Copy Markdown

Fixes #4313

Summary:

This PR modifies the validateMethod function in the _command-loader.js file to enhance error messages by displaying the file paths of both the original and conflicting command definitions when a duplicate command is detected. This change makes it easier to debug and track the source of duplicate commands.

Example Error Message:

When a duplicate command is found, the error message will now look like this:

Error while loading the API commands: the command testNamespace.testCommand() is already defined.
- First defined in: /path/to/firstFile.js
- Current file: /path/to/secondFile.js

@CLAassistant

CLAassistant commented Dec 8, 2024

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

github-actions Bot commented Dec 8, 2024

Copy link
Copy Markdown

Status

  • ❌ No modified files found in the types directory.
    Please make sure to include types for any changes you have made. Thank you!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display the file paths in the error message for the error "the command .myCommand() is already defined."

2 participants