Skip to content

Commit 52af0b6

Browse files
committed
fix more tests
1 parent 617c253 commit 52af0b6

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

lib/container.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,10 @@ async function loadSupportObject(modulePath, supportObjectName) {
696696

697697
// If it's a plain object
698698
if (actualObj && typeof actualObj === 'object') {
699+
// Call _init if it exists (for page objects)
700+
if (actualObj._init && typeof actualObj._init === 'function') {
701+
actualObj._init()
702+
}
699703
return actualObj
700704
}
701705

lib/mocha/asyncWrapper.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ function test(test) {
101101
}
102102
event.emit(event.test.finished, test)
103103
})
104+
recorder.add('fire test.after', () => {
105+
event.emit(event.test.after, test)
106+
})
104107
recorder.add('finish test', doneFn)
105108
recorder.catch()
106109
}

lib/recorder.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,14 @@ export default {
285285
err = new Error(`[Wrapped Error] ${JSON.stringify(err)}`) // we should be prepared for them
286286
}
287287
if (customErrFn) {
288-
return customErrFn(err)
288+
try {
289+
const result = customErrFn(err)
290+
// If customErrFn returns a value (not throwing), treat it as handled
291+
return result
292+
} catch (thrownErr) {
293+
// If customErrFn throws an error, propagate it up
294+
throw thrownErr
295+
}
289296
}
290297
}))
291298
},

0 commit comments

Comments
 (0)