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

added unit test for exceptions #24

Merged
merged 1 commit into from
Dec 13, 2016
Merged

added unit test for exceptions #24

merged 1 commit into from
Dec 13, 2016

Conversation

stanleyhlng
Copy link
Owner

This PR adds unit test for exception to increase overall code coverage from 87% to 92%.

➜  mocha-multi-reporters git:(exception-unit-test)  npm run test 

> mocha-multi-reporters@1.1.1 test /Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters
> JENKINS_MOCHA_COVERAGE=true jenkins-mocha --timeout 5000 tests/**/*.test.js*



  lib/MultiReporters
    #static
      #CONFIG_FILE
        ✓ equals to "../config.json"
    #instance
      #internal
        #options (reporters - single)
          ✓ return reporter options: "dot"
          ✓ return reporter options: "xunit"
        #options (reporters - multiple)
          ✓ return default options
          ✓ return custom options
          ✓ return resultant options by merging both default and custom options
      #external
        #options (external reporters - single)
          ✓ return reporter options: "dot"
      #exception
Error: JSON.parse error!
    at Context.<anonymous> (/Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters/tests/lib/MultiReporters.test.js:141:23)
    at callFn (/Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters/node_modules/jenkins-mocha/node_modules/mocha/lib/runnable.js:326:21)
    at Hook.Runnable.run (/Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters/node_modules/jenkins-mocha/node_modules/mocha/lib/runnable.js:319:7)
    at next (/Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters/node_modules/jenkins-mocha/node_modules/mocha/lib/runner.js:298:10)
    at Immediate.<anonymous> (/Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters/node_modules/jenkins-mocha/node_modules/mocha/lib/runner.js:320:5)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)
        ✓ throw an exception in default options
Error: JSON.parse error!
    at Context.<anonymous> (/Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters/tests/lib/MultiReporters.test.js:141:23)
    at callFn (/Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters/node_modules/jenkins-mocha/node_modules/mocha/lib/runnable.js:326:21)
    at Hook.Runnable.run (/Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters/node_modules/jenkins-mocha/node_modules/mocha/lib/runnable.js:319:7)
    at next (/Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters/node_modules/jenkins-mocha/node_modules/mocha/lib/runner.js:298:10)
    at Immediate.<anonymous> (/Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters/node_modules/jenkins-mocha/node_modules/mocha/lib/runner.js:320:5)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)
        ✓ throw an exception in custom options
    #test

#multi-reporter
  ✓ #test-1
  1) #test-2

  1 passing (6ms)
  1 failing

  1) #multi-reporter #test-2:

  Error
      at Context.<anonymous> (tests/lib/MultiReporters.test.js:196:30)



      ✓ should have 1 test failure

#multi-reporter
  - #test-1
  - #test-2

  0 passing (1ms)
  2 pending

      ✓ should have 1 test pending


  11 passing (191ms)

=============================================================================
Writing coverage object [/Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters/artifacts/coverage/coverage.json]
Writing coverage reports at [/Users/stanleyn/Projects/stanleyhlng/github.com/mocha-multi-reporters/artifacts/coverage]
=============================================================================

=============================== Coverage summary ===============================
Statements   : 92.65% ( 63/68 )
Branches     : 60% ( 6/10 )
Functions    : 100% ( 6/6 )
Lines        : 92.65% ( 63/68 )
================================================================================

@coveralls
Copy link

coveralls commented Dec 13, 2016

Coverage Status

Coverage increased (+5.9%) to 92.647% when pulling 98e2406 on exception-unit-test into 925f61f on master.

@stanleyhlng stanleyhlng merged commit 716ba82 into master Dec 13, 2016
@stanleyhlng stanleyhlng deleted the exception-unit-test branch December 13, 2016 06:40
@stanleyhlng
Copy link
Owner Author

published mocha-multi-reporters@1.1.2

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

Successfully merging this pull request may close these issues.

None yet

2 participants