Skip to content

fix: transform root suite to non-root when non-root id matches root id #644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

KuznetsovRoman
Copy link
Member

@KuznetsovRoman KuznetsovRoman commented Mar 27, 2025

Example: https://nda.ya.ru/t/JsP7_JVY7D85nm

Status: issues with parent and child nodes. WIP

id: 's1 s2',
name: 's1 s2',
parentId: null,
root: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Root suite

id: 's1 s2',
name: 's2',
parentId: 's1',
root: false,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now its non-root suite with "s1" being parent suite

@@ -160,6 +160,14 @@ export class BaseTestsTreeBuilder {
const suite: TreeSuite = {id, parentId, name, suitePath, root: isRoot};

this._addSuite(suite);
} else if (!isRoot && suites.byId[id].root) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about case

describe("Some", function() {
    describe("Nesting suite", function() {
        it("it");
    });
});

describe("Some", function() {
    describe("Nesting", function() {
        it("suite it");
    });
});

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[13:27:36 +0300] Error: Tests with the same title 'Some Nesting suite it' in file 'testplane-tests/example.testplane.ts' can't be used
    at /testing-project/node_modules/testplane/src/test-reader/test-parser.ts:191:23

Copy link
Member Author

@KuznetsovRoman KuznetsovRoman Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed condition to "if current suite has more items in suitePath"

@KuznetsovRoman KuznetsovRoman force-pushed the TESTPLANE-488.suite_nesting branch 2 times, most recently from f60659c to 0d71e21 Compare April 10, 2025 22:15
@KuznetsovRoman KuznetsovRoman force-pushed the TESTPLANE-488.suite_nesting branch from 0d71e21 to 306578b Compare April 10, 2025 22:21
@@ -160,6 +160,17 @@ export class BaseTestsTreeBuilder {
const suite: TreeSuite = {id, parentId, name, suitePath, root: isRoot};

this._addSuite(suite);
} else if (suitePath.length > suites.byId[id].suitePath.length) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can do it in function with a name that explains what's going on in it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment would be more clear

@KuznetsovRoman KuznetsovRoman marked this pull request as draft April 18, 2025 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants