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

align circus with jasmine's top-to-bottom execution order #9965

Merged
merged 4 commits into from
May 4, 2020

Conversation

jeysal
Copy link
Contributor

@jeysal jeysal commented May 3, 2020

Summary

Fixes #8360

Test plan

Added a test to globals.test failing on circus master but passing on Jasmine and circus PR.


const {summary, rest} = extractSummary(stderr);
expect(wrap(rest)).toMatchSnapshot();
expect(wrap(summary)).toMatchSnapshot();
expect(exitCode).toBe(0);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nicer to see the snapshot diff rather than just the wrong number in case something goes wrong, so I changed this for all test cases in here

Copy link
Member

Choose a reason for hiding this comment

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

yeah, good call. I've done that before as well for the same reason

@@ -28,12 +28,12 @@ export const makeDescribe = (
}

return {
type: 'describeBlock', // eslint-disable-next-line sort-keys
Copy link
Contributor Author

Choose a reason for hiding this comment

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

disabling next line works out quite nicely for this rule, you can associate it with the line that you want to take out of the flow, because the error would be on the next line 😅

@@ -136,7 +136,9 @@ export const getEachHooksForTest = (test: Circus.TestEntry): TestHooks => {
export const describeBlockHasTests = (
describe: Circus.DescribeBlock,
): boolean =>
describe.tests.length > 0 || describe.children.some(describeBlockHasTests);
describe.children.some(
child => child.type === 'test' || describeBlockHasTests(child),
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 love how the short-circuiting + union type narrowing works out here, so nice 😅

Copy link
Member

@cpojer cpojer left a comment

Choose a reason for hiding this comment

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

Nice work @jeysal 👍

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.

Thanks! Somewhat scary refactor but it looks sane and all tests pass 👍

@github-actions
Copy link

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 May 11, 2021
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.

execution order difference between jest-jasmine2 and jest-circus
4 participants