Skip to content

Commit e81585d

Browse files
committed
Add one more unit test and some minor fixes
This is part of the effort to create an official TypeScript compiler: Urigo/angular2-meteor#89 Urigo/angular2-meteor#90 Urigo/angular2-meteor#102
1 parent c9e5322 commit e81585d

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ var validOptions = {
4545
"moduleName": "String",
4646
"typings": "Array"
4747
};
48-
var validOptionsMsg = "Valid options are" +
49-
"compilerOptions, filePath, moduleName, and typings";
48+
var validOptionsMsg = "Valid options are " +
49+
"compilerOptions, filePath, moduleName, and typings.";
5050

5151
function checkType(option, optionName) {
5252
if (! option) return true;
@@ -61,7 +61,7 @@ function validateAndConvertOptions(options) {
6161
for (var option in options) {
6262
if (options.hasOwnProperty(option)) {
6363
if (validOptions[option] === undefined) {
64-
throw new Error("Unknown option: " + option + "." +
64+
throw new Error("Unknown option: " + option + ".\n" +
6565
validOptionsMsg);
6666
}
6767

@@ -79,6 +79,8 @@ function validateAndConvertOptions(options) {
7979
}
8080
}
8181

82+
exports.validateAndConvertOptions = validateAndConvertOptions;
83+
8284
exports.getDefaultOptions = function getDefaultOptions() {
8385
return {
8486
compilerOptions: getDefaultCompilerOptions()

options.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ exports.presetCompilerOptions = presetCompilerOptions;
4545
// Default compiler options.
4646
function getDefaultCompilerOptions() {
4747
return {
48-
module : ts.ModuleKind.CommonJS,
49-
target: ts.ScriptTarget.ES3,
48+
module : "commonjs",
49+
target: "ES3",
5050
sourceMap: true,
5151
noResolve: false,
5252
diagnostics: true,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "meteor-typescript",
33
"author": "@barbatus",
4-
"version": "0.5.5",
4+
"version": "0.5.7",
55
"license": "MIT",
66
"description": "TypeScript wrapper package for use with Meteor",
77
"keywords": [

tests/ts.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ describe("meteor-typescript -> ", function() {
5858
};
5959
expect(test).toThrow();
6060
});
61+
62+
it("should validate options", function() {
63+
var test = function() {
64+
meteorTS.validateAndConvertOptions({
65+
wrong: true
66+
});
67+
};
68+
69+
expect(test).toThrow(new Error("Unknown option: wrong.\n" +
70+
"Valid options are compilerOptions, filePath, moduleName, and typings."));
71+
});
6172
});
6273

6374
describe("testing diagnostics and typings -> ", function() {

0 commit comments

Comments
 (0)