Mocha-Chai - suite/test vs describe/it

I’m going through infosec class now, writing another NodeJS app, and while I understand how to write testing using chai mocha per the course instructions, mainly with suite/test/assert, I did have a question.

Researching testing, again I find it very hard to find examples and documentation regarding using suite and test, even when directly searching something like “chai suite test chai.request(server)”. Just about everything I find is related to using describe and it and other functions which is never mentioned in class that I remember.

I understand its just a different way of doing it(BDD vs TDD), but wonder which way I should focus on. Is the test/suite stuff newer and soon to be the standard, older and out the door, or just not as mainstream? Should I be self-teaching myself the describe/it method as that’s more likely what I’ll find in the job market?

I know there is no right answer to this, just wondering what the experts have to say. Thanks :slight_smile:

ALSO: It looks similar though… is it exactly the same? Just replace describe/it with suite/test?

Just preference, some people like writing tests like:

Describe Mocha:

  • it is a test runner
  • it provides some functions to simplify testing code

Some people like it like this:

Mocha suite


  • test: runs tests
  • test: provides some functions to simplify testing code

Also, both are supposed to be read, and in certain contexts writing it one way will make no sense grammatically and will sound clumsy, whereas the other style may work. If you’re writing “user stories”, then the second style may sound too formal. If you’re not, the first style may not sound technical/formal enough. At one level the tests are supposed to be a conversation, it’s just how you want that conversation to read like

Yes

1 Like