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

feat(testrunner): async suite descriptions #4723

Closed

Conversation

JoelEinbinder
Copy link
Collaborator

Alternative to #4721

Does this work?

@aslushnikov
Copy link
Contributor

Does this work?

@JoelEinbinder This mangles test order, basically top-sorting them. Consider running this snippet: https://gist.github.com/aslushnikov/93a8fa25655063187c64767969c33ae8

You'd expect tests to run sequentially, but in fact they run as 1, 4, 2, 3.

The suggestion is very fascinating though, thank you for bringing it up! 👍

Comparing to #4721:

  1. I don't like it because this is not how other test runners work. It makes test description asynchronous in a unique way - you don't know in which context and which point of time they are executed.
  2. I don't like it because it's a conceptual change driven by a rare use case that affects all users.
  3. I don't like it because debugging experience will suffer (can't step over spec definitions, stack traces are not nice)
  4. I like it because it drops the need for top-level await for descriptions
  5. I like it because it makes it harder to forget to await test suite, like in feat(testrunner): async suite descriptions #4721

So far I still lean towards #4721 primarily due to the ratio of simplicity / effort / importance, but I'm open to be convinced otherwise.

P.S. There's an interesting discussion on async testsuites in jest jestjs/jest#2235

@aslushnikov
Copy link
Contributor

So far I still lean towards #4721 primarily due to the ratio of simplicity / effort / importance, but I'm open to be convinced otherwise.

...convinced otherwise, especially if the importance of this proves to be significant

@JoelEinbinder
Copy link
Collaborator Author

Does this work?

@JoelEinbinder This mangles test order, basically top-sorting them. Consider running this snippet: https://gist.github.com/aslushnikov/93a8fa25655063187c64767969c33ae8

You'd expect tests to run sequentially, but in fact they run as 1, 4, 2, 3.

My bad, I didn't realize that addSuite and addTest were separate.

@JoelEinbinder
Copy link
Collaborator Author

Closing, this was just a discussion prop.

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

Successfully merging this pull request may close these issues.

None yet

2 participants