0

I have a framework ready in cypress, now I want my execution stats to be posted to discord or slack. Now to do that I have written a after:run method in plugin/index.js and I am getting the stats. I am getting stuck not when I am trying to send the stats to slack.

/// <reference types="cypress" />

module.exports = (on, config) => {
on('after:run', (results) => {if (results) {

    abc = results.totalPassed, 'out of all tests', results.totalTests, 'passed'
    //console.log(results.totalPassed, 'out of all tests', results.totalTests, 'passed')
     got.post(
      'SLACK WEBHOOK IRL',
      { body: {content: abc}, json: true }
     );
  }})
}

I tried axios as well but I am constantly getting axios/got not defined. and if I add an Import statement then I am getting an error message saying Import cannot be outside of module.

Not sure what is the currect path here to get this activity done.

User_NW
  • 11
  • 1
  • Does this answer your question? [Node.js: SyntaxError: Cannot use import statement outside a module](https://stackoverflow.com/questions/62488898/node-js-syntaxerror-cannot-use-import-statement-outside-a-module) – agoff Dec 20 '21 at 17:23

0 Answers0