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

Support for "given", "when" and so on #15

Open
vinci-mz opened this issue Jan 6, 2018 · 3 comments
Open

Support for "given", "when" and so on #15

vinci-mz opened this issue Jan 6, 2018 · 3 comments

Comments

@vinci-mz
Copy link

vinci-mz commented Jan 6, 2018

Hello,
first of all - thanks for the nice tool, which "acquit" is.
Let me notice that there exist some BDD extensions allowing to declare additional behavior of the tests - eg. "given" or "when" ( jasmine-rowtests or jasmine-given ). Currently acquit completely ignores such clauses eg.:

> var acquit = require('acquit');
> var parser = acquit();
> parser.parse('describe("test", function() { given("xx").it("bla", function() {} )}); ');

Though it nicely supports:
> parser.parse('describe("test", function() { for(i=1; i<10; i++) { it("bla", function() {} ); } }); ');

Would you like to add to acquit support for such cases ?

Kind regards,

@vkarpov15
Copy link
Owner

Thanks for your kind words! Unfortunately I've never used these tools, so I don't have any ideas on how acquit might surface these. How do you imagine the acquit output for given() and when() would look?

@vinci-mz
Copy link
Author

vinci-mz commented Jan 15, 2018

I imagine that acquit can analyse the results of some functions (like given() or when()) as objects, which method/property it() can be treated in the same way as a call of the "global" it().
The minimal support could be even limited just to the syntax given(...).it(...) and could produce the same output as in the case of global it(). For example, the acquit's result in the case of:

> parser.parse('describe("test", function() { given("xx").it("bla", function() {} )}); ');

could be even the same as in the case of:

> parser.parse('describe("test", function() { it("bla", function() {} )}); ');

At this moment it is [ { type: 'it', contents: 'bla', comments: [], code: '' } ].

Of course having an access to the additional information about the context would be useful - eg.

[ { type: 'it', contents: 'bla', comments: [], code: '',
   context: {type: 'given', arguments: ['xx']}
} ]

But such rich approach is not required from my point of view.

@ricick
Copy link

ricick commented Apr 1, 2019

This would also be very useful for those of us using the mocha-steps plugin to split up deep nested callback tests into promise based steps.

https://github.com/rprieto/mocha-steps

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