<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.31.1]</li>
<li>Operating System: [All]</li>
<li>Browser: [not relevant]</li>
</ul>
<h3 dir="auto">Source code</h3>
<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: &quot;tests&quot;,
    testMatch: &quot;**/*.spec.ts&quot;,
...
});"><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-s1">testDir</span>: <span class="pl-s">"tests"</span><span class="pl-kos">,</span>
    <span class="pl-c1">testMatch</span>: <span class="pl-s">"**/*.spec.ts"</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>Test file (self-contained)</strong></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// test.utl.ts
import { expect, test } from &quot;@playwright/test&quot;;

export function sharedTest() {
    return test(&quot;The Shared Test&quot;, () =&gt; expect(true, &quot;the smart shared test&quot;).toBeTruthy());
}"><pre class="notranslate"><span class="pl-c">// test.utl.ts</span>
<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-k">export</span> <span class="pl-k">function</span> <span class="pl-en">sharedTest</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">"The Shared Test"</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-en">expect</span><span class="pl-kos">(</span><span class="pl-c1">true</span><span class="pl-kos">,</span> <span class="pl-s">"the smart shared test"</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">toBeTruthy</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>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// suiteN.spec.ts
...
test.describe.serial(&quot;Suite N&quot;, () =&gt; {
    test(&quot;Test A&quot;, () =&gt; {...});

    sharedTest();

    test(&quot;Test B&quot;, () =&gt; {...});
});"><pre class="notranslate"><span class="pl-c">// suiteN.spec.ts</span>
...
<span class="pl-s1">test</span><span class="pl-kos">.</span><span class="pl-c1">describe</span><span class="pl-kos">.</span><span class="pl-en">serial</span><span class="pl-kos">(</span><span class="pl-s">"Suite N"</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-en">test</span><span class="pl-kos">(</span><span class="pl-s">"Test A"</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-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-en">sharedTest</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">"Test B"</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-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>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="playwright test --list"><pre class="notranslate"><code class="notranslate">playwright test --list
</code></pre></div>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">The output contains the filenames and suites according to the <code class="notranslate">*.spec.ts</code> mask only.</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">The output contains also the permutations of  <code class="notranslate">test.utl.ts &gt; Suite N The Shared Test</code> instead of <code class="notranslate">suiteN.spec.ts &gt; Suite N The Shared Test</code></p>
<p dir="auto"><strong>Workaround</strong></p>
<p dir="auto">Not found.<br>
Trying to set config property <code class="notranslate">testIgnore: "**/test.utl.ts"</code> doesn't effect.</p>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: 1.32.2</li>
<li>Operating System: Pop!_OS 22.04</li>
<li>Browser: Chromium and WebKit (Firefox is ok)</li>
<li>Other info:</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>Config file</strong></p>
<p dir="auto">N/A</p>
<p dir="auto"><strong>Test file (self-contained)</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// script.mjs
import { chromium } from 'playwright-core'
// import { firefox as chromium } from 'playwright-core'
// import { webkit as chromium } from 'playwright-core'

const module = String(new URL('module.js', import.meta.url))

const browser = await chromium.launch({ headless: false })
const page = await browser.newPage({ bypassCSP: true })
// await page.goto(String(new URL('index.html', import.meta.url)))
await page.addScriptTag({ type: 'module', url: module })"><pre class="notranslate"><span class="pl-c">// script.mjs</span>
<span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">chromium</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'playwright-core'</span>
<span class="pl-c">// import { firefox as chromium } from 'playwright-core'</span>
<span class="pl-c">// import { webkit as chromium } from 'playwright-core'</span>

<span class="pl-k">const</span> <span class="pl-s1">module</span> <span class="pl-c1">=</span> <span class="pl-v">String</span><span class="pl-kos">(</span><span class="pl-k">new</span> <span class="pl-c1">URL</span><span class="pl-kos">(</span><span class="pl-s">'module.js'</span><span class="pl-kos">,</span> <span class="pl-k">import</span><span class="pl-kos">.</span><span class="pl-c1">meta</span><span class="pl-kos">.</span><span class="pl-c1">url</span><span class="pl-kos">)</span><span class="pl-kos">)</span>

<span class="pl-k">const</span> <span class="pl-s1">browser</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">chromium</span><span class="pl-kos">.</span><span class="pl-en">launch</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">headless</span>: <span class="pl-c1">false</span> <span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-k">const</span> <span class="pl-s1">page</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">browser</span><span class="pl-kos">.</span><span class="pl-en">newPage</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">bypassCSP</span>: <span class="pl-c1">true</span> <span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-c">// await page.goto(String(new URL('index.html', import.meta.url)))</span>
<span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">addScriptTag</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">type</span>: <span class="pl-s">'module'</span><span class="pl-kos">,</span> <span class="pl-c1">url</span>: <span class="pl-s1">module</span> <span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// module.js
console.log('hello')"><pre class="notranslate"><span class="pl-c">// module.js</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">'hello'</span><span class="pl-kos">)</span></pre></div>
<p dir="auto"><strong>Steps</strong></p>
<ul dir="auto">
<li>node script.mjs</li>
</ul>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto"><code class="notranslate">hello</code> is logged to the browser console.</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">In Chrome and WebKit, the script fails due to an error. Inspecting the network tab in the browser reveals this is a CSP error, despite <code class="notranslate">bypassCSP</code> being true.</p>
<p dir="auto">Likewise, a dynamic import inside <code class="notranslate">page.evaluate()</code> causes a CSP error.</p>
<p dir="auto">Creating an <code class="notranslate">index.html</code> file to navigate to doesn’t work either.</p>