Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix: shut down workers before reporter.onEnd (#30329)" #30551

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/test-api/class-testconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default defineConfig({
* since: v1.10
- type: ?<[int]>

Maximum time in milliseconds the whole test suite can run. Zero timeout (default) disables this behavior. Useful on CI to prevent broken setup from running too long and wasting resources. Note that even if global timeout is reached, Playwright will still allow up to 30 extra seconds for teardown hooks to finish. Learn more about [various timeouts](../test-timeouts.md).
Maximum time in milliseconds the whole test suite can run. Zero timeout (default) disables this behavior. Useful on CI to prevent broken setup from running too long and wasting resources. Learn more about [various timeouts](../test-timeouts.md).

**Usage**

Expand Down
11 changes: 3 additions & 8 deletions packages/playwright/src/runner/taskRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,9 @@ export class TaskRunner<Context> {
status = 'failed';
}
cancelPromise?.resolve();
const cleanup = async () => {
// Upon hitting deadline we add extra 30s to actually perform cleanup, otherwise
// the task exits immediately because of the same deadline and we may continue
// while the test workers are still running.
const extraTime = timeoutWatcher.timedOut() ? 30_000 : 0;
const { status } = await teardownRunner.runDeferCleanup(context, deadline + extraTime);
return status;
};
// Note that upon hitting deadline, we "run cleanup", but it exits immediately
// because of the same deadline. Essentially, we're not performing any cleanup.
const cleanup = () => teardownRunner.runDeferCleanup(context, deadline).then(r => r.status);
return { status, cleanup };
}
}
Expand Down
3 changes: 1 addition & 2 deletions packages/playwright/types/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1101,8 +1101,7 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {

/**
* Maximum time in milliseconds the whole test suite can run. Zero timeout (default) disables this behavior. Useful on
* CI to prevent broken setup from running too long and wasting resources. Note that even if global timeout is
* reached, Playwright will still allow up to 30 extra seconds for teardown hooks to finish. Learn more about
* CI to prevent broken setup from running too long and wasting resources. Learn more about
* [various timeouts](https://playwright.dev/docs/test-timeouts).
*
* **Usage**
Expand Down
3 changes: 2 additions & 1 deletion tests/playwright-test/reporter-base.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ for (const useIntermediateMergeReport of [false, true] as const) {
});
expect(result.exitCode).toBe(1);
expect(result.passed).toBe(1);
expect(result.interrupted).toBe(1);
// TODO: uncomment once https://github.com/microsoft/playwright/issues/30550 is fixed.
// expect(result.interrupted).toBe(1);
expect(result.didNotRun).toBe(1);
expect(result.output).toContain('Timed out waiting 3s for the test suite to run');
});
Expand Down
2 changes: 2 additions & 0 deletions tests/playwright-test/runner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,8 @@ test('unhandled exception in test.fail should restart worker and continue', asyn
});

test('wait for workers to finish before reporter.onEnd', async ({ runInlineTest }) => {
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30550' });
test.fixme();
const result = await runInlineTest({
'playwright.config.ts': `
export default {
Expand Down
Loading