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

[Request] Compatibility with Kotest's StringSpec #74

Open
paco-sparta opened this issue Oct 10, 2022 · 0 comments
Open

[Request] Compatibility with Kotest's StringSpec #74

paco-sparta opened this issue Oct 10, 2022 · 0 comments

Comments

@paco-sparta
Copy link

Expected behaviour

Either of the cases below produces a snapshot:

class SomeTest : StringSpec({
  "Base Test" {
    val value = 1
    value.matchWithSnapshot()

    val kotlinSnapshot =
      KotlinSnapshot(snapshotsFolder = "src/test/kotlin/com/test", testClassAsDirectory = true)
    kotlinSnapshot.matchWithSnapshot(value)
  }
})

Actual behaviour

Kotlin Snapshot library couldn't find the name of the test. Review if the test case file or the spec file contains the word test or spec or specify a snapshot name manually, this is a requirement needed to use Kotlin Snapshot
com.karumi.kotlinsnapshot.exceptions.TestNameNotFoundException: Kotlin Snapshot library couldn't find the name of the test. Review if the test case file or the spec file contains the word test or spec or specify a snapshot name manually, this is a requirement needed to use Kotlin Snapshot
	at com.karumi.kotlinsnapshot.core.Camera.extractTestCaseName(Camera.kt:120)

Steps to reproduce

  1. Build a project with Kotest
  val kotestVersion = "4.4.3"
  testImplementation("io.kotest:kotest-runner-junit5-jvm:$kotestVersion")
  1. Create a test as above
  2. Run the test

Version of the library

2.3.0

Gradle version

7.X

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

No branches or pull requests

1 participant