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

Rework tests for Discord.JS v14 #110

Open
mkevenaar opened this issue Jul 25, 2022 · 2 comments
Open

Rework tests for Discord.JS v14 #110

mkevenaar opened this issue Jul 25, 2022 · 2 comments

Comments

@mkevenaar
Copy link
Owner

Not a comment for change, just an FYI. My analysis is that the test is doing 'async work' after the Client is constructed. Bad practice? Yes. Reality? Also yes.

This is a problem we could solve by mocking. It's not easy and takes quite some Jest digging. Your comment is 100% justified here.

Originally posted by @davidzwa in #105 (comment)

@davidzwa
Copy link
Collaborator

davidzwa commented Jul 25, 2022

image
In this image you can see how much work it took me to get the test to even skip without error... yeah 'skip' not even 'run'.

Maybe I need to back down the aforementioned statement that it seems like async calls happening (I said this because Jest said 'operations ... are still running after all tests finished'). When calling import {...} from 'discord.js' in any way or form the test already fails, which is not even calling the imported function. Could it be that there is a CJS file in discord's lib causing a stir and therefore causing import issues?

My initial thought was it was triggered on new Client(...) but I'm definitely speaking too soon. No async calls,... a CJS file throwing a tantrum. I cannot imagine this issue isnt known to discord.js. Lets check that instead

@Lucxjo
Copy link
Collaborator

Lucxjo commented Dec 30, 2023

I know that it has been over a year since this issue was opened but I decided that I was going to work on some stuff over the weekend. After battling with the mongo-memory plugin a bit (issues on my end, not with the code) it seems like this issue has already been fixed, probably by an update in Discord.js itself. I assume we are safe to close?
Screenshot from 2023-12-30 19-33-31

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

No branches or pull requests

3 participants