Skip to content

Commit

Permalink
absolute path check
Browse files Browse the repository at this point in the history
  • Loading branch information
dmi3y committed Apr 30, 2015
1 parent 1315885 commit bf0f61d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/report.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ class Report
switch reporter
when 'xml' then reporter = './reporters/xml-pmd'
when 'json' then reporter = './reporters/json'
else reporter = path.join(process.cwd(), reporter)
else
cwd = process.cwd()
reporter = path.normalize reporter
isAbsolute = reporter.indexOf(cwd) is 0
reporter = path.join(cwd, reporter) unless isAbsolute

@reporter = require reporter
@stdReporter = require './reporters/_std-log'
Expand Down
2 changes: 1 addition & 1 deletion test/reporters/cusom.test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe "cusom reporter", ->
result = jscpd::run
path: "test/fixtures/"
languages: ['go']
reporter: './test/reporters/custom-reporter.js'
reporter: process.cwd() + '/test/reporters/custom-reporter.js'

result.report.should.be.exist
result.map.should.be.exist
Expand Down

0 comments on commit bf0f61d

Please sign in to comment.