Skip to content
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

Cuppa should merge test blocks with the same path #61

Open
joebandenburg opened this issue Feb 12, 2016 · 4 comments
Open

Cuppa should merge test blocks with the same path #61

joebandenburg opened this issue Feb 12, 2016 · 4 comments

Comments

@joebandenburg
Copy link
Member

when("a", () -> {
    it("test1");
});
when("a", () -> {
    it("test2");
});

Expected:

Reports a single a when block with two tests, test1 and test2, nested under it.

Actual:

Reports two a when blocks with one test nested under each.

@joebandenburg
Copy link
Member Author

How will this work with hooks? It isn't clear to me.

@joebandenburg
Copy link
Member Author

Perhaps this is just a concern for reporting. I'm still not quite sure we should do this. One problem it introduces is that it breaks the 1-to-1 relationship between a test/testblock and the code that defined it. How would an editor jump to the right place in code?

@mrpotes
Copy link
Member

mrpotes commented Feb 14, 2016

I'd expect an error for this to be honest
On 14 Feb 2016 16:51, "Joe Bandenburg" [email protected] wrote:

Perhaps this is just a concern for reporting. I'm still not quite sure we
should do this. One problem it introduces is that it breaks the 1-to-1
relationship between a test/testblock and the code that defined it. How
would an editor jump to the right place in code?


Reply to this email directly or view it on GitHub
#61 (comment)
.

@joebandenburg
Copy link
Member Author

I can think of plausible use cases where the user may want blocks with the same name. For example, the user has some high-level components and wants all tests relating to each component under a top-level describe for that component. In that situation, it's likely that multiple test files would start with the same describe("high-level component") call.

At this point I don't know enough to say whether that is good or bad practice, so I'd prefer not to rule it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants