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

The `assert` command line flag should be properly documented #634

Closed
blacksun1 opened this issue Sep 6, 2016 · 6 comments
Assignees
Labels
Milestone

Comments

@blacksun1
Copy link
Contributor

@blacksun1 blacksun1 commented Sep 6, 2016

tldr: Unless you use the Lab assert command line flag it will ignore the fact that your Code tests are not complete


Hi,

I've only just found the --asert flag after using Lab and Code for months and I feel that it should be pointed out more in the documentation.

For instance, If I ran Lab over the following assertions

const Lab = require('lab');
const Code = require('code');

const lab = exports.lab = Lab.script();

lab.describe("expectation", () => {

  lab.it("should call the true method", done => {

    Code.expect(true).to.be.true;

    return done();
  });

  lab.it("does call the true method", done => {

    Code.expect(true).to.be.true();

    return done();
  });

});

If I use the --assert code flag, the code will fail with the error

Incomplete assertion at /home/vagrant/repos/eg-dashboard-services/test-bin/brokenTest.js:22.22

There were 1 test script error(s).

which is fantastic and what I should have expected after reading the acknowledgements of the code README such as

This will alert when a statement like expect(5).to.be.a.string is not allowed to remain unnoticed (and fail to throw due to the missing ()).

I think it's great that it works with multiple assertion libraries but somewhere in either the Code or Lab documentation it should be loud and clear that this is how it should work.

BTW, here is the original issue that probably caused this behaviour in the first place: #255

@geek geek added the documentation label Sep 7, 2016
@geek

This comment has been minimized.

Copy link
Member

@geek geek commented Sep 7, 2016

@blacksun1 thanks for raising this. I am happy to update our documentation to make this clearer. Is this something that you want to take a run at updating?

@blacksun1

This comment has been minimized.

Copy link
Contributor Author

@blacksun1 blacksun1 commented Sep 7, 2016

Hey @geek,

I would be quite happy if I knew what the rules were around it. What does this flag do besides allow unfinished assertions when used with the flag of Code? Does it work with any other assertion libraries? Is there a certain interface to make it work?

Regards,

@blacksun1

This comment has been minimized.

Copy link
Contributor Author

@blacksun1 blacksun1 commented Sep 7, 2016

I've put something together just to make sure that my understanding is correct. So, Lab.assertions will then become code. https://gist.github.com/blacksun1/9c1f5c6d1e2a72227d71e96f13f577b8

Anything else I'm missing?

@geek

This comment has been minimized.

Copy link
Member

@geek geek commented Sep 8, 2016

@blacksun1 that is really all it does.

@blacksun1

This comment has been minimized.

Copy link
Contributor Author

@blacksun1 blacksun1 commented Sep 9, 2016

OK, I'll do something in the next week or so.

@blacksun1

This comment has been minimized.

Copy link
Contributor Author

@blacksun1 blacksun1 commented Sep 12, 2016

@geek Please see pull request #639

@geek geek added this to the 11.0.2 milestone Sep 12, 2016
@geek geek self-assigned this Sep 12, 2016
@geek geek closed this in #639 Sep 12, 2016
geek added a commit that referenced this issue Sep 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.