How to use the @serenity-js/core/lib/domain.Result.PENDING function in @serenity-js/core

To help you get started, we’ve selected a few @serenity-js/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jan-molak / serenity-js / packages / serenity-js / src / serenity-cucumber / cucumber_serenity_notifier.ts View on Github external
function serenityResultFrom(stepStatus: string, error?: Error): Result {
    const timeOut = (e: Error) => e && /timed out/.test(e.message);

    const results = {
        undefined: Result.PENDING,
        failed:    Result.FAILURE,
        pending:   Result.PENDING,
        passed:    Result.SUCCESS,
        skipped:   Result.SKIPPED,
    };

    if (! results[stepStatus]) {
        throw new Error(`Couldn't map the '${ stepStatus }' to a Serenity Result`);
    }

    return timeOut(error)
        ? Result.ERROR
        : results[stepStatus];
}
github jan-molak / serenity-js / packages / serenity-js / src / serenity-cucumber / cucumber_serenity_notifier.ts View on Github external
function serenityResultFrom(stepStatus: string, error?: Error): Result {
    const timeOut = (e: Error) => e && /timed out/.test(e.message);

    const results = {
        undefined: Result.PENDING,
        failed:    Result.FAILURE,
        pending:   Result.PENDING,
        passed:    Result.SUCCESS,
        skipped:   Result.SKIPPED,
    };

    if (! results[stepStatus]) {
        throw new Error(`Couldn't map the '${ stepStatus }' to a Serenity Result`);
    }

    return timeOut(error)
        ? Result.ERROR
        : results[stepStatus];
}
github jan-molak / serenity-js / packages / cucumber / src / transformations.ts View on Github external
function serenityResultFrom(stepStatus: string, error?: Error): Result {
    const timeOut = (e: Error) => e && /timed out/.test(e.message);

    const results = {
        undefined: Result.PENDING,
        ambiguous: Result.ERROR,
        failed:    Result.FAILURE,
        pending:   Result.PENDING,
        passed:    Result.SUCCESS,
        skipped:   Result.SKIPPED,
    };

    if (! results[stepStatus]) {
        throw new Error(`Couldn't map '${ stepStatus }' to a Serenity Result`);
    }

    return timeOut(error)
        ? Result.ERROR
        : results[stepStatus];
}
github jan-molak / serenity-js / packages / cucumber-2 / src / notifier.ts View on Github external
static from = (result: StepResult | ScenarioResult) => {
        const isTimeOut = (e: Error) => e && /timed out/.test(e.message);

        const results = {
            undefined: Result.PENDING,
            failed: Result.FAILURE,
            pending: Result.PENDING,
            passed: Result.SUCCESS,
            skipped: Result.SKIPPED,
        };

        if (!results[ result.status ]) {
            throw new Error(`Couldn't map the '${ result.status }' to a Serenity Result`);
        }

        return isTimeOut(realErrorFrom(result.failureException))
            ? Result.ERROR
            : results[ result.status ];
    }
}
github jan-molak / serenity-js / packages / serenity-js / spec / integration / mocha / recognises_scenario_results.ts View on Github external
return expect(spawned.result).to.be.eventually.fulfilled.then(() => {
                expect(spawned.messages).to.have.length.greaterThan(2);

                const event = lastOf(SceneFinished, spawned.messages);

                expect(Result[event.value.result]).to.equal(Result[Result.PENDING]);
            });
        });
github jan-molak / serenity-js / packages / mocha / spec / recognises_scenario_results.spec.ts View on Github external
return expect(spawned.result).to.be.eventually.fulfilled.then(() => {
                expect(spawned.messages).to.have.lengthOf(2);

                const event = lastOf(SceneFinished, spawned.messages);

                expect(Result[event.value.result]).to.equal(Result[Result.PENDING]);
            });
        });
github jan-molak / serenity-js / packages / cucumber-2 / spec / cucumber_adapter.spec.ts View on Github external
return expect(spawned.result).to.be.eventually.fulfilled.then(() => {
                expect(spawned.messages).to.have.lengthOf(4);

                expect(spawned.messages[0].value.name).to.equal(scenario);
                expect(spawned.messages[1].value.name).to.equal(step);
                expect(spawned.messages[2].value.subject.name).to.equal(step);
                expect(Result[spawned.messages[3].value.result]).to.equal(Result[Result.PENDING]);
                expect(spawned.messages[3].value.subject.name).to.equal(scenario);
                expect(Result[spawned.messages[3].value.result]).to.equal(Result[Result.PENDING]);
            });
        });
github jan-molak / serenity-js / packages / serenity-js / spec / integration / cucumber / recognises_scenario_results.ts View on Github external
return expect(spawned.result).to.be.eventually.fulfilled.then(() => {
                expect(spawned.messages).to.have.lengthOf(messagesPerStep);

                const lastMessage = spawned.messages.pop();

                expect(lastMessage).to.be.instanceOf(SceneFinished);
                expect(Result[lastMessage.value.result]).to.equal(Result[Result.PENDING]);
            });
        });
github jan-molak / serenity-js / packages / serenity-js / spec / integration / cucumber / recognises_scenario_results.ts View on Github external
lastMessages.forEach(lastMessage => {
                    expect(lastMessage).to.be.instanceOf(SceneFinished);
                    expect(Result[lastMessage.value.result]).to.equal(Result[Result.PENDING]);
                });
            });