Skip to content

Commit

Permalink
AMD: Support files with embedded es6
Browse files Browse the repository at this point in the history
Fixes pahen#84
  • Loading branch information
mrjoelkemp committed Jun 25, 2016
1 parent 38c40ac commit 53e1753
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 107 deletions.
137 changes: 31 additions & 106 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test": "./node_modules/.bin/grunt"
},
"dependencies": {
"amdetective": "0.0.2",
"amdetective": "~0.2.1",
"coffee-script": "1.3.3",
"colors": "^1.1.2",
"commander": "^2.8.1",
Expand Down
6 changes: 6 additions & 0 deletions test/amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,10 @@ describe('module format (AMD)', function () {
findNestedDependencies: true
}).obj().should.eql({ 'main': ['a', 'b'] });
});

it('should work for amd files with es6 code inside', function () {
madge([__dirname + '/files/amd/amdes6.js'], {
format: 'amd'
}).obj().should.eql({ 'amdes6': ['ok/a'] });
});
});
13 changes: 13 additions & 0 deletions test/files/amd/amdes6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
define([
'ok/a'
], function(a) {
'use strict';

var x = [1, 2, 3, 4]

for (var i of x) {
x++;
}

return x;
});

0 comments on commit 53e1753

Please sign in to comment.