cherry-pick(#15901): fix(test-runner): multiple webServer types (#15916)

SHA: 004cd9273c
This commit is contained in:
Max Schmitt 2022-07-25 11:20:19 +02:00 committed by GitHub
parent 0776b954c3
commit 1b2cb1c7b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 2 deletions

View file

@ -487,7 +487,7 @@ interface TestConfig {
* ```
*
*/
webServer?: TestConfigWebServer;
webServer?: TestConfigWebServer | TestConfigWebServer[];
/**
* Configuration for the `expect` assertion library. Learn more about [various timeouts](https://playwright.dev/docs/test-timeouts).
*

View file

@ -391,3 +391,29 @@ test('should work with undefined values and base', async ({ runInlineTest }) =>
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(1);
});
test('should have correct types for the config', async ({ runTSC }) => {
const result = await runTSC({
'playwright.config.ts': `
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
webServer: [
{
command: 'echo 123',
env: { PORT: '123' },
port: 123,
},
{
command: 'echo 123',
env: { NODE_ENV: 'test' },
port: 8082,
},
],
};
export default config;
`
});
expect(result.exitCode).toBe(0);
});

View file

@ -58,7 +58,7 @@ type LiteralUnion<T extends U, U = string> = T | (U & { zz_IGNORE_ME?: never });
interface TestConfig {
reporter?: LiteralUnion<'list'|'dot'|'line'|'github'|'json'|'junit'|'null'|'html', string> | ReporterDescription[];
webServer?: TestConfigWebServer;
webServer?: TestConfigWebServer | TestConfigWebServer[];
}
export interface Config<TestArgs = {}, WorkerArgs = {}> extends TestConfig {