What is the best way to test javascript?

I am creating several jQuery plugins and moving forward. I thought it would be useful to learn some guidelines for testing my code to be strong.

I usually use Selenium , but it's just for debugging.

I would like to know how best to do some real test (e.g. TDD, BDD, DDD) for my code.

Any suggestion would be appreciated.

+6
source share
1 answer

I use Jasmine https://github.com/pivotal/jasmine and highly recommend it.

I don’t think there is a β€œbetter” structure to checking your code. I just know that you have to "check" your code. So, with that said, just find the test / custom structure as you like and get the test!

I also sometimes use https://github.com/webadvanced/jMoney to test small bits of code or to test prototype code. It displays the results in the console and does not require any settings or dependent files.

If you are more like a TDD guy, you can try QUnit http://docs.jquery.com/QUnit

+5
source

Source: https://habr.com/ru/post/905261/


All Articles