Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for TypeScript #124

Merged
merged 3 commits into from
Aug 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; http://editorconfig.org
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@
"test:output": "./test/output.sh"
},
"dependencies": {
"chalk": "^1.1.3",
"commander": "^2.9.0",
"commondir": "^1.0.1",
"debug": "^2.2.0",
"dependency-tree": "5.9.1",
"graphviz": "^0.0.8",
"mz": "^2.4.0",
"chalk": "1.1.3",
"commander": "2.9.0",
"commondir": "1.0.1",
"debug": "2.2.0",
"dependency-tree": "5.10.1",
"graphviz": "0.0.8",
"mz": "2.4.0",
"ora": "1.2.0",
"pluralize": "4.0.0",
"pretty-ms": "2.1.0",
"rc": "^1.1.6",
"walkdir": "^0.0.11"
"rc": "1.1.6",
"walkdir": "0.0.11"
},
"devDependencies": {
"@aptoma/eslint-config": "6.0.0",
"eslint": "3.19.0",
"mocha": "^3.2.0",
"mocha": "3.2.0",
"should": "11.2.1"
}
}
20 changes: 20 additions & 0 deletions test/typescript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-env mocha */
'use strict';

const madge = require('../lib/api');
require('should');

describe('TypeScript', () => {
const dir = __dirname + '/typescript';

it('extracts module dependencies', (done) => {
madge(dir + '/import.ts').then((res) => {
res.obj().should.eql({
'import.ts': ['require.ts'],
'require.ts': ['export.ts'],
'export.ts': []
});
done();
}).catch(done);
});
});
7 changes: 7 additions & 0 deletions test/typescript/export.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class ExportClass {
stringLength(s: string) {
return s.length;
}
}

export = ExportClass;
8 changes: 8 additions & 0 deletions test/typescript/import.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import B from './require';

class ImportClass {
constructor(public greeting: string) { }
greet() {
return "<h1>" + this.greeting + "</h1>";
}
};
7 changes: 7 additions & 0 deletions test/typescript/require.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import x = require('./export');

export default class RequireClass {
stringLength(s: string) {
return s.length;
}
}