Last Updated: September 30, 2021
·
6.019K
· robinduckett

Animate your nyan mocha reporter

nyan

Just put the following code outside any test cases or describe directives:

afterEach(function (done) {
    setTimeout(done, 30);
});

Enjoy :)

Bonus code of how I created this GIF (Jiff):

var shots = 0;

afterEach(function (done) {
    shots++;
    shotsString = (shots < 10 ? '0' : '') + shots;

    exec('screencapture -T0x /Users/robin/capture_' + shotsString + '.png', function (err, stdout, stderr) {
        setTimeout(done, 30);
    });
});

I then used mogrify to crop all the screen captures to the region where my terminal was on my screen

mogrify -path ./cropped -crop 955x533+199+234 capture*.png

I then used convert to mash it into a GIF and crop it further

convert -crop 700x420+0+23\! +repage -delay 0 -loop 0 *.png nyan.gif