Skip to content

Commit

Permalink
fix bug with input source maps
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestalmage committed Mar 3, 2015
1 parent cda9c4a commit 0d44599
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "ng-test-utils",
"version": "0.0.4",
"version": "0.0.5",
"description": "angular test utilities",
"main": "index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Expand Up @@ -15,7 +15,8 @@ function transform(src, suppliedOptions){
if(suppliedOptions.inputSourceMap){
options.inputSourceMap = suppliedOptions.inputSourceMap;
} else if(suppliedOptions.readSourceMapComments !== false) {
options.inputSourceMap = convert.fromSource(src);
var inputMap = convert.fromSource(src);
if(inputMap) options.inputSourceMap = inputMap.toObject();
}
var doNgInject = suppliedOptions.hasOwnProperty('ngInject') ? suppliedOptions.ngInject : true;
var doNgProvide = suppliedOptions.hasOwnProperty('ngProvide') ? suppliedOptions.ngProvide : true;
Expand Down
9 changes: 9 additions & 0 deletions test/index-test.js
Expand Up @@ -129,6 +129,7 @@ describe('main', function() {
var fromSource = sinon.stub();
var parse = sinon.spy();
var print = sinon.stub();
var toObj = sinon.spy();
process = proxyquire(pathToIndex,{
'recast':{
parse:parse,
Expand All @@ -138,9 +139,17 @@ describe('main', function() {
fromSource: fromSource
}
});
fromSource.returns({toObject:toObj});
print.returns({code:'blah'});
process(input);
expect(fromSource.called).to.equal(true);
expect(toObj.called).to.equal(true);
fromSource.reset();
toObj.reset();
fromSource.returns(null);
process(input);
expect(fromSource.called).to.equal(true);
expect(toObj.called).to.equal(false);
fromSource.reset();
process(input,{readSourceMapComments:false}) ;
expect(fromSource.called).to.equal(false);
Expand Down

0 comments on commit 0d44599

Please sign in to comment.