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

chore: improve the test reporter's messaging #5724

Merged
merged 27 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8dbbcb1
chore: improve the test cancelled message
galargh Sep 5, 2024
d9bca64
chore: report on errors in before and describe during the test run
galargh Sep 5, 2024
3957b42
chore: do not display passing top-level files
galargh Sep 5, 2024
15a5eab
chore: remove suggestion that the user forgot to await a promise
galargh Sep 5, 2024
e1b17cf
chore: force unawaited nested it to go through event loop
galargh Sep 5, 2024
270f889
chore: make the unused diagnostics messages hardhat specific
galargh Sep 5, 2024
bfb1415
chore: remove ERR_TEST_FAILURE from the formatted error
galargh Sep 6, 2024
54b7df4
test: add an async describe test
galargh Sep 7, 2024
fee6fb5
chore: do not use async describe
galargh Sep 6, 2024
a698e68
feat: do not show cancelled by parent errors
galargh Sep 6, 2024
6127086
chore: regenerate async describe test
galargh Sep 7, 2024
bc0a738
chore: show test cancellations in grey
galargh Sep 7, 2024
4524cd2
Merge branch 'galargh/test-reporter-stack-cleanup' into galargh/test-…
galargh Sep 8, 2024
0f9b331
Merge remote-tracking branch 'origin/galargh/test-reporter-stack-clea…
galargh Sep 9, 2024
014748e
feat: allow customising test only message programatically
galargh Sep 9, 2024
ed509a9
feat: do not display tests failing with parent already finished in on…
galargh Sep 9, 2024
adf3818
Revert "chore: do not use async describe"
galargh Sep 9, 2024
8bb1bce
Merge remote-tracking branch 'origin/galargh/test-reporter-stack-clea…
galargh Sep 10, 2024
20f9b4f
chore: use nodeTestOptions in node-test-runner
galargh Sep 10, 2024
7807f9f
chore: revert custom handling applied to its cancelled by parent
galargh Sep 10, 2024
d43bf39
test: add a comprehensive test for async describe behaviour
galargh Sep 10, 2024
0903307
test: regenerate async-describe-test fixture with node v22.7.0
galargh Sep 10, 2024
5599b92
test: regenerate async-describe-test fixture with node v22.8.0
galargh Sep 10, 2024
6e4bf3a
Merge branch 'v-next' into galargh/test-reporter-ui
galargh Sep 11, 2024
c61f721
chore: remove extra dot at the end of a name of a test case
galargh Sep 11, 2024
8332321
chore: move global diagnostics modifications
galargh Sep 11, 2024
b415497
chore: move helper functions to a separate file
galargh Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions v-next/example-project/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ const config: HardhatUserConfig = {
],
plugins: [
pluginExample,
HardhatMochaTestRunner,
// HardhatMochaTestRunner,
// if testing node plugin, use the following line instead
// HardhatNodeTestRunner,
HardhatNodeTestRunner,
viemScketchPlugin,
],
paths: {
tests: "test/mocha",
// tests: "test/mocha",
// if testing node plugin, use the following line instead
// tests: "test/node",
tests: "test/node",
},
};

Expand Down
8 changes: 6 additions & 2 deletions v-next/example-project/test/node/other-example-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ import { describe, it } from "node:test";

import hre from "@ignored/hardhat-vnext";

describe("Other example test", () => {
describe("Other example test", async () => {
const taskName = await new Promise((resolve) =>
setTimeout(resolve, "example"),
);

it("should have the example task", () => {
assert.ok(hre.tasks.getTask("example"));
assert.ok(hre.tasks.getTask(taskName));
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"only": true
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
nested async describe with promise 1
1) should pass 2

1) nested async describe with promise 1

nested async describe 1
2) should pass 3

2) nested async describe 1

nested describe 1
3) should pass 4

3) nested describe 1


0 passing (131ms)
3 cancelled

1) nested async describe with promise 1:

Error: test could not be started because its parent finished
 at SuiteContext.<anonymous> (integration-tests/fixture-tests/async-describe-test/test.ts:1:244)

2) nested async describe 1:

Error: test could not be started because its parent finished
 at SuiteContext.<anonymous> (integration-tests/fixture-tests/async-describe-test/test.ts:1:422)

3) nested describe 1:

Error: test could not be started because its parent finished
 at SuiteContext.<anonymous> (integration-tests/fixture-tests/async-describe-test/test.ts:1:520)

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import assert from "node:assert/strict";
import { describe, it } from "node:test";

describe("async describe with promise 1", async () => {
const one = await new Promise((resolve) => setTimeout(() => resolve(1), 0));

it("should pass 1", async () => {
assert.equal(one, 1);
});

describe("nested async describe with promise 1", async () => {
const two = await new Promise((resolve) => setTimeout(() => resolve(2), 0));

it("should pass 2", async () => {
assert.equal(two, 2);
});
});

describe("nested async describe 1", async () => {
it("should pass 3", async () => {
assert.equal(one, 1);
});
});

describe("nested describe 1", () => {
it("should pass 4", async () => {
assert.equal(one, 1);
});
});
});

describe("async describe", async () => {
it("should pass 5", async () => {
assert.equal(1, 1);
});

describe("nested async describe with promise 2", async () => {
const two = await new Promise((resolve) => setTimeout(() => resolve(2), 0));

it("should pass 6", async () => {
assert.equal(two, 2);
});
});

describe("nested async describe 2", async () => {
it("should pass 7", async () => {
assert.equal(1, 1);
});
});

describe("nested describe 2", () => {
it("should pass 8", async () => {
assert.equal(1, 1);
});
});
});
Loading