<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: v1.35.1</li>
<li>Operating System: Windows 11</li>
<li>Browser: None (Unit testing)</li>
<li>Other info:</li>
</ul>
<h3 dir="auto">Source code</h3>
<p dir="auto"><strong>Test file (self-contained)</strong></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="    import { expect, test } from &quot;@playwright/test&quot;;

    test('Playwright promise rejection with finally', async () =&gt; {
        let p = new Promise((resolve, reject) =&gt; {
            reject('failed');
        });

        p.finally(() =&gt; {
            console.log('finally');
        });

        let has_failed = false;
        try {
            await p;
        } catch (e) {
            has_failed = true;
        }
        expect(has_failed).toStrictEqual(true);
    });

    test('Playwright promise rejection without finally', async () =&gt; {
        let p = new Promise((resolve, reject) =&gt; {
            reject('failed');
        });

        let has_failed = false;
        try {
            await p;
        } catch (e) {
            has_failed = true;
        }
        expect(has_failed).toStrictEqual(true);
    });"><pre class="notranslate">    <span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">expect</span><span class="pl-kos">,</span> <span class="pl-s1">test</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">"@playwright/test"</span><span class="pl-kos">;</span>

    <span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">'Playwright promise rejection with finally'</span><span class="pl-kos">,</span> <span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-k">let</span> <span class="pl-s1">p</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">Promise</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">resolve</span><span class="pl-kos">,</span> <span class="pl-s1">reject</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
            <span class="pl-en">reject</span><span class="pl-kos">(</span><span class="pl-s">'failed'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

        <span class="pl-s1">p</span><span class="pl-kos">.</span><span class="pl-en">finally</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
            <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'finally'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

        <span class="pl-k">let</span> <span class="pl-s1">has_failed</span> <span class="pl-c1">=</span> <span class="pl-c1">false</span><span class="pl-kos">;</span>
        <span class="pl-k">try</span> <span class="pl-kos">{</span>
            <span class="pl-k">await</span> <span class="pl-s1">p</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span> <span class="pl-k">catch</span> <span class="pl-kos">(</span><span class="pl-s1">e</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
            <span class="pl-s1">has_failed</span> <span class="pl-c1">=</span> <span class="pl-c1">true</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span>
        <span class="pl-en">expect</span><span class="pl-kos">(</span><span class="pl-s1">has_failed</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">toStrictEqual</span><span class="pl-kos">(</span><span class="pl-c1">true</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">'Playwright promise rejection without finally'</span><span class="pl-kos">,</span> <span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-k">let</span> <span class="pl-s1">p</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">Promise</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">resolve</span><span class="pl-kos">,</span> <span class="pl-s1">reject</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
            <span class="pl-en">reject</span><span class="pl-kos">(</span><span class="pl-s">'failed'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

        <span class="pl-k">let</span> <span class="pl-s1">has_failed</span> <span class="pl-c1">=</span> <span class="pl-c1">false</span><span class="pl-kos">;</span>
        <span class="pl-k">try</span> <span class="pl-kos">{</span>
            <span class="pl-k">await</span> <span class="pl-s1">p</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span> <span class="pl-k">catch</span> <span class="pl-kos">(</span><span class="pl-s1">e</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
            <span class="pl-s1">has_failed</span> <span class="pl-c1">=</span> <span class="pl-c1">true</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span>
        <span class="pl-en">expect</span><span class="pl-kos">(</span><span class="pl-s1">has_failed</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">toStrictEqual</span><span class="pl-kos">(</span><span class="pl-c1">true</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>




<p dir="auto"><strong>Config file</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
    testDir: './tests',
    fullyParallel: true,
    reporter: 'html',
    use: {
        trace: 'on-first-retry'
    },

    timeout: 5 * 60 * 1000,

    expect: {
        timeout: 30000,
    },

    projects: [
        {
            name: 'unit_tests',
            testMatch: /.*\.unit\.ts/
        },
    ],
});"><pre class="notranslate"><span class="pl-c">// playwright.config.ts</span>
<span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">defineConfig</span><span class="pl-kos">,</span> <span class="pl-s1">devices</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'@playwright/test'</span><span class="pl-kos">;</span>

<span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-en">defineConfig</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
    <span class="pl-c1">testDir</span>: <span class="pl-s">'./tests'</span><span class="pl-kos">,</span>
    <span class="pl-c1">fullyParallel</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">reporter</span>: <span class="pl-s">'html'</span><span class="pl-kos">,</span>
    <span class="pl-c1">use</span>: <span class="pl-kos">{</span>
        <span class="pl-c1">trace</span>: <span class="pl-s">'on-first-retry'</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>

    <span class="pl-c1">timeout</span>: <span class="pl-c1">5</span> <span class="pl-c1">*</span> <span class="pl-c1">60</span> <span class="pl-c1">*</span> <span class="pl-c1">1000</span><span class="pl-kos">,</span>

    <span class="pl-c1">expect</span>: <span class="pl-kos">{</span>
        <span class="pl-c1">timeout</span>: <span class="pl-c1">30000</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>

    <span class="pl-c1">projects</span>: <span class="pl-kos">[</span>
        <span class="pl-kos">{</span>
            <span class="pl-c1">name</span>: <span class="pl-s">'unit_tests'</span><span class="pl-kos">,</span>
            <span class="pl-c1">testMatch</span>: <span class="pl-pds"><span class="pl-c1">/</span>.<span class="pl-c1">*</span><span class="pl-cce">\.</span>unit<span class="pl-cce">\.</span>ts<span class="pl-c1">/</span></span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">]</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Steps</strong></p>
<ul dir="auto">
<li>Run the first test : it fails</li>
<li>Run the second test : it works fine</li>
</ul>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">Both should work the same</p>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: 1.32.2 (experimental-ct-react)</li>
<li>Operating System: macOS Ventura 13.0</li>
<li>Browser: All</li>
<li>Other info: playwright uses <code class="notranslate">vite@2.8.6</code> to build for production (shown when running cmd in terminal). For the reproduction I added vite to <code class="notranslate">peerDependencies</code> using version <code class="notranslate">2.8.6</code> which is causing the error. This is not exactly how it is in the package of the repository where the error appeared first. There, playwright just uses another vite version that is used in some other package of the monorepo and remains using that version even if I update vite in that package and the particular version number <code class="notranslate">2.8.6</code> only remains appearing in the <code class="notranslate">pnpm-lock.yaml</code> for the whole monorepo. When I run <code class="notranslate">pnpm --filter "@*/components" test:units</code> so all packages use <code class="notranslate">4.2.1</code> playwright then also uses <code class="notranslate">4.2.1</code> and then everything works as expected</li>
</ul>
<h3 dir="auto">Source code</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I provided exact source code that allows reproducing the issue locally.</li>
</ul>




<p dir="auto"><strong>Link to the GitHub repository with the repro</strong></p>
<p dir="auto"><a href="https://github.com/lukaskoeller/playwright-ct-vite-reproduction">Github Reproduction</a></p>
<p dir="auto"><strong>Steps</strong></p>
<p dir="auto">Using the <a href="https://github.com/lukaskoeller/playwright-ct-vite-reproduction">reproduction from github</a></p>
<ul dir="auto">
<li><code class="notranslate">pnpm i</code></li>
<li><code class="notranslate">pnpm --filter "@ct/components" test:units</code></li>
</ul>
<p dir="auto">Using your own repro</p>
<ul dir="auto">
<li>Add <code class="notranslate">@playwright/experimental-ct-react17</code></li>
<li>Add <code class="notranslate">"vite": "^2.8.6"</code> to <code class="notranslate">peerDependencies</code></li>
<li>Run <code class="notranslate">pnpm i</code></li>
<li>Run test via <code class="notranslate">pnpm test-ct</code></li>
<li>Playwright will show <code class="notranslate">vite v2.8.6 building for production…</code></li>
<li>Test fails with <code class="notranslate">Invalid option in transform() call: "jsxSideEffects"</code>.</li>
</ul>
<p dir="auto"><strong>Expected</strong></p>
<ul dir="auto">
<li>All tests are running through</li>
<li>or playwright exits with an error informing me that the vite version is not supported and shows min supported vite version</li>
<li>or playwright just informs me that it is using another vite version to run the tests instead of the referenced version</li>
</ul>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">Test run fails with error <code class="notranslate">Invalid option in transform() call: "jsxSideEffects"</code>.</p>