Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CodeceptJS 3.7.x: "tryTo" and "session" do not work together #5116

Closed
@danielrentz

Description

In CodeceptJS 3.7.x, using the tryTo effect inside a session makes a test hang forever. This works as expected in v3.6.10 with the old global tryTo plugin.

Simple example:

import { tryTo } from "codeceptjs/effects";
Scenario("[SESSION1]", async ({ I }) => {
 await tryTo(() => {
 I.say("SESSION1");
 });
});
Scenario("[SESSION2]", async ({ I }) => {
 await session("SESSION2", () => {
 I.say("SESSION2");
 });
});
Scenario("[SESSION3]", async ({ I }) => {
 await session("SESSION3", async () => {
 await tryTo(() => {
 I.say("SESSION3");
 });
 });
});

The third test case "SESSION3" will never end.

As far as I can tell from debugging inside the CodeceptJS source code, the root cause is that both session and tryTo want to start a new session via recorder.session.start(). But inside this function, an existing session is considered to be an error, and the outer session will be reset.

https://github.com/codeceptjs/CodeceptJS/blob/3.x/lib/recorder.js#L125

Metadata

Metadata

Assignees

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

      AltStyle によって変換されたページ (->オリジナル) /