Skip to content

test: abstract utility to use Promise.withResolvers for deferred promises - #3056

Draft
davidgamero wants to merge 1 commit into
kubernetes-client:mainfrom
davidgamero:with-resolvers-feedback
Draft

test: abstract utility to use Promise.withResolvers for deferred promises#3056
davidgamero wants to merge 1 commit into
kubernetes-client:mainfrom
davidgamero:with-resolvers-feedback

Conversation

@davidgamero

Copy link
Copy Markdown
Contributor

followup for #3052

implement feedback from @cjihrig

clean up repeated deferred testing function

adopt Promise.withResolvers() doc link

// old wrapper
function deferred<T = void>() {
        let resolve!: (value: T | PromiseLike<T>) => void;
        const promise = new Promise<T>((done) => (resolve = done));
        return { promise, resolve };
}
// new wrapper
export function deferred<T = void>() {
    return Promise.withResolvers<T>();
}

@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 10, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: davidgamero

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant