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

Describe support #14

Open
webpapaya opened this issue Jan 9, 2020 · 6 comments
Open

Describe support #14

webpapaya opened this issue Jan 9, 2020 · 6 comments

Comments

@webpapaya
Copy link

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 😊

@ddneat
Copy link
Owner

ddneat commented Jan 10, 2020

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

@webpapaya
Copy link
Author

webpapaya commented Jan 12, 2020

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('...', () => {})
  })
})

@ddneat
Copy link
Owner

ddneat commented Jan 12, 2020

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

@ddneat
Copy link
Owner

ddneat commented Mar 1, 2020

@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

@marcelbeumer
Copy link
Collaborator

@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 (-)

@ddneat
Copy link
Owner

ddneat commented Mar 11, 2020

@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.

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

3 participants