diff --git a/lib/source-map-cache.js b/lib/source-map-cache.js index df4d16f85..e554bace7 100644 --- a/lib/source-map-cache.js +++ b/lib/source-map-cache.js @@ -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 } diff --git a/package.json b/package.json index 3af27f127..82e331b6d 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/src/source-map-cache.js b/test/src/source-map-cache.js index 520e2131c..3216310a6 100644 --- a/test/src/source-map-cache.js +++ b/test/src/source-map-cache.js @@ -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') @@ -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) }) })