-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Support ESM specs with Mocha #5809
Conversation
Source: https://mochajs.org/api/mocha#loadFilesAsync |
@diachedelic thanks a lot for the patch. I think you need to adapt the Mocha mock to get tests passing. |
Mocha#loadFiles only support CommonJS, so I replaced it with Mocha#loadFilesAsync which supports both CommonJS and ESM.
Ah yes, done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks!
Did it pass all the tests? @christian-bromann Looks like after update to 6.4.7 I can't run any test with |
Running |
@unickq it passed all tests and was released with the latest version. |
weird. I had to downgrade it back to 6.4.0 for all my ts projects. Thanks anyway |
same. I had to downgrade it back to 6.4.0 for all my ts projects. |
@unickq @vchuchkalov could you provide a minimal reproducible example? |
this happens when there is no function implementation or other errors before the test starts
my |
Probably found why it happens. framework: "mocha",
mochaOpts: {
ui: "bdd",
timeout: 90000,
require: [
"ts-node/register",
"tsconfig-paths/register",
"src/wdio/browserCommands",
],
}, Just noticed that it throws warn on 6.4.0 as well.
But tests are running even with this warning. After update to 6.4.7 - I see the same warning, but tests don't start. So if I remove "src/wdio/browserCommands" from mochaOpts - everything is gonna be fine, but I won't have my commands active.
@christian-bromann so is there a correct way to config custom commands for TS? |
You can also use the |
example.zip And yes, looks like moving |
I can confirm that if a spec fails to load, it is immediately reported as a success (try including some invalid syntax and you'll see what I mean), and I'm not using typescript. |
I'm seeing some of my tests fail to load starting in 6.4.7 and had to back down to 6.4.0 - could this PR be the cause of #5874 ? |
@alecf could you please post your wdio.log for the failing specs? When my specs failed to load, the error message was printed in there. |
@diachedelic I'll post it over in #5874 |
Proposed changes
Mocha#loadFiles only support CommonJS, so I replaced it with
Mocha#loadFilesAsync which supports both CommonJS and ESM.
Types of changes
Checklist
Further comments
Reviewers: @webdriverio/project-committers