Skip to content
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

Throw proper error when nightwatch config file not found. #41

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

garg3133
Copy link
Member

@garg3133 garg3133 commented Feb 15, 2024

In Nightwatch VSCode extension, if the nightwatch.conf.js file is not found, an error is thrown which gives out no information on what went wrong. This PR aims to throw a proper error instead.

PR not tested yet.

const nwConfig = require(/* webpackIgnore: true */ res[0].path);
const workspaceState = this.context.workspaceState;
workspaceState.update('nwConfig', nwConfig);
} catch (err) {
Copy link
Member

Choose a reason for hiding this comment

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

Instead we can show the popup window to show the error with the path

@garg3133
Copy link
Member Author

Parking it for the moment as the implementation seems to be incomplete.

If a config file exists then require shouldn't throw an error (or maybe it will if the config has some wrong JS syntax?). But the main issue we want to encounter here is if nightwatch.conf.js does not exist, then the user should get a proper error message, but then we should also show a proper error message if the syntax/format of the config file is not right. See: #42

Note that if no config file is present, then res will be an empty array, so we should throw some error for the user in that case. Also, if a config file is present but the syntax is not right, then also we should throw some error.

@garg3133 garg3133 marked this pull request as draft February 16, 2024 08:54
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.

None yet

2 participants