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

config and globals files with types do not allow nightwatch to run tests #3688

Open
vaibhavsingh97 opened this issue Apr 10, 2023 · 2 comments · May be fixed by #4133
Open

config and globals files with types do not allow nightwatch to run tests #3688

vaibhavsingh97 opened this issue Apr 10, 2023 · 2 comments · May be fixed by #4133
Assignees
Labels
bug p2 typescript Issues related to Typescript

Comments

@vaibhavsingh97
Copy link
Member

vaibhavsingh97 commented Apr 10, 2023

Description of the bug/issue

While setting up Nightwatch in the typescript project, if the user uses the nightwatch.conf.ts or global.ts file and defined types in those files, nightwatch will fail to run the tests.

Steps to reproduce

Use npm init nightwatch@latest <project-name> to setup a new typescript project.

nightwatch.conf.ts issue

  1. Rename nightwatch.conf.js in the root of the project to nightwatch.conf.ts.
  2. Add const sampleVariable: string = 'some value'; statement at the top of the nightwatch.conf.ts file (to add TypeScript syntax to the file.
  3. Run the tests using npx nightwatch command.

globals.ts issue

  1. Add a file named globals.ts inside the nightwatch directory with the following content:
    import {NightwatchGlobals} from 'nightwatch';
    
    const globals: NightwatchGlobals = {
      global1: 'hello'
    };
     
    export default globals;
  2. Set the globals_path config in nightwatch.conf.js to 'nightwatch/globals.ts'.
  3. Run the tests using npx nightwatch command.

Command to run

npx nightwatch
@vaibhavsingh97 vaibhavsingh97 added typescript Issues related to Typescript bug p1 labels Apr 10, 2023
@vaibhavsingh97 vaibhavsingh97 self-assigned this Apr 10, 2023
@AutomatedTester AutomatedTester added p2 and removed p1 labels Jun 6, 2023
@dikwickley
Copy link
Contributor

I tested this out in nightwatch 3.4.1 and this doesn't seem to be an issue anymore

image

@ansh21 ansh21 linked a pull request Mar 21, 2024 that will close this issue
9 tasks
@ansh21
Copy link

ansh21 commented Mar 21, 2024

opened a fix pr for this : #4133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug p2 typescript Issues related to Typescript
Projects
Status: In Review
Development

Successfully merging a pull request may close this issue.

4 participants