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

Flaky tests runner #22991

Closed
wrnrlr opened this issue Mar 19, 2024 · 5 comments
Closed

Flaky tests runner #22991

wrnrlr opened this issue Mar 19, 2024 · 5 comments

Comments

@wrnrlr
Copy link

wrnrlr commented Mar 19, 2024

Version: Deno 1.41.3

Here are 3 screenshots I took one after the other where for exactly the same test Deno responded with 3 different behaviours only one of which is correct.

Screenshot 2024-03-19 at 22 46 26
Screenshot 2024-03-19 at 22 46 35
Screenshot 2024-03-19 at 22 47 17

This is not the only way in which Deno is broken. Another behaviour that I see it simply won't run the code inside the tests:

Screenshot 2024-03-19 at 23 29 51
Screenshot 2024-03-19 at 23 29 58

@mash-graz
Copy link
Contributor

yes -- as long as the progress indicators are still circling around the yellow dots, you feel excited like in an online casino ;)

Just use git commit --amend --no-edit and git push -f to get another chance if the error looks utterly unbelievable.

@wrnrlr
Copy link
Author

wrnrlr commented Mar 20, 2024

Sorry I don't understand your riddle or how or why this is solving my issue.

@mash-graz
Copy link
Contributor

mash-graz commented Mar 20, 2024

sorry -- I was writing about very similar experiences while contributing PRs to the deno github repo and getting similar confusing and always changing error reports back from the CI system, but you are talking about the behavior on your own local hardware.

So it's definitely not an issue related to your local setup but happening also in other execution contexts. But I have to say, that I did not see any of those flaky error reports during many local test runs her on my machine recently.

@0f-0b
Copy link
Contributor

0f-0b commented Mar 20, 2024

describe is used to group related tests. Actual test code should be put in an it block or a before*/after* hook. For example, you can initialize node in a beforeAll hook:

import { beforeAll, describe, it } from "jsr:@std/testing@^0.220.1/bdd";
import { assertEquals } from "jsr:@std/assert@^0.220.1/assert_equals";

describe("DOMNode", () => {
  let node;

  beforeAll(async () => {
    node = await xmlFromString();
  });

  it("in root namespace", () => assertEquals());
  it("in leaf namespace", () => assertEquals());
});
Deno.test equivalent
import { assertEquals } from "jsr:@std/assert@^0.220.1/assert_equals";

Deno.test("DOMNode", async (t) => {
  let node = await xmlFromString();

  await t.step("in root namespace", () => assertEquals());
  await t.step("in leaf namespace", () => assertEquals());
});

The error message could definitely be improved. Jest throws a helpful error if the callback passed to describe returns a promise or anything other than undefined.

@lucacasonato
Copy link
Member

@0f-0b is right. I am closing this and have opened a follow up in std to add an error message when one passes an async function to describe: denoland/std#5034

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

4 participants