Skip to content

Commit

Permalink
Fixing conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ktutnik committed Feb 13, 2017
2 parents da72611 + a5e54b9 commit 4b6e395
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 8 deletions.
2 changes: 0 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ gulp.task("mocha", function () {

gulp.task("istanbul:hook", function () {
return gulp.src(["src/**/**.js"])
// Covering files
.pipe(istanbul())
// Force `require` to return covered files
.pipe(istanbul.hookRequire());
});

Expand Down
101 changes: 95 additions & 6 deletions test/transformer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,100 @@ describe("Transformer", () => {
let dummy = new Transformer(filename, "ASTree");
let ast = Babylon.parse(code);
let result = dummy.transform(ast);
Chai.expect(Path.resolve(result.name)).eq(Path.resolve(filename))
Chai.expect(result.children).deep.eq([{
type: 'Module',
analysis: 83,
children:
[{
type: 'Class',
name: 'MyBaseClass',
baseClass: null,
location: { start: 456, end: 633 },
analysis: 31,
constructor:
{
type: 'Constructor',
name: 'MyBaseClass',
analysis: 1,
location: { start: 497, end: 531 },
parameters: []
},
methods:
[{
type: 'Method',
name: 'baseMethod',
analysis: 1,
location: { start: 540, end: 595 },
parameters:
[{
type: 'Parameter',
name: 'par1',
analysis: 1,
location: { start: 585, end: 589 }
}]
}]
},
{
type: 'Class',
name: 'MyClass',
baseClass: 'MyBaseClass',
location: { start: 678, end: 944 },
analysis: 31,
constructor:
{
type: 'Constructor',
name: 'MyClass',
analysis: 1,
location: { start: 765, end: 841 },
parameters: []
},
methods:
[{
type: 'Method',
name: 'myMethod',
analysis: 1,
location: { start: 850, end: 899 },
parameters:
[{
type: 'Parameter',
name: 'par1',
analysis: 1,
location: { start: 889, end: 893 },
decorators:
[{
type: 'Decorator',
name: 'decoOne',
analysis: 1,
location: { start: 997, end: 1026 },
parameters: []
}]
}],
decorators:
[{
type: 'Decorator',
name: 'decoOne',
analysis: 1,
location: { start: 978, end: 987 },
parameters: []
}]
}],
decorators:
[{
type: 'Decorator',
name: 'decoTwo',
analysis: 1,
location: { start: 1284, end: 1299 },
parameters: [{ type: 'String', value: 'halo' }]
}]
}],
location: { start: 429, end: 1461 },
name: 'MyModule'
}])
})

/*
it("Should transform TypeScript (4.5 MB) file in less than 500ms", (done) => {
it("Should transform TypeScript (4.5 MB) file in less than 1 second", function() {
this.timeout(10000)
let filename = "./node_modules/typescript/lib/typescript.js"
let code = Fs.readFileSync(Path.join(process.cwd(), filename)).toString()
let dummy = new Transformer(filename, "ASTree");
Expand All @@ -28,9 +118,8 @@ describe("Transformer", () => {
let result = dummy.transform(ast);
let end = new Date();
let gap = end.getTime() - start.getTime();
Chai.expect(gap).lessThan(500)
done()
console.log("EXEC TIME: " + gap)
Chai.expect(gap).lessThan(1000)
})
*/
})
})

0 comments on commit 4b6e395

Please sign in to comment.