Use Jasmine to Run Unit Tests

Get introduced to Jasmine, and learn how it can run your tests.


Jasmine is a framework for testing code in JavaScript. It’s a tool that:

  • finds all test files (also known as specification, or spec, files).
  • runs the tests.
  • reports on the result: ok, fail, and skip.

Jasmine allows us to avoid the inconvenience of having our code and its tests in the same file. The test code isn’t beneficial to users, and we don’t want our users to see the console logs of our tests.

Run the code below to see an example of what Jasmine outputs.

Get hands-on with 1200+ tech skills courses.