Rayrun
← Back to Discord Forum

How to disable the output

After running a test playwright produces a test-results folder, which I'd rather not have Just need the console output telling me if a test has passed or not. I've tried disabling workings, setting outputDir to nothing and I cannot find anything online about how to do this.

Is this even possible?

This thread is trying to answer question "How to disable the output of a test-results folder in Playwright?"

4 replies

test-results includes important artifacts like traces which are pretty much Playwright's bread and butter. What's the use case here? Is it perhaps a disk space issue?

No wasnt that. I'm just using playwright for simple tests so wanted to opt out, but if I cant I guess thats ok

Answering your other question, i sure get the feeling it is more a hardware issue...

Use the most simple reporter or write your own silent reporter

Answer

Disabling 'test-results' Folder Creation in Playwright

Yes, you can stop Playwright from creating a 'test-results' folder. This folder is where test artifacts are stored by default. But you can change this or disable it.

Using the Command Line

Use the --output option when running Playwright tests from the command line. By default, it's set to test-results. You can change it to any directory or an empty string to disable it.

Here's how to run tests without creating a 'test-results' folder:

npx playwright test --output ""

This command stops Playwright from creating any output directory for test artifacts.

Using a Configuration File

If you're using a configuration file (playwright.config.ts or playwright.config.js), you can pass options directly in it. Define the reporter property with an array containing 'html' as the first element and specify additional options within an object.

Here's how to configure Playwright in your configuration file to disable the 'test-results' folder:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  reporter: [['html', { outputFolder: '' }]],
});

In this example, we set the outputFolder option to an empty string (''). This effectively stops creating any output folder for test results.

These methods let you customize where Playwright stores test artifacts or disable their creation. This gives you flexibility in managing your test results according to your needs.

Related Discord Threads

TwitterGitHubLinkedIn
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.