]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/miscs/email.ts
Add ability for plugins to specify scale filter
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / miscs / email.ts
index b2a1093da5e07509b13b4d8d53026252a56c3642..758b15b58aff88bd81e6751b2766e9e3c33409b4 100644 (file)
@@ -1,4 +1,5 @@
 import { ChildProcess, fork } from 'child_process'
+import { join } from 'path'
 import { randomInt } from '../../core-utils/miscs/miscs'
 import { parallelTests } from '../server/servers'
 
@@ -10,9 +11,9 @@ class MockSmtpServer {
   private emails: object[]
 
   private constructor () {
-    this.emailChildProcess = fork(`${__dirname}/email-child-process`, [])
+    this.emailChildProcess = fork(join(__dirname, 'email-child-process'), [])
 
-    this.emailChildProcess.on('message', (msg) => {
+    this.emailChildProcess.on('message', (msg: any) => {
       if (msg.email) {
         return this.emails.push(msg.email)
       }
@@ -27,7 +28,7 @@ class MockSmtpServer {
 
       if (this.started) {
         this.emails = emailsCollection
-        return res()
+        return res(undefined)
       }
 
       // ensure maildev isn't started until
@@ -36,12 +37,12 @@ class MockSmtpServer {
       this.emailChildProcess.on('exit', () => {
         return rej(new Error('maildev exited unexpectedly, confirm port not in use'))
       })
-      this.emailChildProcess.on('message', (msg) => {
-        if (msg.err) {
-          return rej(new Error(msg.err))
-        }
+      this.emailChildProcess.on('message', (msg: any) => {
+        if (msg.err) return rej(new Error(msg.err))
+
         this.started = true
         this.emails = emailsCollection
+
         return res(port)
       })
     })