TDD - Test Driven Development with JS in Max ?


    Aug 05 2022 | 2:20 pm
    Hi, I'm currently reading the "Clean Code" book from Robert C. Martin. I was wondering if a tool existed in Max in order to test my JS source code with a TDD approach ? Do any of you use TDD to develop in JS with Max ? I'm developing with Atom editor, maybe someone can advise a good TDD package that works with JS ? Regards, Guillaume

    • Aug 05 2022 | 4:26 pm
      run a testing framework like Jest (https://jestjs.io/) on Node either in your editor or using N4M potentially
    • Aug 06 2022 | 8:25 am
      Thanks for the tip, I'll take a look. :) I don't know Node at all, can I ask you how to configure it in the Atom editor ?
    • Aug 06 2022 | 9:42 am
      first you need Node installed locally: https://nodejs.org/en/download/ Atom probably has a number of Packages for integrating Node but here's an option: https://blog.leonhassan.co.uk/running-node-js-in-atom/ You can just interact from a built-in terminal and the JS scripts though given Node is running.
      Jest is a Node Package so you can bundle it with NPM or other types of Node bundlers: https://www.npmjs.com/package/jest
      Lastly, N4M (Node for Max) will allow you to run scripts and call Jest within Max Patchers. There are a number of N4M resources on this site and video content on Youtube for looking into that.
      In general you'd want to maintain a simple method of running tests so decide if that's script level or patcher level, with Max as a whole I'm not sure a JS test framework is going to serve your purpose and probably wiser to roll your own tests etc.