You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Guys I've tried to open an issue as a feature request in @japa/runner repository, but the link is broken, it keeps redirecting to new issues page.
I miss a lot of writing tests using classes in Node.js. I've already done a very basic implementation on top of @japa/runner, but I think is not a very nice implementation since I'm not exposing the Japa test class and group class API. Writing tests using classes is easier to organize and read the code. We could also use inheritance to set up hooks and other tests defaults in some BaseTest class.
Some example of how I imagine it:
import{Test,TestGroup,AfterAll,BeforeEach}from'@japa/runner'// <- @japa/core maybe?
@TestGroup()// <- Expose group API via optionsexportclassMyTest{// Class name would be the default group name
@BeforeEach()publicasyncbeforeEach(){// do something}
@AfterAll()publicasyncafterAll(){// do something}
@Test()// <- Expose test API via optionspublicasyncshouldBeAbleToRunThisTest({ assert }){assert.equal(1,1)}}
Another way to expose the group/test API options would be using other decorators like @Pin() and @Timeout()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Guys I've tried to open an issue as a feature request in @japa/runner repository, but the link is broken, it keeps redirecting to new issues page.
I miss a lot of writing tests using classes in Node.js. I've already done a very basic implementation on top of @japa/runner, but I think is not a very nice implementation since I'm not exposing the Japa test class and group class API. Writing tests using classes is easier to organize and read the code. We could also use inheritance to set up hooks and other tests defaults in some
BaseTest
class.Some example of how I imagine it:
Another way to expose the group/test API options would be using other decorators like
@Pin()
and@Timeout()
Beta Was this translation helpful? Give feedback.
All reactions