diff options
author | Chocobozzz <me@florianbigard.com> | 2023-02-27 10:44:32 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-02-27 11:58:35 +0100 |
commit | 5b94394a1a6d471f897d14ac62fe7bec5f9a74c2 (patch) | |
tree | 2bc32ce7f620968f6eb5864f01b29af5a8869231 /server/tests/shared | |
parent | 2be1fecc99dbc788c01d8dea381126212960f8a1 (diff) | |
download | PeerTube-5b94394a1a6d471f897d14ac62fe7bec5f9a74c2.tar.gz PeerTube-5b94394a1a6d471f897d14ac62fe7bec5f9a74c2.tar.zst PeerTube-5b94394a1a6d471f897d14ac62fe7bec5f9a74c2.zip |
Fix E2E with firefox
Diffstat (limited to 'server/tests/shared')
-rw-r--r-- | server/tests/shared/mock-servers/mock-email.ts | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/server/tests/shared/mock-servers/mock-email.ts b/server/tests/shared/mock-servers/mock-email.ts index c518679c9..79bc22d58 100644 --- a/server/tests/shared/mock-servers/mock-email.ts +++ b/server/tests/shared/mock-servers/mock-email.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | import { ChildProcess } from 'child_process' | ||
2 | import MailDev from '@peertube/maildev' | 1 | import MailDev from '@peertube/maildev' |
3 | import { parallelTests, randomInt } from '@shared/core-utils' | 2 | import { parallelTests, randomInt } from '@shared/core-utils' |
4 | 3 | ||
@@ -6,7 +5,7 @@ class MockSmtpServer { | |||
6 | 5 | ||
7 | private static instance: MockSmtpServer | 6 | private static instance: MockSmtpServer |
8 | private started = false | 7 | private started = false |
9 | private emailChildProcess: ChildProcess | 8 | private maildev: any |
10 | private emails: object[] | 9 | private emails: object[] |
11 | 10 | ||
12 | private constructor () { } | 11 | private constructor () { } |
@@ -20,18 +19,18 @@ class MockSmtpServer { | |||
20 | return res(undefined) | 19 | return res(undefined) |
21 | } | 20 | } |
22 | 21 | ||
23 | const maildev = new MailDev({ | 22 | this.maildev = new MailDev({ |
24 | ip: '127.0.0.1', | 23 | ip: '127.0.0.1', |
25 | smtp: port, | 24 | smtp: port, |
26 | disableWeb: true, | 25 | disableWeb: true, |
27 | silent: true | 26 | silent: true |
28 | }) | 27 | }) |
29 | 28 | ||
30 | maildev.on('new', email => { | 29 | this.maildev.on('new', email => { |
31 | this.emails.push(email) | 30 | this.emails.push(email) |
32 | }) | 31 | }) |
33 | 32 | ||
34 | maildev.listen(err => { | 33 | this.maildev.listen(err => { |
35 | if (err) return rej(err) | 34 | if (err) return rej(err) |
36 | 35 | ||
37 | this.started = true | 36 | this.started = true |
@@ -42,11 +41,11 @@ class MockSmtpServer { | |||
42 | } | 41 | } |
43 | 42 | ||
44 | kill () { | 43 | kill () { |
45 | if (!this.emailChildProcess) return | 44 | if (!this.maildev) return |
46 | 45 | ||
47 | process.kill(this.emailChildProcess.pid) | 46 | this.maildev.shutdown() |
48 | 47 | ||
49 | this.emailChildProcess = null | 48 | this.maildev = null |
50 | MockSmtpServer.instance = null | 49 | MockSmtpServer.instance = null |
51 | } | 50 | } |
52 | 51 | ||