ddneat / tropic

🍍 Test Runner Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Describe support

webpapaya opened this issue · comments

I'm thinking about migrating away from mocha as I'm having quite a lot of watcher issues lately. eg. tests are executed twice or three times. The only thing which is holding me back right now is the missing describe block. It would be nice to get this feature 😊

Thanks for reporting your feature request. I would be highly interested to learn more about the underlying purpose of your need?

Are you seeking for a setup/teardown (before, beforeEach, after, ...), for grouping the output.log or rather adding skip/only to a set of tests?

Cheers

It's basically a way to group tests together and have more readable output

describe('a function', () => {
  describe('with condition A', () => {
    it('is sorted ASC', () => {})
    it('contains numbers only', () => {})
    it('...', () => {})
  })
  describe('with condition B', () => {
    it('is sorted ASC', () => {})
    it('contains strings only', () => {})
    it('...', () => {})
  })
})

Thanks for clarifying.

I'm very much familiar with the describe and understand your need of grouping tests, therefore I will look into it in the upcoming days.

Cheers

@webpapaya I just wanted to leave you a heads up! I implemented a concept, which aims to bring a mocha compatible describe API to tropic. https://github.com/ddneat/tropic-describe-concept

Please stay tuned: I'm looking forward to bring it to tropic asap! I'm very sorry for the delay!

Cheers

@ddneat took a quick peek at the concept, maybe I missed something, but I think I don't see the nesting logic implemented.

I think (not 100% sure; if different would love to know) this is what mocha implements (implemented here too in ugly code: https://github.com/marcelbeumer/simple-mocha-replacement/blob/master/index.ts), so you'd have to keep track of hierarchy

# +: will run
# -: will not run
descr (+)
   describe.only (+)
       describe (+)
           before(+)
            it (-)
            it.only (+)
       describe.only (+)
            it (+)
            it (+)
   describe (-)
   describe (-)
      describe (-)
         it (-)

@marcelbeumer thanks for having a closer look! :)

You will find the nesting in https://github.com/ddneat/tropic-describe-concept/blob/master/usage.js#L23-L35 and the test in https://github.com/ddneat/tropic-describe-concept/blob/master/runner.test.js#L15-L19 However I'm note sure how useful nesting mulitple suites within a test would be.

Also I agree that my concept is quite basic and is not covering every piece which would be necessary. Unfortunatly I have little resources for tropic available, I really hope to implement the describe functionality in the next week(s).

Your concept also seems promising! Thanks for sharing.

Cheers.