Javascript Testing. EnvJasmine Co-Creator, Trevor Lalish-Menagh.

Engineers:

  • Care about their work
  • Want to produce quality work
  • Treat their work as more than a dayjob
  • Are proud to show off their work
  • Strive to create work that they are not afraid to change

The only way to avoid being afraid of changing your code is to write tests.

If you don’t test it, you’re up a creek.

Writing quality JavaScript is hard. It’s dynamic. You have to think of the edge cases and things you don’t need to consider in a statically typed language.

Let JSLint help you learn how to write JavaScript the right way.

  • Namespace your functions.
  • Declare your vars up top.
  • Encapsulate your code in brackets (IIFEs immediately invoked function expressions).
  • Don’t use “with”, it’s ambiguous.
  • Don’t abuse eval, almost everything you can do with eval you can do without eval.

False consensus effect: If I could figure this out, anyone else surely can because I’m not that smart. None of us are perfect. We all write bad code, especially bad JavaScript. Your future self will think your past self is a jerk because of the code you’re writing now.

Thanks to EnvJasmine, now front end engineers can break the build, which is a good thing. No JavaScript is untestable. You can use guard to run tests automatically.

Easy Jenkins integration copying path of the pom.xml file.

@trevmex

Slides