fix(testServer): pass use options to listFiles command

This commit is contained in:
Max Schmitt 2025-02-17 20:34:30 +01:00
parent 715123afbe
commit 9c544f60d0
3 changed files with 28 additions and 1 deletions

View file

@ -52,6 +52,7 @@ export type JsonProject = {
testIgnore: JsonPattern[];
testMatch: JsonPattern[];
timeout: number;
use: { [key: string]: any };
};
export type JsonSuite = {
@ -326,7 +327,7 @@ export class TeleReporterReceiver {
dependencies: project.dependencies,
teardown: project.teardown,
snapshotDir: this._absolutePath(project.snapshotDir),
use: {},
use: project.use,
};
}

View file

@ -184,6 +184,7 @@ export class TeleReporterEmitter implements ReporterV2 {
dependencies: project.dependencies,
snapshotDir: this._relativePath(project.snapshotDir),
teardown: project.teardown,
use: project.use,
};
return report;
}

View file

@ -120,6 +120,31 @@ test('file watching', async ({ startTestServer, writeFiles }, testInfo) => {
]);
});
test('should list tests with testIdAttribute', async ({ startTestServer, writeFiles }) => {
await writeFiles({
'a.test.ts': `
import { test } from '@playwright/test';
test('foo', () => {});
`,
'playwright.config.ts': `
module.exports = {
projects: [{
name: 'chromium',
use: {
testIdAttribute: 'testId',
}
}]
};
`,
});
const testServerConnection = await startTestServer();
const events = await testServerConnection.listFiles({});
const onProject = events.report.find(e => e.method === 'onProject').params.project;
expect(onProject.name).toBe('chromium');
expect(onProject.use.testIdAttribute).toBe('testId');
});
test('stdio interception', async ({ startTestServer, writeFiles }) => {
const testServerConnection = await startTestServer();
await testServerConnection.initialize({ interceptStdio: true });