Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

93
Views
Cypress plugins file not awaiting/asyncing on after:run

I'm slightly new to cypress and was wondering why this code wasn't working on an after run step of cypress. I ran this code using node on terminal which works fine. However, when i put it within a cypress plugins file with after:run event it doesn't reach the console.log results and doesn't have an error. Any clue?

const{ WebClient} = required('@slack/web-api')
module.exports = {on, config} => {
   on('after:run', (results) => {


      if(results){
         (async () => {
             try{
                let web = new WebClient({slacktoken})
                let result = await web.chat.postMessage({
                    channel: {channel}
                    text: "hello world" 
                })
              console.log(result)
              }
              catch(error){
                  console.log(error)
              }
         })();
      }
   }
}
almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The answer is add async keyword on after:run function instead of its own

const{ WebClient} = required('@slack/web-api')
module.exports = {on, config} => {
   on('after:run', async(results) => {


      if(results){
             try{
                let web = new WebClient({slacktoken})
                let result = await web.chat.postMessage({
                    channel: {channel}
                    text: "hello world" 
                })
              console.log(result)
              }
              catch(error){
                  console.log(error)
              }
      }
   }
}
almost 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!