← Back to Discord Forum

Multiple reporters only running 1 of the 2 listed

cod3r_54237posted in #help-playwright
Open in Discord

Hey everyone, I'm trying to use 2 reporters in my Playwright config file. I need HTML, and a custom reporter that sends metrics to our Grafana/Hosted Graphite dashboard that shows us which tests are failing and which are passing. I am able to run one or the other, whichever is listed first, but it will not run both and I'm not sure why.

Code is in the format of: const config: PlaywrightTestConfig = { some other code here reporter: [ ['html', './reporter-file.ts'] ], more code here },

I have tried multiple variations of reporter: [['html'], ['./reporter-file.ts']], and it's still only running the first one. If I list the reporter file first, then HTML, then we don't get an HTML report, but it does send the metrics to Hosted Graphite as expected. We need both on every run.

Any ideas would be greatly appreciated! 🙏

This thread is trying to answer question "Why is only one of two reporters running in a Playwright config file?"

11 replies

Based on silly mistakes I've made myself is ./reporter-file.ts definitely the right path relative to the config file?

Scratch that, my mistake for commenting before finishing reading your message 🤦‍♂️



isn't working that sounds like a bug to me and might be worth raising an issue on the PW Test github repo, if it's not already an issue that's been raised! https://github.com/microsoft/playwright/issues?q=is%3Aissue+is%3Aopen

@testdouble: Thanks! I was wondering if that may be the case or if it was something silly on my end. Thank you for taking a look!

Thanks! I was wondering if that may be the case or if it was something silly on my end. Thank you for taking a look!

I just noticed we are on playwright/test version 1.32.3 and 1.39 is the newest. When I updated it, it broke a bunch of files and won't run our e2e tests. Once I get that working, I'll post again with the results of the multiple reporter issue in case anyone else has the same issue. I'll post a link to a bug ticket if I have to open one too.

Nice one, always great to see other people caring about contributing 🙂

@cod3r_54237 Can you guide me how to configure Grafana/Hosted Graphite dashboard

@cod3r_54237 Yep, would appreciate for some help in implementing the custom reporter to grafana

@samsuthen @ondra123. I'm sorry I missed your messages!

I followed the doc here https://playwright.dev/docs/test-reporters#custom-reporters Using the HTML reporter and custom reporter. Keep in mind, when you send the metrics, they MUST have \n after each metric so graphite can separate multiple metrics (even if you're only sending 1 at a time)

import net from 'net';
class CustomReporter implements Reporter {
  private socket: net.Socket;
  private graphiteHost = ‘your graphite URL goes here';
  private graphitePort = 'port number goes here';
  private metricList: string[] = [];
  constructor() {
    this.socket = net.createConnection(this.graphitePort, this.graphiteHost);
  onTestEnd(test: TestCase, result: TestResult) {
    const metricName = `hosted-graphite-key-goes-here.playwright.${test.title}.${result.status}`;
    const metricValue = 1;
    const timestamp = Math.floor(Date.now() / 1000);
    this.metricList.push(`${metricName} ${metricValue} ${timestamp}`);
  onEnd() {
    this.metricList.forEach((metric) => {
    // Close the connection
  private sendMetric(metric: string) {
export default CustomReporter;```

Update: Updated from 1.32.3 to 1.40.1 and it's having a slightly different issue. With 2 reporters listed, it ignores the html reporter and always runs my custom reporter for HG metrics. Does not show the HTML results no matter what order I list them. Bug reported here: https://github.com/microsoft/playwright/issues/28718

Looking at your original post this looks wrong... reporter: [ ['html', './reporter-file.ts'] ],

Shouldn't it be an array of arrays of reported as per the docs?

reporter: [ ['list'], ['json', { outputFile: 'test-results.json' }] ],

Could be an issue but might be best to follow what is in the docs?

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.