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

unroll testArgs without array silently fails to execute test #30

Closed
Blackbaud-KevinHutson opened this issue Aug 30, 2017 · 1 comment
Closed

Comments

@Blackbaud-KevinHutson
Copy link

I've found an issue that is bugging me a bit. I've seen it happen twice now on our team.
If someone creates a new unroll test or converts an existing single test to unroll, and they somehow forget to wrap the args in an array, the tests will not execute. Normally, this would be caught. But, in a sufficiently large codebase it could be missed (it has in our case).

It would be great if there was a way to make unroll (or even lint?) complain if it sees a test with args that are not wrapped in an array.

Wrong way this test won't execute

describe('maximum of two numbers (unrolled)', function() {
    unroll('maximum of #a and #b is #c',
      function(done, testArgs) {
        expect(
          Math.max(testArgs['a'], testArgs['b'])
        ).to.be.equal(testArgs['c']);
        done();
      },
        ['a', 'b', 'c'],
        [ 3,   5,   5 ],
        [ 7,   0,   7 ]
    );
});

Correct way: this test will execute

describe('maximum of two numbers (unrolled)', function() {
    unroll('maximum of #a and #b is #c',
      function(done, testArgs) {
        expect(
          Math.max(testArgs['a'], testArgs['b'])
        ).to.be.equal(testArgs['c']);
        done();
      },
      [
        ['a', 'b', 'c'],
        [ 3,   5,   5 ],
        [ 7,   0,   7 ]
      ]
    );
});
@lawrencec
Copy link
Owner

Closing as fixed in version 1.4.0.

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

2 participants