Skip to content

Commit 7610ddd

Browse files
committed
Trace data update
1 parent 186a69c commit 7610ddd

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

packages/service/src/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ export default class DevToolsHookService implements Services.ServiceInstance {
139139
this.#commandStack = []
140140
}
141141

142+
/**
143+
* Hook for Mocha/Jasmine.
144+
* It does the exact same thing as beforeScenario.
145+
*/
146+
beforeTest() {
147+
this.#lastCommandSig = null
148+
this.#commandStack = []
149+
}
150+
142151
async beforeCommand(command: string, args: string[]) {
143152
if (!this.#browser) { return }
144153

packages/service/src/reporter.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,20 @@ export class TestReporter extends WebdriverIOReporter {
2929
}
3030

3131
#sendUpstream () {
32-
const [uid, suite] = Object.entries(this.suites).find(([uid]) => isNaN(parseInt(uid))) || []
33-
if (uid && suite) {
34-
this.#report([{ [uid]: suite }])
32+
if (!this.suites) {
33+
return
34+
}
35+
36+
const payload: Record<string, SuiteStats>[] = []
37+
38+
for (const [uid, suite] of Object.entries(this.suites)) {
39+
if (suite) {
40+
payload.push({ [uid]: suite })
41+
}
42+
}
43+
44+
if (payload.length > 0) {
45+
this.#report(payload)
3546
}
3647
}
3748

0 commit comments

Comments
 (0)