-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: introduce the new reporter API #7069
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
This comment was marked as resolved.
This comment was marked as resolved.
@@ -0,0 +1,3 @@ | |||
# Test Lifecycle | |||
|
|||
<!-- TODO: lifecyle diagram and reporter API --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use vitepress-plugin-mermaid
for this? 🤔
https://emersonbottero.github.io/vitepress-plugin-mermaid/guide/styles.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe when the lifecycle is finalised
if we report suite hooks (
I think now it's better to have a single hook (
Should be |
@AriPerkkio should we update the |
Do we need that anywhere? I don't think
Yup, let's use
I'm not yet sure. The |
entity is a user facing API. I am asking if we should send the type to ourselves when we trigger |
a9c5863
to
64abbda
Compare
If it doesn't report it, we can start reporting it. I just don't understand why some hooks are reported and some not - I see it from the practical standpoint, but philosophically - why? What makes them more special? |
vitest/packages/vitest/src/node/reporters/task-parser.ts Lines 66 to 75 in 8764f5c
|
|
I'd like to remove the public |
some questions I have after working on the lifecycle diagram (need to polish it and add to the docs when we are finished) - right now it just reports when we call
Updated hooks proposal: |
a0861c2
to
b5b962f
Compare
} | ||
|
||
if ((event === 'suite-hook-start' || event === 'suite-hook-end') && entity.task.result?.hooks) { | ||
for (const hook of Object.keys(entity.task.result.hooks)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it report all hooks that it has? For example, after afterAll
, the task can have beforeAll
, beforeEach
, afterEach
and afterAll
in this object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't been able to get this part working fine yet. Feel free to change it, the test case in test-run.test.ts
should print tasks correctly once fixed.
|
||
// Skipped tests need to be reported manually once test module has finished | ||
for (const test of entity.children.allTests()) { | ||
if (test.result().state === 'skipped') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to report skipped tests? they won't have start
and calling them arbitrary at the end seems weird to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently this is how dot and summary reporters display skipped tests. Are there better ways for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can report them when any suite-finished
is emitted so it's at least timed with other tests, although the order is still wrong, - and they won't have start
event. Also if suite skips all tests, suite-finished
is never fired 🤔
I don't know what to do here, honestly (a new hook?), but the current solution is wrong on all levels 😄
We can just never report them, and do the thing you did here manually in every reporter
Description
THIS IS A DRAFT.
The current lifecycle ("run tests" has its own lifecycle):
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.