From d65bdfb832740db27744ce33692895a219f8efdc Mon Sep 17 00:00:00 2001 From: Adam Gastineau Date: Wed, 5 Feb 2025 06:09:20 -0800 Subject: [PATCH] Added non-stable project name test --- tests/playwright-test/config.spec.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/playwright-test/config.spec.ts b/tests/playwright-test/config.spec.ts index 5550d84253..7870d74706 100644 --- a/tests/playwright-test/config.spec.ts +++ b/tests/playwright-test/config.spec.ts @@ -392,6 +392,24 @@ test('should print nice error when some of the projects are unknown', async ({ r expect(output).toContain('Project(s) "suIte3", "SUite4" not found. Available projects: "suite1", "suite2"'); }); +test('should print nice error when project name is not stable', async ({ runInlineTest }) => { + const { output, exitCode } = await runInlineTest({ + 'playwright.config.ts': ` + module.exports = { projects: [ + { name: \`calculated \$\{Date.now()\}\` }, + ] }; + `, + 'a.test.ts': ` + import { test, expect } from '@playwright/test'; + test('pass', async ({}, testInfo) => { + console.log(testInfo.project.name); + }); + ` + }); + expect(exitCode).toBe(1); + expect(output).toContain('not found in the worker process. Make sure project name does not change.'); +}); + test('should work without config file', async ({ runInlineTest }) => { const { exitCode, passed, failed, skipped } = await runInlineTest({ 'playwright.config.ts': `