cenfun / monocart-reporter-examples

Monocart Reporter Test Examples
8 stars 0 forks source link

Question: Do we have a slack notify integration example to run after merging tests from jest and playwright #6

Closed pratiksyngenta closed 6 months ago

pratiksyngenta commented 7 months ago

I am able to run the slack web api to run onEnd after e2e test execution is done.

But I have jest unit test cases and playwright e2e tests.

I am able to merge it using

const EC = require('eight-colors');
const MCR = require('monocart-coverage-reports');

const slackWebApi = require('./playwright-slack-notify');

const coverageOptions = {
  name: 'My Merged Coverage Report',
  inputDir: ['./jest-tests-results/raw', './e2e-tests-result/ct/raw'],
  outputDir: './tests-coverage-combined',
  reports: [['lcov'], ['console-summary']],
  onEnd: async (reportData, helper) => {
    // slack integration with web api
    // await slackWebApi(reportData, helper);
  }
};

const generate = async () => {
  // clean cache first
  await MCR(coverageOptions).cleanCache();
  console.log('generate merge coverage reports ...');
  const coverageResults = await MCR(coverageOptions).generate();
  console.log('merge coverage reportPath', EC.magenta(coverageResults.reportPath));
};
generate();

Trying to use https://github.com/cenfun/monocart-reporter-examples/tree/main/integrations/slack-web-api I guess onEnd I dont get reportData, helper here in this case.. can you please suggest

cenfun commented 7 months ago

the coverage reporter onEnd hook is different with monocart-reporter, see example here https://github.com/cenfun/monocart-coverage-reports/tree/main?tab=readme-ov-file#onend-hook