Skip to content

Conversation

@mrazauskas
Copy link
Contributor

@mrazauskas mrazauskas commented Apr 7, 2022

Following up #12641

Summary

jest-core supports two kinds of test runner. What if jest-runner would expose two abstract classes, which would help to implement either kind of the runner?

For instance create-jest-runner could use these types here. Not to say that I would like to have this for my test runner ;D

Todo:

  • add type tests to prove all works as expected
  • documentation would be nice too

Test plan

Green CI.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, this is awesome!

(Changelog?)

const runnerContext = {} as TestRunnerContext;

class CallbackRunner extends CallbackTestRunner {
async runTests(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping that override here in a test could catch some drift (hence #12648). Apparently override has no effect in this case, because methods are marked abstract.

In the other hand, abstract requires to implement those methods in a derived class. So to have this test passing is still good.

@mrazauskas mrazauskas requested a review from SimenB April 8, 2022 08:05
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonderful!

@SimenB SimenB merged commit 420ba45 into jestjs:main Apr 8, 2022
@mrazauskas mrazauskas deleted the feat-test-runner-types branch April 8, 2022 08:40
@SimenB
Copy link
Member

SimenB commented May 3, 2022

@mrazauskas wanna take a stab at a PR in create-jest-runner that uses this? 🙂

@mrazauskas
Copy link
Contributor Author

Yes, I was looking at it already. Will do it after finishing jest.Mocked (which is all working already, I just want to write more tests).

@SimenB
Copy link
Member

SimenB commented May 3, 2022

Awesome 🎉

@github-actions
Copy link

github-actions bot commented Jun 3, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants