Skip or Solely Run a Take a look at with JavaScript Mocha


Every time I begin to really feel anxiousness a couple of massive change I am making, I begin writing extra unit exams. I am going to write down my concern after which write a take a look at that assaults, and ultimately relaxes, that concern. There are two actions that I have been regularly utilizing with take a look at writing: skipping all however one take a look at or single exams.

Skip a Take a look at

Oftentimes I’ll create exams with empty our bodies in order that I do not overlook to jot down them. To skip a take a look at which is incomplete or recognized to fail, you need to use xit:

xit('does the factor I need', () => {


As soon as the take a look at is full or able to be utilized, you’ll be able to change xit again to it.

Run a Single Take a look at

To run solely a single take a look at with the Mocha take a look at framework, use it.solely:

it.solely('does the factor I need', () => {


it.solely is particularly useful if in case you have a big take a look at suite and simply need the results of a work-in-progress take a look at rapidly.

Let’s be trustworthy: writing exams is not very enjoyable. Like taking your cousin to the varsity dance or altering a diaper. However take a look at writing is essential sufficient to save lots of your self, and extra importantly, your customers, from catastrophe.

  • JavaScript Promise API

    Whereas synchronous code is less complicated to comply with and debug, async is mostly higher for efficiency and adaptability. Why “maintain up the present” when you’ll be able to set off quite a few requests directly after which deal with them when every is prepared?  Guarantees are turning into a giant a part of the JavaScript world…

  • Tips for Starting with Bitcoin and Cryptocurrencies

    One of the crucial rewarding experiences of my life, each financially and logically, has been shopping for and managing cryptocurrencies like Bitcoin, Litecoin, Ethereum. Like studying every other new tech, I made rookie errors alongside the way in which, however realized some finest practices alongside the way in which. Take a look at…

  • Page Visibility API

    One occasion that is all the time been missing inside the doc is a sign for when the consumer is a given tab, or one other tab. When does the consumer swap off our website to have a look at one thing else? When do they arrive again?

  • Create a Trailing Mouse Cursor Effect Using MooTools

    Bear in mind the previous days of DHTML and results that had been an achievement to create however had completely no worth? Properly, a trailing mouse cursor script is sorta like that. And I am sorta the kind of man that creates results simply because I can.


Please enter your comment!
Please enter your name here