Skip to content

Commit 78a0872

Browse files
Copilotkobenguyent
andcommitted
Changes before error encountered
Co-authored-by: kobenguyent <[email protected]>
1 parent d813730 commit 78a0872

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lib/listener/steps.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ const event = require('../event')
33
const store = require('../store')
44
const output = require('../output')
55
const { BeforeHook, AfterHook, BeforeSuiteHook, AfterSuiteHook } = require('../mocha/hooks')
6+
const recorder = require('../recorder')
67

78
let currentTest
89
let currentHook
910

11+
// Session names that should not contribute steps to the main test trace
12+
const EXCLUDED_SESSIONS = ['tryTo', 'hopeThat']
13+
1014
/**
1115
* Register steps inside tests
1216
*/
@@ -75,6 +79,14 @@ module.exports = function () {
7579
return currentHook.steps.push(step)
7680
}
7781
if (!currentTest || !currentTest.steps) return
82+
83+
// Check if we're in a session that should be excluded from main test steps
84+
const currentSessionId = recorder.getCurrentSessionId()
85+
if (currentSessionId && EXCLUDED_SESSIONS.includes(currentSessionId)) {
86+
// Skip adding this step to the main test steps
87+
return
88+
}
89+
7890
currentTest.steps.push(step)
7991
})
8092

lib/recorder.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,15 @@ module.exports = {
379379
toString() {
380380
return `Queue: ${currentQueue()}\n\nTasks: ${this.scheduled()}`
381381
},
382+
383+
/**
384+
* Get current session ID
385+
* @return {string|null}
386+
* @inner
387+
*/
388+
getCurrentSessionId() {
389+
return sessionId
390+
},
382391
}
383392

384393
function getTimeoutPromise(timeoutMs, taskName) {

0 commit comments

Comments
 (0)