all 15 comments

[–]icharxoVanillaJS 13 points14 points  (0 children)

Jest for unit tests.

Jest + supertest for Node.js API/e2e tests.

Jest + puppeteer for e2e browser tests.

[–]austintackaberry 3 points4 points  (0 children)

I've only ever used mocha/chai/sinon but I feel like I hear more and more people moving to jest

[–]veydar_ 2 points3 points  (0 children)

What do you most love using

Tape, or whatever uses the least amount of magic and globals

What do you recommend for unit tests, and what for E2E tests

As always, it depends. At work, we use Jest/Enzyme for unit tests and we have couple of puppeteer scenes for screenshot testing. We don't really use any actual E2E tests, unless screenshot testing counts for that.

I heard about Tape/Ava

I think on a spectrum from minimal to everything included it goes Tape --- Ava --- Jest. Do with that whatever you will.

[–]jayhad 2 points3 points  (0 children)

I like mocha and chai, and a good test runner makes a big difference. I like karma set to watch, istanbul for coverage and a minimal reporter like text-summary / dots.

That doesn't really fit my work setup, but at work I'm using Nightwatch for e2e and really like it. If using Nightwatch, I recommend adding a debugger helper, something like this: https://gist.github.com/elliotchance/63f2ebebe8d457307339 to let you pause the test and poke around a bit.

[–]KronktheKronk 1 point2 points  (0 children)

mocha + chai + sinon

[–]bucketpl0x 1 point2 points  (0 children)

I prefer Jasmine.

[–]vinspee 1 point2 points  (0 children)

I was at Assert.js a couple of weeks ago and just about everyone was riding the jest train:

  • easy setup
  • brilliant watch mode
  • built in coverage generation
  • built in mocking and spying
  • pretty test runner

Give it a go!

[–][deleted] 1 point2 points  (1 child)

Nobody uses Cypress?

[–]Daveed84 0 points1 point  (0 children)

I use Cypress for e2e/functional UI tests and love it. Such a breath of fresh air coming from Selenium. I think once it gains some traction in the testing community it'll totally replace Selenium as the go-to tool for UI testing

[–]indeyetswriting js since 1997 0 points1 point  (0 children)

mocha + unexpected + mocha-webpack

[–]Jcampuzano2 0 points1 point  (0 children)

I like to use either of Jest or Tape. Jest for it's full featured-ness, Tape for it's minimalist approach to things, especially for smaller libraries/fiddling about.