Consider the example below. The isEmail function checks whether a recently entered e-mail address is correct.
What if this function doesn't work properly? To find it out, you can use QUnit or Jasmine and write a test.
NoteTo use QUnit, you should reference qunit.js and qunit.css files. For more information, see QUnit Web site.
To use Jasmine, you should reference jasmine.js and jasmine.css files. For more information, see Jasmine Web site.
NoteNested references are supported, so you do not have to reference framework files directly from your files with tests.
You can write the same test using describe, expect and it functions from Jasmine.
ReSharper detects tests automatically. Click the gutter icon, then click Run.
The test is run in a single session in the Unit Test Sessions window. As you can see the test has passed, so the function works properly.
When the tests are started, ReSharper launches the specified browser that runs the tests and reports the information back to ReSharper.