Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all reporters support recursion. #347

Open
rquadling opened this issue Jan 10, 2018 · 7 comments
Open

Not all reporters support recursion. #347

rquadling opened this issue Jan 10, 2018 · 7 comments

Comments

@rquadling
Copy link

rquadling commented Jan 10, 2018

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.

@mreinstein
Copy link
Collaborator

@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
Copy link
Author

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
Copy link
Collaborator

I'm not going to convert an entire unit test, but here's a stripped down example to get you started:

'use strict'

const Calculator = require(__dirname + '/../Digitickets').Calculator
const tap        = require('tap')


tap.test('basic calculator functionality', function(test) {
   const calculator = new Calculator()
   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 here

   test.end()
})

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
Copy link

0joshuaolson1 commented Feb 19, 2018

nodeunit is not under very active development

@mreinstein This would go great in the README or project description.

@mreinstein
Copy link
Collaborator

This would go great in the README or project description.

@0joshuaolson1 I'd accept a PR for this

@0joshuaolson1
Copy link

@mreinstein
Copy link
Collaborator

send a proper pull request please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants