• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pghalliday / mocha-sonar-reporter / 29
100%

Build:
DEFAULT BRANCH: master
Ran 29 Mar 2016 02:10PM UTC
Jobs 1
Files 5
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
29

Pull #8

travis-ci

Yimgo
Fix TypeError when beforeEach throws

When an error was thrown in beforeEach (and probably before, after and afterEach
as well), Test.file is undefined and the following error is thrown by
mocha-report-sonar:

```
TypeError: Path must be a string. Received undefined
    at assertPath (path.js:8:11)
    at Object.posix.relative (path.js:496:3)
    at extractClassName
(/node_modules/mocha-sonar-reporter/lib/Sonar.js:110:33)
    at test
(/node_modules/mocha-sonar-reporter/lib/Sonar.js:75:20)
    at Array.forEach (native)
    at Runner.<anonymous>
(/node_modules/mocha-sonar-reporter/lib/Sonar.js:65:11)
    at emitNone (events.js:72:20)
    at Runner.emit (events.js:166:7)
    at
(/node_modules/mocha/lib/runner.js:735:12
    at done
(/node_modules/mocha/lib/runner.js:619:7)
    at next
(/node_modules/mocha/lib/runner.js:586:16)
    at done
(/node_modules/mocha/lib/runner.js:619:7)
    at next
(/node_modules/mocha/lib/runner.js:590:14)
    at done
(/node_modules/mocha/lib/runner.js:619:7)
    at next
(/node_modules/mocha/lib/runner.js:590:14)
    at Runner.hookErr
(/node_modules/mocha/lib/runner.js:461:7)
    at Runner.uncaught
(/node_modules/mocha/lib/runner.js:696:19)
    at process.uncaught
(/node_modules/mocha/lib/runner.js:727:10)
    at emitOne (events.js:77:13)
    at process.emit (events.js:169:7)
    at process._fatalException (node.js:219:26)
    at process._asyncFatalException [as _fatalException]
(/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:211:34)
```

This was caused by the class name extracting calling path.relative with
undefined Test.file.

Here we protect extractClassName from doing so.
Pull Request #8: Fix TypeError when beforeEach throws

4 of 4 new or added lines in 2 files covered. (100.0%)

124 of 124 relevant lines covered (100.0%)

14.46 hits per line

Jobs
ID Job ID Ran Files Coverage
1 29.1 29 Mar 2016 02:10PM UTC 0
100.0
Travis Job 29.1
Source Files on build 29
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #29
  • Pull Request #8
  • PR Base - master (#28)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc