You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just started using nodeunit. It seems not all the reporters support the recursive option.
It seems recursive: options.recursive, is missing from the call to nodeunit.runFiles() in at least eclipse, html, junit, minimal, nested, skip-passed and verbose.
I can see where the missing option is missing from lcov and machineout, but in my limited testing, I couldn't see a difference ... or ANY output!
I have amended my installed nodeunit and get the recursion as expected.
I can create a patch (#348), but I'm not sure about proof/testing. Ideally, I'd like to know how to add tests to prove that the recursion is operational, but if the fix is correct and a super obvious oversight, then maybe it wouldn't be necessary.
@rquadling you'll probably be better served exploring other testing frameworks. nodeunit is not under very active development. There are other modern and very active projects. My personal favorite is https://github.com/tapjs/node-tap
Being completely new to JS unit testing, one thing I liked was how I could easily may the concepts of our PHPUnit testing (data providers, testcases, methods) to nodeunit. Very similar code layout.
I'm not going to convert an entire unit test, but here's a stripped down example to get you started:
'use strict'constCalculator=require(__dirname+'/../Digitickets').Calculatorconsttap=require('tap')tap.test('basic calculator functionality',function(test){constcalculator=newCalculator()test.equals(calculator.getAmountTendered(),0.00,'Amount Tendered starts at 0.00 for '+testName)test.equals(calculator.getChange(),0.00,'Change Given starts at 0.00 for '+testName)// ... further tests follow...test.end()})tap.test('some other calculator test',function(test){// TODO: assertions go heretest.end()})
Activity
mreinstein commentedon Jan 10, 2018
@rquadling you'll probably be better served exploring other testing frameworks. nodeunit is not under very active development. There are other modern and very active projects. My personal favorite is https://github.com/tapjs/node-tap
rquadling commentedon Jan 10, 2018
Being completely new to JS unit testing, one thing I liked was how I could easily may the concepts of our PHPUnit testing (data providers, testcases, methods) to nodeunit. Very similar code layout.
Would you be able to "convert" one of our node unit tests to tap as an example? None of the team I'm with are expert enough yet, so we are learning from those that know more. https://gist.github.com/rquadling/457b5f4a7a3b01bd9df68e623bdc8fc5
mreinstein commentedon Jan 10, 2018
I'm not going to convert an entire unit test, but here's a stripped down example to get you started:
I'd recommend taking a look at http://www.node-tap.org/basics
I think you'll find these examples are pretty simple and you shouldn't have any trouble writing tap tests should you decide to do so.
0joshuaolson1 commentedon Feb 19, 2018
@mreinstein This would go great in the README or project description.
mreinstein commentedon Feb 19, 2018
@0joshuaolson1 I'd accept a PR for this
0joshuaolson1 commentedon Feb 19, 2018
https://github.com/caolan/nodeunit/edit/master/README.md
mreinstein commentedon Feb 19, 2018
send a proper pull request please