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

type=module and typescript config #3959

Closed
cexbrayat opened this issue Nov 26, 2023 · 2 comments · Fixed by #3974 or vuejs/create-vue#404
Closed

type=module and typescript config #3959

cexbrayat opened this issue Nov 26, 2023 · 2 comments · Fixed by #3974 or vuejs/create-vue#404
Assignees
Labels

Comments

@cexbrayat
Copy link

Description of the bug/issue

When I use type=module in my package.json and a typescript configuration, then nightwatch logs:

No config file found in the current working directory, creating nightwatch.conf.js in the current folder...

Steps to reproduce

Use nightwatch.conf.ts file as config.
Add type: module to your package.json
Run npx nightwatch

Sample test

No response

Command to run

No response

Verbose Output

❯ pnpm test:unit

> typescript-nightwatch@0.0.0 test:unit /Users/cedric/Code/vue/create-vue/playground/typescript-nightwatch
> nightwatch src/**/__tests__/*

No config file found in the current working directory, creating nightwatch.conf.js in the current folder...
 Wrote HTML report file to: /Users/cedric/Code/vue/create-vue/playground/typescript-nightwatch/tests_output/nightwatch-html-report/index.html

  ✖ TypeError
   Unknown file extension ".ts" for /Users/cedric/Code/vue/create-vue/playground/typescript-nightwatch/src/components/__tests__/HelloWorld.spec.ts
    Stack Trace :

Nightwatch Configuration

No response

Nightwatch.js Version

3.3.2

Node Version

18.18.2

Browser

No response

Operating System

MacOS

Additional Information

👋 Hi there

I'm a maintainer of the create-vue project. Recently the support for Nighwatch has been added, which means Vue users can generate a project with Vue 3 and Nightwatch out of the box.

We're moving create-vue to Vite 5, which requires us to add type: module to the generated projects.
This change makes the TS versions of the projects generated with Nightwatch fail.
Is there a workaround for this behavior?

@beatfactor beatfactor added the bug label Nov 27, 2023
@beatfactor beatfactor assigned beatfactor and unassigned beatfactor Nov 27, 2023
haoqunjiang added a commit to vuejs/create-vue that referenced this issue Dec 5, 2023
With the exception of Nighwatch templates due to nightwatchjs/nightwatch#3959

Closes #389
Largely inspired by @cexbrayat's work in that PR.

I've also made the generation of the root `tsconfig.json` programmatic
because it's becoming more and more convoluted.

Co-authored-by: Cédric Exbrayat <cexbrayat@users.noreply.github.com>
@garg3133 garg3133 self-assigned this Dec 7, 2023
@garg3133
Copy link
Member

@cexbrayat Hi, we've made the necessary changes in Nightwatch, and with Nightwatch v3.3.4, it should now work with tests written in TS when type=module is set in package.json.

Can you please confirm at your end and make the necessary changes in create-vue project?

@cexbrayat
Copy link
Author

It looks like it does, thanks 👍
I'll update create-vue

cexbrayat added a commit to cexbrayat/create-vue that referenced this issue Dec 11, 2023
nightwatch v3.3.4 fixed nightwatchjs/nightwatch#3959

I removed the custom assertions and commands, as they don't work out-of-the-box, they are not used in the generated tests, and they bring little value compared to the official nightwatch documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants