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

Focus not working in FunSpecs #1376

Closed
ps-feng opened this issue Apr 11, 2020 · 6 comments
Closed

Focus not working in FunSpecs #1376

ps-feng opened this issue Apr 11, 2020 · 6 comments
Assignees
Labels
bug 🐛 Issues that report a problem or error in the code. framework 🏗️ Pertains to the core structure and components of the Kotest framework.

Comments

@ps-feng
Copy link

ps-feng commented Apr 11, 2020

This is not working for FunSpecs:

internal class SomeTest : FunSpec() {
    init {
        context("f:my test") {
            test("something") { ... }
        }
    }
}

According to the documentation, wouldn't context be considered a top-level scope and thus should work? Or is this a special case?

@sksamuel
Copy link
Member

What is the expected behavior in this case. You're focusing the only test, so it should run?

@ps-feng
Copy link
Author

ps-feng commented Apr 11, 2020

The example was not explicit enough perhaps so let me try again. Ideally I'd be able to focus on a single test but I was under the impression this is supported:

internal class SomeTest : FunSpec() {
    init {
        context("f:my test 1") {
            test("something 1") { ... }
            test("something 2") { ... }
        }
        context("my test 2") {
            test("blabla") { ... }
            test("lala") { ... }
        }
    }
}

I'd expect something 1 and something 2 to be executed, as the top-level f:my test 1 is focused.

@sksamuel
Copy link
Member

sksamuel commented Apr 11, 2020 via email

sksamuel added a commit that referenced this issue Apr 11, 2020
@sksamuel
Copy link
Member

I've added test and they pass. Are you on 4.0.2 ?

@ps-feng
Copy link
Author

ps-feng commented Apr 11, 2020

I am on 4.0.2. I've just tested this and it doesn't work:

internal class BlaBlaTest : FunSpec() {

    init {
        context("f:some test") {
            test("should run") {
                1 shouldBe 1
            }
            test("should run 2") {
                2 shouldBe 1
            }
        }
        context("other test") {
            test("should never run") {
                3 shouldBe 4
            }
        }
    }
}

image
image

@LeoColman LeoColman added bug 🐛 Issues that report a problem or error in the code. framework 🏗️ Pertains to the core structure and components of the Kotest framework. labels Apr 14, 2020
@sksamuel sksamuel self-assigned this Apr 26, 2020
sksamuel added a commit that referenced this issue Apr 26, 2020
@sksamuel
Copy link
Member

Thanks for this bug report. It is now fixed in master and will be included in 4.0.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Issues that report a problem or error in the code. framework 🏗️ Pertains to the core structure and components of the Kotest framework.
Projects
None yet
Development

No branches or pull requests

3 participants