acquit
acquit copied to clipboard
Support for "given", "when" and so on
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,
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?
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.
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