mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore(pw-test): forward web-server stdout to debug target (#11384)
This commit is contained in:
parent
93a20ee419
commit
badb5b4d13
@ -139,7 +139,7 @@ export const test = base.extend<{ saveLogs: void }>({
|
||||
|
||||
To launch a server during the tests, use the `webServer` option in the [configuration file](#configuration-object).
|
||||
|
||||
You can specify a port via `port` or additional environment variables, see [here](#configuration-object). The server will wait for it to be available (on `127.0.0.1` or `::1`) before running the tests. For continuous integration, you may want to use the `reuseExistingServer: !process.env.CI` option which does not use an existing server on the CI.
|
||||
You can specify a port via `port` or additional environment variables, see [here](#configuration-object). The server will wait for it to be available (on `127.0.0.1` or `::1`) before running the tests. For continuous integration, you may want to use the `reuseExistingServer: !process.env.CI` option which does not use an existing server on the CI. To see the stdout, you can set the `DEBUG=pw:webserver` environment variable.
|
||||
|
||||
The port gets then passed over to Playwright as a [`param: baseURL`] when creating the context [`method: Browser.newContext`].
|
||||
|
||||
|
||||
@ -567,7 +567,7 @@ export default config;
|
||||
|
||||
Launch a development web server during the tests.
|
||||
|
||||
The server will wait for it to be available on `127.0.0.1` or `::1` before running the tests. For continuous integration, you may want to use the `reuseExistingServer: !process.env.CI` option which does not use an existing server on the CI.
|
||||
The server will wait for it to be available on `127.0.0.1` or `::1` before running the tests. For continuous integration, you may want to use the `reuseExistingServer: !process.env.CI` option which does not use an existing server on the CI. To see the stdout, you can set the `DEBUG=pw:webserver` environment variable.
|
||||
|
||||
The port gets then passed over to Playwright as a `baseURL` when creating the context [`method: Browser.newContext`].
|
||||
For example `8080` ends up in `baseURL` to be `http://localhost:8080`. If you want to use `https://` you need to manually specify
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
import net from 'net';
|
||||
import os from 'os';
|
||||
import stream from 'stream';
|
||||
import debug from 'debug';
|
||||
import { monotonicTime } from './util';
|
||||
import { raceAgainstDeadline } from 'playwright-core/lib/utils/async';
|
||||
import { WebServerConfig } from './types';
|
||||
@ -33,6 +34,8 @@ const newProcessLogPrefixer = () => new stream.Transform({
|
||||
},
|
||||
});
|
||||
|
||||
const debugWebServer = debug('pw:webserver');
|
||||
|
||||
export class WebServer {
|
||||
private _killProcess?: () => Promise<void>;
|
||||
private _processExitedPromise!: Promise<any>;
|
||||
@ -79,7 +82,7 @@ export class WebServer {
|
||||
this._killProcess = kill;
|
||||
|
||||
launchedProcess.stderr!.pipe(newProcessLogPrefixer()).pipe(process.stderr);
|
||||
launchedProcess.stdout!.on('data', () => {});
|
||||
launchedProcess.stdout!.on('data', (line: Buffer) => debugWebServer(line.toString()));
|
||||
}
|
||||
|
||||
private async _waitForProcess() {
|
||||
|
||||
4
packages/playwright-test/types/test.d.ts
vendored
4
packages/playwright-test/types/test.d.ts
vendored
@ -572,7 +572,7 @@ interface TestConfig {
|
||||
*
|
||||
* The server will wait for it to be available on `127.0.0.1` or `::1` before running the tests. For continuous
|
||||
* integration, you may want to use the `reuseExistingServer: !process.env.CI` option which does not use an existing server
|
||||
* on the CI.
|
||||
* on the CI. To see the stdout, you can set the `DEBUG=pw:webserver` environment variable.
|
||||
*
|
||||
* The port gets then passed over to Playwright as a `baseURL` when creating the context
|
||||
* [browser.newContext([options])](https://playwright.dev/docs/api/class-browser#browser-new-context). For example `8080`
|
||||
@ -1061,7 +1061,7 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
|
||||
*
|
||||
* The server will wait for it to be available on `127.0.0.1` or `::1` before running the tests. For continuous
|
||||
* integration, you may want to use the `reuseExistingServer: !process.env.CI` option which does not use an existing server
|
||||
* on the CI.
|
||||
* on the CI. To see the stdout, you can set the `DEBUG=pw:webserver` environment variable.
|
||||
*
|
||||
* The port gets then passed over to Playwright as a `baseURL` when creating the context
|
||||
* [browser.newContext([options])](https://playwright.dev/docs/api/class-browser#browser-new-context). For example `8080`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user