Closed MathRobin closed 4 years ago
Hi
Thanks for your comment. Didn’t realise that anyone is using still this. Glad to hear it!
I’m not quite sure of what you’re asking for. Would you be able to post an example of how you currently add an argument to represent $index? I think you’re asking for $index to represent the current unrolled test index e.g first row or second etc?
Thanks for the quick answer !
My boss (@carolineBda) have insisted :stuck_out_tongue_closed_eyes:
And yes, you guess well, it's exactly for knowing on current unroll test index I'm, for a simple example :
unroll('Total: #args.total', function (done, args) {
expect(args.a.value + args.b.value).to.eql(args.total);
done(err);
}, [
['a', 'b', 'total'],
[{value:1}, {value:2}, 3],
[{value:2}, {value:1}, 3],
[{value:4}, {value:-1}, 3],
[{value:0}, {value:3}, 3],
]);
Will display
:heavy_check_mark: Total: 3 :heavy_check_mark: Total: 3 :heavy_check_mark: Total: 3 :heavy_check_mark: Total: 3
With index usage :
unroll('$index) Total: #args.total', function (done, args) {
Will display
:heavy_check_mark: 0) Total: 3 :heavy_check_mark: 1) Total: 3 :heavy_check_mark: 2) Total: 3 :heavy_check_mark: 3) Total: 3
On very long test with lot of arguments and objects passed in args, index is quickly a life saver when in debug phase. I've many tests which have more than 30 tests to unroll.
Aha, of course, if @carolineBda is asking, then I'll have to do it. :)
This should be pretty easy to implement. I'll try and find some time this week to work on it. Of course, PRs are welcome too. ;-)
Hi and thanks for this great tool^^
A super feature which could be very useful is to have a $index variable available in title of test. Because some times, we have to add a field in args only just for the title. Take not meaningful place in code just for ease debug later. So with this very little feature, debug would be really more easy.
Thanks in avance !