chore: temporarily disable floating promise warning messages

This commit is contained in:
Adam Gastineau 2025-02-27 10:42:08 -08:00
parent 08ea36caa2
commit cb56e78e9f
3 changed files with 7 additions and 1 deletions

View file

@ -270,7 +270,8 @@ export class TerminalReporter implements ReporterV2 {
if (full && summary.failuresToPrint.length && !this._omitFailures)
this._printFailures(summary.failuresToPrint);
this._printSlowTests();
this._printWarnings();
// TODO: 1.52: Make warning display prettier
// this._printWarnings();
this._printSummary(summaryMessage);
}

View file

@ -23,6 +23,9 @@ export class FloatingPromiseScope {
* **NOTE:** Returning from an async function wraps the result in a promise, regardless of whether the return value is a promise. This will automatically mark the promise as awaited. Avoid this.
*/
wrapPromiseAPIResult<T>(promise: Promise<T>): Promise<T> {
if (process.env.PW_DISABLE_FLOATING_PROMISES_WARNING)
return promise;
const promiseProxy = new Proxy(promise, {
get: (target, prop, receiver) => {
if (prop === 'then') {

View file

@ -324,6 +324,8 @@ export class WorkerMain extends ProcessRunner {
// Create warning if any of the async calls were not awaited in various stages.
const checkForFloatingPromises = (functionDescription: string) => {
if (process.env.PW_DISABLE_FLOATING_PROMISES_WARNING)
return;
if (!testInfo._floatingPromiseScope.hasFloatingPromises())
return;
testInfo.annotations.push({ type: 'warning', description: `Some async calls were not awaited by the end of ${functionDescription}. This can cause flakiness.` });