-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
execution order difference between jest-jasmine2 and jest-circus #8360
Comments
@SimenB Is the top to bottom order here something we want to keep in circus? Could probably be done by merging |
I think the current behavior makes more sense, doesn't it? @scotthovestadt @thymikee thoughts? |
I would prefer the behavior of jasmine2. In my use case I use E.g.:
|
I just observed this while investigating migrating a flow test (which uses I prefer the old test order. To provide some context, my tests look roughly like this: describe('My site', () => {
let driver;
let page;
let page2;
let page3;
beforeAll(() => {
driver = /* make selenium driver */;
});
it('loads the welcome page', async () => {
page = new MyPageObject(driver);
expect(await page.getTitle()).toEqual('My site');
});
describe('home page', () => {
it('says hi', async () => {
expect(await page.getMessage()).toEqual('hi');
});
// ...
});
it('advances to page 2 when next is clicked', async () => {
const page2 = await page.clickNext();
expect(await page2.getTitle()).toEqual('Another page');
});
describe('page 2', () => {
it('has a list', async () => {
expect(await page2.getItems()).toEqual(['foo', 'bar']);
});
// ...
});
it('advances to page 3 when next is clicked', async () => {
const page3 = await page2.clickNext();
expect(await page3.getTitle()).toEqual('Final page');
});
describe('page 3', () => {
it('shows details', async () => {
expect(await page3.getDetails()).toEqual('my details');
});
// ...
});
}); Each test may depend on state built-up by a previous test, and launching a new browser session and re-building that state each time is needlessly time consuming. But it's nice to still keep the details of what's being tested broken up into individual tests and describe blocks (if anything fails it's easy to see what part of the flow failed). It is possible to re-shuffle |
I'm worried about this as well. Tests should run in the order they're declared; running all the cases first and the suites second is confusing. I can't think of any technical reasons or benefits for circus to reorder them the way it is. |
I think we should adapt this to match Jasmine's behavior. It's more flexible. If you want to run all tests first, then all sub-describes, sure, reorder them. If you want to mix order because it makes for a better grouping, sure, we should allow that. |
Currently implementing this, slightly scared by the fact that there seems to be no existing test failing because of it :D But maybe it makes sense nobody has written this, we're probably so used to writing order-independent tests that we don't even think of any execution order as a requirement. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
https://jestjs.io/docs/en/setup-teardown#order-of-execution-of-describe-and-test-blocks
manual says execution order of describe and test blocks should be
while this is true for jest-jasmine2
In jest-circus, it is not work as expected
To Reproduce
Just use same source in manual with jest-jasmine2 or jest-circus
Expected behavior
execution order must be same
Link to repl or repo (highly encouraged)
none
The text was updated successfully, but these errors were encountered: