Skip to content

Advice regarding indeterminate callbacks #1964

Closed
@natzcam

Description

@natzcam

How best to approach this?

test.cb('2 callbacks', t => {
    t.plan(2);

    const alice = new Alice();
    alice.on('connect', () => {
        t.pass();
        t.end(); //?
    });

    const bob = new Bob();
    bob.on('connect', () => {
        t.pass();
        t.end(); //?
    });
});

There is no guarantee which connect callback will be called first, but I need to assert that both got called. Promise.all could solve this but are there any alternatives?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions