fix(testServer): pass use options to listFiles command (#34832)
This commit is contained in:
parent
715123afbe
commit
1af4e367f4
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -184,10 +184,17 @@ export class TeleReporterEmitter implements ReporterV2 {
|
|||
dependencies: project.dependencies,
|
||||
snapshotDir: this._relativePath(project.snapshotDir),
|
||||
teardown: project.teardown,
|
||||
use: this._serializeProjectUseOptions(project.use),
|
||||
};
|
||||
return report;
|
||||
}
|
||||
|
||||
private _serializeProjectUseOptions(use: reporterTypes.FullProject['use']): Record<string, any> {
|
||||
return {
|
||||
testIdAttribute: use.testIdAttribute,
|
||||
};
|
||||
}
|
||||
|
||||
private _serializeSuite(suite: reporterTypes.Suite): teleReceiver.JsonSuite {
|
||||
const result = {
|
||||
title: suite.title,
|
||||
|
|
|
@ -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 });
|
||||
|
|
Loading…
Reference in New Issue