Is there any way to define `@BeforeClass` / `@Afte...
# multiplatform
Is there any way to define
in multiplatform common tests? AFAICT these annotations are JVM-only at the moment šŸ˜ž I could add cleanup after each test, but that's a bit overkill, and may not work for every use case.
there's kotlin.test.BeforeClass/kotlin.test.AfterClass on native, but right, nothing for JS/common
@ephemient Ok, thanks, that's what I feared... šŸ˜­
@Big Chungus this is
/`@After` behaviour, where setup/cleanup is executed for each test. I'm looking for a single setup/cleanup for all tests.
@Before Old can easily be added to that class. @After might be more tricky
Oops, accidentally tagged someone
But in most cases beforeEach and afterEach are good alternatives to before and after if you don't mind losing a bit of performance
are already supported out of the box on all platforms, though: So I already have this option without extra hack (which is what I'm doing now), but I wanted to have class-level hooks to avoid unnecessary work (I use these hooks to generate reports).
Hmm, can't recall why I've made my own. But I was aware of those already.
it looks like QUnit, Jasmine, Mocha, Jest, and Karma all support some form of beforeAll()/afterAll() (called before()/after() in some), so I feel like Kotlin's test adapter should be able to translate somehowā€¦ I don't know how to make that happen, though.
Yeah I have the same feeling. Since it's explicitly stated in the
docs that it's not supported in common code, I don't think the Kotlin team just "forgot". There is likely some blocker they must have faced but I'd be interested in knowing what exactly.
I haven't found any open issue in YouTrack regarding this, btw. Will probably open one for tracking