BDD and TDD for node.js?

前端 未结 11 1287
北恋
北恋 2021-01-29 20:37

What is used for BDD and TDD with node.js?

I\'m used to use Cucumber + RSpec. What\'s a good combo for node.js?

thanks

相关标签:
11条回答
  • 2021-01-29 21:19

    Update

    Mocha gets my vote now!


    You could have a look at the testing modules section from the node.js modules page. For example Vows is a pretty popular BDD framework.

    Vows is a behavior driven development framework for Node.js.

    0 讨论(0)
  • 2021-01-29 21:20

    If you are used to rspec, Jasmine is pretty nice. I've not used it on Node.js, but I have used it for testing a backbone app. It's syntax is very similar to rspec. Taken from the site above:

    describe("Jasmine", function() {
      it("makes testing JavaScript awesome!", function() {
        expect(yourCode).toBeLotsBetter();
      });
    });
    

    It's listed in the link provided by Alfred above, but since folks listed Vows as an example, I figured I'd give Jasmine a bump, especially since it's syntactically similar to rspec ;)

    0 讨论(0)
  • 2021-01-29 21:23

    Maybe a little later, but what you're looking for is Kyuri: https://github.com/nodejitsu/kyuri

    "kyuri is a node.js Cucumber implementation with a few extra asynchronous keywords. it supports 160+ languages and exports to VowsJS stubs"

    Also, nodejitsu seems to have built a web app for managing a project Kyuri feature specs in a collaborative way, it's named "prenup", I would give it a look.

    0 讨论(0)
  • 2021-01-29 21:23

    Package a (bdd and mocking) https://npmjs.org/package/a

    Very compact syntax, context separated from acts, chainable acts. Easy Cmd line runner that searches recursively.

    0 讨论(0)
  • 2021-01-29 21:25

    I was going through the same concern last month .

    For BDD :

    Though Mocha itself provides BDD style by their describe and it statements.

    For styles like cucumber , you can try :

    • mocha-cakes
    • mocha-gherkin
    • cucumber.js
    • kyuri
    • mocha-cucumber

    They all have their own styles. I am sorry I can not provide working snippets now , let me know @Donald which one you select. Would like to know your insight.

    0 讨论(0)
提交回复
热议问题