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

[Enhancement] Add support of TypeScript (.ts) for test files #2559

Closed
zenkdev opened this issue Dec 18, 2020 · 10 comments · Fixed by #2620
Closed

[Enhancement] Add support of TypeScript (.ts) for test files #2559

zenkdev opened this issue Dec 18, 2020 · 10 comments · Fixed by #2620

Comments

@zenkdev
Copy link

zenkdev commented Dec 18, 2020

Is your feature request related to a problem? Please describe.

I'm using Nightwatch with TypeScript and Babel to run my end2end, However, Nightwatch doesn't support ".ts" file extensions for test files out of the box. Is it possible to add this feature?

Describe the solution you'd like

Describe how the solution will work

Describe alternatives you've considered

Additional context

@reallymello
Copy link
Contributor

When I evangelize Nightwatch at work this is a common thing that inevitably comes up in the conversation. "Wow! This is great! Can I write the tests in TypeScript instead?"
Personally, it isn't a big deal for me, but there are a lot of people that love their TypeScript and would help those potential adopters more readily come onboard.

@zenkdev
Copy link
Author

zenkdev commented Jan 2, 2021

Great. Can you explain your solution? Because I have one, but not sure if it is ok.

@beatfactor
Copy link
Member

If it's only a matter of allowing loading of .ts files, we can do that easily.

@zenkdev
Copy link
Author

zenkdev commented Jan 6, 2021

Yes, it's not allowed to use .ts files in NW directly. It would great if you added such an opportunity.

@zenkdev
Copy link
Author

zenkdev commented Jan 18, 2021

Hi. Any updates on this issue?

@beatfactor
Copy link
Member

@trailblazer2006 we will add it soon, thanks for your patience.

@lloiser
Copy link
Collaborator

lloiser commented Jan 21, 2021

FYI I have made an attempt a while ago: #2064
I also created the typescript definitions for it: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/nightwatch/index.d.ts

@zenkdev
Copy link
Author

zenkdev commented Jan 23, 2021

Thanks to everyone. BTW @lloiser my current solution that I use in our projects is exactly the same as yours. I was also thinking about adding some CLI parameter for the extension, like in babel-node, so as not to make breaking changes to Nightwatch.

@beatfactor beatfactor added this to Needs triage in Nightwatch 1.7 via automation Mar 16, 2021
@beatfactor beatfactor moved this from Needs triage to High priority in Nightwatch 1.7 Mar 16, 2021
@beatfactor beatfactor moved this from High priority to In progress in Nightwatch 1.7 Mar 19, 2021
@beatfactor beatfactor linked a pull request Mar 21, 2021 that will close this issue
@beatfactor
Copy link
Member

Can you guys have a look at this PR and let me know if this is enough? We can get it merged and released in v1.5.2 in a few days.

@beatfactor
Copy link
Member

Also if y'all could suggest how to add some unit tests and some examples with typescript, that would be appreciated.

Nightwatch 1.7 automation moved this from In progress to Closed Mar 22, 2021
@beatfactor beatfactor moved this from Closed to Shipped in Nightwatch 1.7 Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

4 participants