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
Can I use prepareSpec without @AutoScan? #3979
Comments
You can define
Where object KotestConfig : AbstractProjectConfig() {
override fun extensions() = listOf(
PrepareSpecTestListener()
)
} That should get rid of runtime detection while also letting you configure Kotest. |
Thanks! That almost worked.. I get an error though:
Would that be because I pass a mock into the spec constructor? e.g., class MySpec(@MockkBean private val foo: Foo) : DescribeSpec({
//
}) |
Moving the parameters out of the |
@dondod sorry for taking so long.. It's because the SpringAutowireConstructorExtensions from kotest-extensions-spring relies on You probably also want to register the SpringExtension |
Thanks @Kantis! This works well in many cases for me (reducing test startup time by 7-8 seconds), but now the mocks declared by |
Feel free to post a small example repo 🙂 |
Thanks, I'll try that soon.. |
I currently use an approach like the following to set up a database schema before tests run. It needs to happen before any test class is loaded.
But this generates this warning:
I've tried disabling
autoscan
in another project that doesn't need the database setup, and it speeds up the test startup by several seconds (maybe 5 or more).Is there a way to use
prepareSpec
without using@AutoScan
?The text was updated successfully, but these errors were encountered: