Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying ReSharper Essentials
  • Table Of Contents Toc
  • Feedback & Rating feedback
ReSharper Essentials

ReSharper Essentials

By : Lukasz Gasior
4.3 (9)
close
close
ReSharper Essentials

ReSharper Essentials

4.3 (9)
By: Lukasz Gasior

Overview of this book

Table of Contents (18 chapters)
close
close
ReSharper Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
2
Index

Testing JavaScript


ReSharper can also support you in writing unit tests in JavaScript.

Running JavaScript unit tests

There are many different frameworks that allow you to write unit tests for JavaScript. The most popular ones are QUnit and Jasmine. What is really cool is that both are supported by ReSharper. It means that you can run them in the same way that you run C# tests written in NUnit or other frameworks. Very nice, isn't it?

A sample unit test written in QUnit is shown in the following screenshot:

As you can see, ReSharper recognizes and marks unit tests in the same way as they were with NUnit. Even the available menu options are the same.

When you write unit tests in JavaScript, you need to add a reference to the file that contains the tested methods. You can see a sample reference in the previous screenshot, which looks as follows:

/// <reference path="Utilities.js"/>

ReSharper needs to know where the code that you are testing is placed. You do the same in C# but with the using...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
ReSharper Essentials
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon