Skip to content

Commit c4e7172

Browse files
committed
fix failed UTs
1 parent 59c0fed commit c4e7172

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/unit/plugin/screenshotOnFail_test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ describe('screenshotOnFail', () => {
2222
})
2323
})
2424

25+
afterEach(() => {
26+
event.dispatcher.removeAllListeners(event.test.failed)
27+
})
28+
2529
it('should remove the . at the end of test title', async () => {
2630
screenshotOnFail({})
2731
event.dispatcher.emit(event.test.failed, createTest('test title.'))
@@ -68,7 +72,7 @@ describe('screenshotOnFail', () => {
6872
await recorder.promise()
6973
expect(screenshotSaved.called).is.ok
7074
const fileName = screenshotSaved.getCall(0).args[0]
71-
const regexpFileName = /test1_[0-9]{10}.failed.png/
75+
const regexpFileName = /test1_[0-9]{13}.failed.png/
7276

7377
expect(fileName.match(regexpFileName).length).is.equal(1)
7478
})
@@ -145,6 +149,10 @@ describe('screenshotOnFail', () => {
145149
})
146150
})
147151

152+
afterEach(() => {
153+
event.dispatcher.removeAllListeners(event.test.failed)
154+
})
155+
148156
it('should generate unique screenshot names for Data() iterations with uniqueScreenshotNames: true', async () => {
149157
screenshotOnFail({ uniqueScreenshotNames: true })
150158

0 commit comments

Comments
 (0)