]> 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 d6219deb3bbf7e829c8f81876bf099962bec4476..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,7 +11,7 @@ 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: any) => {
       if (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
@@ -37,11 +38,11 @@ class MockSmtpServer {
         return rej(new Error('maildev exited unexpectedly, confirm port not in use'))
       })
       this.emailChildProcess.on('message', (msg: any) => {
-        if (msg.err) {
-          return rej(new Error(msg.err))
-        }
+        if (msg.err) return rej(new Error(msg.err))
+
         this.started = true
         this.emails = emailsCollection
+
         return res(port)
       })
     })