Skip to content
This repository has been archived by the owner on Jun 27, 2018. It is now read-only.

Commit

Permalink
Merge pull request #24 from teppeis/typescript-1.5.3
Browse files Browse the repository at this point in the history
Use TypeScript 1.5.3
  • Loading branch information
teppeis committed Aug 2, 2015
2 parents f74d1cf + cf0aa67 commit d2dfbf8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript-simple",
"version": "2.0.0-beta.1",
"version": "2.0.0",
"description": "Simple API to compile TypeScript code string to JavaScript. That's all!",
"main": "index.js",
"scripts": {
Expand All @@ -22,7 +22,7 @@
},
"homepage": "https://github.com/teppeis/typescript-simple",
"dependencies": {
"typescript": "~1.5.0-beta"
"typescript": "~1.5.3"
},
"devDependencies": {
"mocha": "^2.1.0"
Expand Down
24 changes: 21 additions & 3 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,36 @@ describe('typescript-update', function() {
});
});

context('sourceMaps', function() {
context('tss sourceMaps option is true', function() {
var tss;
beforeEach(function() {
tss = new TypeScriptSimple({target: ts.ScriptTarget.ES5, sourceMap: true}, false);
});

it('sourceMap:true should result in inline sourceMaps', function() {
it('should result in inline sourceMaps', function() {
var src = 'var x = "test";';
var srcFile = 'foo/test.ts';
var sourceMap = '{"version":3,"file":"foo/test.ts","sources":["foo/test.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,MAAM,CAAC","sourcesContent":["var x = \\"test\\";"]}';
var expected =
'var x = "test";' + eol
+ '//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vL3Rlc3QudHMiLCJzb3VyY2VzIjpbImZvby90ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLElBQUksQ0FBQyxHQUFHLE1BQU0sQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbInZhciB4ID0gXCJ0ZXN0XCI7Il19';
+ '//# sourceMappingURL=data:application/json;base64,' + new Buffer(sourceMap).toString('base64');
assert.equal(tss.compile(src, srcFile), expected);
});
});

context('native inlineSourceMap option is true', function() {
var tss;
beforeEach(function() {
tss = new TypeScriptSimple({target: ts.ScriptTarget.ES5, inlineSourceMap: true, inlineSources: true}, false);
});

it('should result in inline sourceMaps', function() {
var src = 'var x = "test";';
var srcFile = 'foo/test.ts';
var sourceMap = '{"version":3,"file":"file.js","sourceRoot":"","sources":["file.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,MAAM,CAAC","sourcesContent":["var x = \\"test\\";"]}';
var expected =
'var x = "test";' + eol
+ '//# sourceMappingURL=data:application/json;base64,' + new Buffer(sourceMap).toString('base64');
assert.equal(tss.compile(src, srcFile), expected);
});
});
Expand Down

0 comments on commit d2dfbf8

Please sign in to comment.