Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
38b967c
feat: introduce the new reporter API
sheremet-va Dec 11, 2024
25bae18
chore: cleanup
sheremet-va Dec 13, 2024
0998e4f
feat: introduce the new reporter API
sheremet-va Dec 11, 2024
6f0da08
chore: cleanup
sheremet-va Dec 13, 2024
64abbda
feat(reporters): add first 5/7 test run life cycles
AriPerkkio Dec 19, 2024
f3686b0
test: add initial test setup
AriPerkkio Dec 31, 2024
9cd58e9
fix: report skipped tests, prevent duplicate queued
AriPerkkio Dec 31, 2024
3f6edd5
fix: review
AriPerkkio Dec 31, 2024
1b8264a
Merge branch 'feat/new-reporter-api' of github.com:sheremet-va/vitest…
sheremet-va Jan 3, 2025
506cec5
refactor: don't allow undefined in getReportedEntity
sheremet-va Jan 3, 2025
2624054
refactor: move collecton/enqueued to the test runner
sheremet-va Jan 3, 2025
ef9a086
refactor: remove test.skipped()
sheremet-va Jan 3, 2025
10f3890
fix: correct skipped state
sheremet-va Jan 3, 2025
ebf3454
docs: cleanup
sheremet-va Jan 3, 2025
5d2bd70
docs: remove skipped from suite methods
sheremet-va Jan 3, 2025
cd291db
feat: add onTestModuleCollected
sheremet-va Jan 3, 2025
0ef6608
refactor: add events to TaskResultPack
sheremet-va Jan 3, 2025
d515785
docs: update result() docs
sheremet-va Jan 3, 2025
87d313b
docs: add state() docs
sheremet-va Jan 3, 2025
934087b
docs: fix result description
sheremet-va Jan 3, 2025
6567412
docs: update metadata docs
sheremet-va Jan 3, 2025
5e3b7cb
refactor: add event
sheremet-va Jan 3, 2025
20696a5
chore: fix ts error
sheremet-va Jan 3, 2025
ed1332e
fix: set event in typechecking
sheremet-va Jan 3, 2025
89baf8e
refactor: move log to test run
sheremet-va Jan 3, 2025
4afce13
refactor: move onFinished
sheremet-va Jan 3, 2025
4557b4b
fix: report skipped tests of suites
AriPerkkio Jan 4, 2025
3e0990e
Merge remote-tracking branch 'upstream/main' into feat/new-reporter-api
AriPerkkio Jan 4, 2025
1a74b1b
feat(reporter): `'dot'` to use new reporter API
AriPerkkio Jan 4, 2025
84ddc2f
refactor: mark readonly properties
sheremet-va Jan 4, 2025
1f03389
refactor: rename spec.module to spec.testModule
sheremet-va Jan 4, 2025
19fd301
docs: update options type, remove "reporter api" warning
sheremet-va Jan 4, 2025
be5b429
feat(reporter): summary to use new reporter API, except before & afte…
AriPerkkio Jan 4, 2025
02c0279
refactor: add comments and clarifications
sheremet-va Jan 7, 2025
1c8fb37
chore: cleanup
sheremet-va Jan 7, 2025
f6c3571
refactor: remove `TaskParser`, use new reporter API completely
AriPerkkio Jan 7, 2025
eb36354
refactor: rename new APIs
AriPerkkio Jan 7, 2025
0cef2b5
fix: resolve reporter life cycle from `onTaskUpdate` event field
AriPerkkio Jan 7, 2025
b5b962f
fix: report hooks only when they actually exist
AriPerkkio Jan 7, 2025
dd6ebc5
chore: add some test run docs and make arrays readonly
sheremet-va Jan 8, 2025
44ad507
docs: fix link
sheremet-va Jan 8, 2025
23730ae
Merge branch 'main' of github.com:vitest-dev/vitest into feat/new-rep…
sheremet-va Jan 8, 2025
c62f22b
refactor: add more docs, export TestRunEndReason and SerializedError
sheremet-va Jan 8, 2025
409c401
fix: attempt to get order right
AriPerkkio Jan 9, 2025
41985f3
fix: correct order for `TestCase`
AriPerkkio Jan 9, 2025
208466b
docs: document more hooks
sheremet-va Jan 9, 2025
2852271
refactor: rename hooks option
sheremet-va Jan 9, 2025
f8b657a
refactor: return diagnostic if test was retried
sheremet-va Jan 9, 2025
44f588d
fix: single `beforeEach/afterEach` working
AriPerkkio Jan 9, 2025
d98e4eb
fix: multiple `beforeEach/afterEach` working
AriPerkkio Jan 9, 2025
d9d652a
refactor: rename test-case's Start/End -> Ready/Result
sheremet-va Jan 10, 2025
97e51bd
test: refactor and add more tests
AriPerkkio Jan 11, 2025
c812be8
fix: report `beforeAll/afterAll` of `TestModule`
AriPerkkio Jan 11, 2025
a1b2051
refactor: don't parse events, keep the order in the runner (#3)
sheremet-va Jan 11, 2025
afe9935
chore: cleanup
sheremet-va Jan 11, 2025
8d1abdd
docs: add onTestSuiteReady/onTestSuiteResult
sheremet-va Jan 11, 2025
6a48858
chore: cleanup
sheremet-va Jan 11, 2025
3b087fe
Merge branch 'main' of github.com:vitest-dev/vitest into feat/new-rep…
sheremet-va Jan 11, 2025
8592c09
test: enable tests for suites
sheremet-va Jan 11, 2025
e56ffad
fix: don't report ctx.skip tests twice
sheremet-va Jan 11, 2025
328594d
chore: events
sheremet-va Jan 11, 2025
5c44c17
test: fix test
sheremet-va Jan 11, 2025
06669e7
docs: cleanup
sheremet-va Jan 11, 2025
330deee
fix: remove coverage from merge-reports
sheremet-va Jan 11, 2025
cb0110a
chore: always report onCoverage
sheremet-va Jan 11, 2025
db86137
fix: remove error with sharding
sheremet-va Jan 11, 2025
0fd1b76
test: fix snapshot
sheremet-va Jan 11, 2025
503cae0
refactor: cleanup
sheremet-va Jan 11, 2025
9947672
test: add tests with delay to not check sync updates only
AriPerkkio Jan 12, 2025
101a542
Merge remote-tracking branch 'upstream/main' into feat/new-reporter-api
AriPerkkio Jan 12, 2025
7dc23e6
fix: dot reporter to check suite tests too
AriPerkkio Jan 12, 2025
7a4dbff
chore: review fixes
AriPerkkio Jan 12, 2025
bcb6e71
docs: broken link
AriPerkkio Jan 12, 2025
6bc4f8d
docs: correct onCoverage
AriPerkkio Jan 12, 2025
bef1eee
chore: review fixes
AriPerkkio Jan 12, 2025
306a5cd
refactor: remove unused statistics from reported tasks
AriPerkkio Jan 13, 2025
50cf790
refactor: remove unused statistics from reported tasks
AriPerkkio Jan 13, 2025
cf0e14f
Merge remote-tracking branch 'upstream/main' into feat/new-reporter-api
AriPerkkio Jan 13, 2025
e5e9638
build: fix paths
AriPerkkio Jan 13, 2025
1a155c4
doc: jsdoc for reporter hooks
AriPerkkio Jan 13, 2025
1fd9697
chore: review, typos, revert formatting-only changes
AriPerkkio Jan 13, 2025
6d3b228
fix: report skipped tests in merge-reports
AriPerkkio Jan 13, 2025
ebff697
fix: add events to typechecker
AriPerkkio Jan 13, 2025
3e93fb3
Merge branch 'main' of github.com:vitest-dev/vitest into feat/new-rep…
sheremet-va Jan 14, 2025
b46340d
chore: merge reporters types
sheremet-va Jan 14, 2025
077f230
fix: call onTestRunStart/onTestRunEnd even if there are no files to run
sheremet-va Jan 14, 2025
33c8544
fix: don't call `onCoverage` hook if there is no coverage to report
sheremet-va Jan 14, 2025
59808e7
fix: correctly report merged reports
sheremet-va Jan 14, 2025
b4cb350
fix: correctly parse typecheck events and print TS icon in summary
sheremet-va Jan 14, 2025
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
14 changes: 10 additions & 4 deletions packages/vitest/src/node/test-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ export class TestRun {
this.queuedTestModules.add(entity.id)
queuedTestModules.push(entity)
}

// TODO: Check if skipped TestCases of finished module were reported.
// If not, get TestCases here and push them to TestCase arrays+sets.
}

if (state !== 'pending' && state !== 'queued' && !this.finishedTestModules.has(entity.id)) {
Expand All @@ -90,6 +87,14 @@ export class TestRun {
this.runningTestModules.add(entity.id)
runningTestModules.push(entity)
}

// Skipped tests need to be reported manually once test module has finished
for (const test of entity.children.tests()) {
if (!this.finishedTestCases.has(test.id)) {
this.finishedTestCases.add(test.id)
finishedTestCases.push(test)
}
}
}
}

Expand Down Expand Up @@ -118,7 +123,8 @@ export class TestRun {
await Promise.all(finishedTestCases.map(testCase => this.vitest.report('onTestCaseFinished', testCase)))
await Promise.all(finishedTestModules.map(module => this.vitest.report('onTestModuleFinished', module)))

await Promise.all(queuedTestModules.map(module => this.vitest.report('onTestModuleQueued', module)))
// TODO: Not needed as RPC has onQueued already. Do we want to remove that and centralize resolving here instead?
// await Promise.all(queuedTestModules.map(module => this.vitest.report('onTestModuleQueued', module)))
await Promise.all(runningTestModules.map(module => this.vitest.report('onTestModulePrepare', module)))
await Promise.all(runningTestCases.map(testCase => this.vitest.report('onTestCasePrepare', testCase)))
}
Expand Down
6 changes: 3 additions & 3 deletions test/reporters/tests/test-run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@
config: false,
include: ['./fixtures/task-parser-tests/*.test.ts'],
fileParallelism: false,
reporters: [reporter],

Check failure on line 15 in test/reporters/tests/test-run.test.ts

View workflow job for this annotation

GitHub Actions / Lint: node-latest, ubuntu-latest

Type 'CustomReporter' is not assignable to type 'Reporter | ReporterName | [ReporterName] | ["default", Partial<DefaultReporterOptions>] | [string & {}, Record<...>] | ... 10 more ... | [...]'.
sequence: { sequencer: Sorter },
})

expect(stdout).toBe('')
expect(stderr).toBe('')

// TODO: Missing skipped tests, missing hooks, queued is duplicated
// TODO: Missing hooks, queued is duplicated
expect(reporter.calls).toMatchInlineSnapshot(`
[
"|<process-cwd>/fixtures/task-parser-tests/example-1.test.ts| queued",
"|<process-cwd>/fixtures/task-parser-tests/example-1.test.ts| queued",
"|<process-cwd>/fixtures/task-parser-tests/example-1.test.ts| start",
"|<process-cwd>/fixtures/task-parser-tests/example-1.test.ts| RUN some test",
Expand All @@ -33,9 +32,9 @@
"|<process-cwd>/fixtures/task-parser-tests/example-1.test.ts| RUN parallel slow tests 1.2",
"|<process-cwd>/fixtures/task-parser-tests/example-1.test.ts| DONE parallel slow tests 1.1",
"|<process-cwd>/fixtures/task-parser-tests/example-1.test.ts| DONE parallel slow tests 1.2",
"|<process-cwd>/fixtures/task-parser-tests/example-1.test.ts| DONE Skipped test 1",
"|<process-cwd>/fixtures/task-parser-tests/example-1.test.ts| finish",
"|<process-cwd>/fixtures/task-parser-tests/example-2.test.ts| queued",
"|<process-cwd>/fixtures/task-parser-tests/example-2.test.ts| queued",
"|<process-cwd>/fixtures/task-parser-tests/example-2.test.ts| start",
"|<process-cwd>/fixtures/task-parser-tests/example-2.test.ts| RUN some test",
"|<process-cwd>/fixtures/task-parser-tests/example-2.test.ts| DONE some test",
Expand All @@ -45,6 +44,7 @@
"|<process-cwd>/fixtures/task-parser-tests/example-2.test.ts| RUN parallel slow tests 2.2",
"|<process-cwd>/fixtures/task-parser-tests/example-2.test.ts| DONE parallel slow tests 2.1",
"|<process-cwd>/fixtures/task-parser-tests/example-2.test.ts| DONE parallel slow tests 2.2",
"|<process-cwd>/fixtures/task-parser-tests/example-2.test.ts| DONE Skipped test 1",
"|<process-cwd>/fixtures/task-parser-tests/example-2.test.ts| finish",
]
`)
Expand Down
Loading