DEV Community

Nagarajan R
Nagarajan R

Posted on

Answer: What's the difference between assertion library, testing framework and testing environment in javascript?

Assertion libraries are tools to verify that things are correct.
This makes it a lot easier to test your code, so you don't have to do thousands of if statements.
Example (using should.js and Node.js assert module):

var output = mycode.doSomething();
output.should.equal('bacon'); //should.js
assert.eq(output, 'bacon'); //node.js assert

// The alternative

Top comments (0)