Skip to content

Commit

Permalink
slight tweak to get tests passing in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Coe committed Dec 21, 2015
1 parent 2014577 commit 25eb6a7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions lib/source-map-cache.js
Expand Up @@ -76,7 +76,10 @@ SourceMapCache.prototype._rewritePath = function (report, fileReport, sourceMap)
if (sourceMap.sources.length !== 1) return

var originalPath = './' + path.join(path.dirname(fileReport.path), sourceMap.sources[0])

report[fileReport.path] = undefined // Hack for Windows tests, until we can normalize paths.
delete report[fileReport.path]

fileReport.path = originalPath
report[originalPath] = fileReport
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -81,7 +81,7 @@
"yargs": "^3.15.0"
},
"devDependencies": {
"any-path": "^1.2.0",
"any-path": "^1.3.0",
"chai": "^3.0.0",
"coveralls": "^2.11.4",
"del": "^2.2.0",
Expand Down
9 changes: 5 additions & 4 deletions test/src/source-map-cache.js
Expand Up @@ -2,6 +2,7 @@

var _ = require('lodash')
var ap = require('any-path')
var expect = require('chai').expect
var path = require('path')

var convertSourceMap = require('convert-source-map')
Expand Down Expand Up @@ -68,13 +69,13 @@ describe('source-map-cache', function () {
it('does not rewrite path if the source map has more than one source', function () {
var report = getReport()
sourceMapCache.applySourceMaps(report)
report.should.have.property(covered.bundle.relpath)
expect(report[covered.bundle.relpath]).to.not.equal(undefined)
})

it('rewrites path if the source map exactly one source', function () {
var report = _.pick(getReport(), fixture.relpath)
it('rewrites path if the source map has exactly one source', function () {
var report = ap(_.pick(getReport(), fixture.relpath))
sourceMapCache.applySourceMaps(report)
report.should.not.have.property(fixture.relpath)
expect(report[fixture.relpath]).to.equal(undefined)
report.should.have.property(fixture.mappedPath)
})
})
Expand Down

0 comments on commit 25eb6a7

Please sign in to comment.