From 4cf8991a6807a8d4d9b4d0635ba8ed0c5d788308 Mon Sep 17 00:00:00 2001 From: Steve Fenton Date: Sat, 22 Nov 2014 20:19:29 +0000 Subject: [PATCH] Updated with nodejs console example and fix for nodejs applications. --- tsUnit.Examples/Scripts/tsUnit/tsUnit.ts | 10 +- tsUnit.Examples/packages.config | 2 +- .../Scripts/tsUnit/tsUnit.ts | 10 +- tsUnit.External.Examples/packages.config | 2 +- tsUnit.External.Packager/Package.nuspec | 2 +- .../content/Scripts/tsUnit/tsUnit.ts | 10 +- tsUnit.Node.Examples/Scripts/FizzBuzz.js | 21 + tsUnit.Node.Examples/Scripts/FizzBuzz.js.map | 1 + tsUnit.Node.Examples/Scripts/FizzBuzz.ts | 17 + tsUnit.Node.Examples/Scripts/FizzBuzzTests.js | 42 + .../Scripts/FizzBuzzTests.js.map | 1 + tsUnit.Node.Examples/Scripts/FizzBuzzTests.ts | 30 + tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.js | 479 +++++++ .../Scripts/tsUnit/tsUnit.js.map | 1 + tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.ts | 555 ++++++++ .../Scripts/typings/node/node.d.ts | 1260 +++++++++++++++++ tsUnit.Node.Examples/app.js | 20 + tsUnit.Node.Examples/app.js.map | 1 + tsUnit.Node.Examples/app.ts | 25 + .../obj/Release/Scripts/FizzBuzz.ts | 17 + .../obj/Release/Scripts/FizzBuzzTests.ts | 30 + .../obj/Release/Scripts/tsUnit/tsUnit.ts | 555 ++++++++ tsUnit.Node.Examples/obj/Release/app.js | 17 + .../bin/Microsoft.NodejsTools.WebRole.dll | Bin 0 -> 24776 bytes tsUnit.Node.Examples/obj/Release/package.json | 10 + ...Node.Examples.njsproj.FileListAbsolute.txt | 7 + ...ples.njsprojResolveAssemblyReference.cache | Bin 0 -> 2595 bytes tsUnit.Node.Examples/package.json | 10 + .../tsUnit.Node.Examples.njsproj | 88 ++ tsUnit.Packager/Package.nuspec | 2 +- .../content/Scripts/tsUnit/tsUnit.ts | 10 +- tsUnit.sln | 9 +- tsUnit/Scripts/tsUnit/tsUnit.ts | 10 +- 33 files changed, 3214 insertions(+), 40 deletions(-) create mode 100644 tsUnit.Node.Examples/Scripts/FizzBuzz.js create mode 100644 tsUnit.Node.Examples/Scripts/FizzBuzz.js.map create mode 100644 tsUnit.Node.Examples/Scripts/FizzBuzz.ts create mode 100644 tsUnit.Node.Examples/Scripts/FizzBuzzTests.js create mode 100644 tsUnit.Node.Examples/Scripts/FizzBuzzTests.js.map create mode 100644 tsUnit.Node.Examples/Scripts/FizzBuzzTests.ts create mode 100644 tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.js create mode 100644 tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.js.map create mode 100644 tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.ts create mode 100644 tsUnit.Node.Examples/Scripts/typings/node/node.d.ts create mode 100644 tsUnit.Node.Examples/app.js create mode 100644 tsUnit.Node.Examples/app.js.map create mode 100644 tsUnit.Node.Examples/app.ts create mode 100644 tsUnit.Node.Examples/obj/Release/Scripts/FizzBuzz.ts create mode 100644 tsUnit.Node.Examples/obj/Release/Scripts/FizzBuzzTests.ts create mode 100644 tsUnit.Node.Examples/obj/Release/Scripts/tsUnit/tsUnit.ts create mode 100644 tsUnit.Node.Examples/obj/Release/app.js create mode 100644 tsUnit.Node.Examples/obj/Release/bin/Microsoft.NodejsTools.WebRole.dll create mode 100644 tsUnit.Node.Examples/obj/Release/package.json create mode 100644 tsUnit.Node.Examples/obj/Release/tsUnit.Node.Examples.njsproj.FileListAbsolute.txt create mode 100644 tsUnit.Node.Examples/obj/Release/tsUnit.Node.Examples.njsprojResolveAssemblyReference.cache create mode 100644 tsUnit.Node.Examples/package.json create mode 100644 tsUnit.Node.Examples/tsUnit.Node.Examples.njsproj diff --git a/tsUnit.Examples/Scripts/tsUnit/tsUnit.ts b/tsUnit.Examples/Scripts/tsUnit/tsUnit.ts index 5204ea5..e22465f 100644 --- a/tsUnit.Examples/Scripts/tsUnit/tsUnit.ts +++ b/tsUnit.Examples/Scripts/tsUnit/tsUnit.ts @@ -1,7 +1,3 @@ -interface Object { - [index: string]: any; -} - module tsUnit { export class Test { private tests: TestDefintion[] = []; @@ -37,21 +33,21 @@ module tsUnit { var dynamicTestClass = testClass; var testsGroupName = this.tests[i].name; - if (!testRunLimiter.isTestsGroupActive(testsGroupName)) { + if (testRunLimiter && !testRunLimiter.isTestsGroupActive(testsGroupName)) { continue; } for (var unitTestName in testClass) { if (this.isReservedFunctionName(unitTestName) || (typeof dynamicTestClass[unitTestName] !== 'function') - || !testRunLimiter.isTestActive(unitTestName)) { + || (testRunLimiter && !testRunLimiter.isTestActive(unitTestName))) { continue; } if (typeof dynamicTestClass[unitTestName].parameters !== 'undefined') { parameters = dynamicTestClass[unitTestName].parameters; for (var parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) { - if (!testRunLimiter.isParametersSetActive(parameterIndex)) { + if (testRunLimiter && !testRunLimiter.isParametersSetActive(parameterIndex)) { continue; } diff --git a/tsUnit.Examples/packages.config b/tsUnit.Examples/packages.config index cfb3967..b83d44a 100644 --- a/tsUnit.Examples/packages.config +++ b/tsUnit.Examples/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/tsUnit.External.Examples/Scripts/tsUnit/tsUnit.ts b/tsUnit.External.Examples/Scripts/tsUnit/tsUnit.ts index 6da99e0..1ae400f 100644 --- a/tsUnit.External.Examples/Scripts/tsUnit/tsUnit.ts +++ b/tsUnit.External.Examples/Scripts/tsUnit/tsUnit.ts @@ -1,7 +1,3 @@ -interface Object { - [index: string]: any; -} - module tsUnit { export class Test { private tests: TestDefintion[] = []; @@ -37,21 +33,21 @@ module tsUnit { var dynamicTestClass = testClass; var testsGroupName = this.tests[i].name; - if (!testRunLimiter.isTestsGroupActive(testsGroupName)) { + if (testRunLimiter && !testRunLimiter.isTestsGroupActive(testsGroupName)) { continue; } for (var unitTestName in testClass) { if (this.isReservedFunctionName(unitTestName) || (typeof dynamicTestClass[unitTestName] !== 'function') - || !testRunLimiter.isTestActive(unitTestName)) { + || (testRunLimiter && !testRunLimiter.isTestActive(unitTestName))) { continue; } if (typeof dynamicTestClass[unitTestName].parameters !== 'undefined') { parameters = dynamicTestClass[unitTestName].parameters; for (var parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) { - if (!testRunLimiter.isParametersSetActive(parameterIndex)) { + if (testRunLimiter && !testRunLimiter.isParametersSetActive(parameterIndex)) { continue; } diff --git a/tsUnit.External.Examples/packages.config b/tsUnit.External.Examples/packages.config index ef19bee..f0daf12 100644 --- a/tsUnit.External.Examples/packages.config +++ b/tsUnit.External.Examples/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/tsUnit.External.Packager/Package.nuspec b/tsUnit.External.Packager/Package.nuspec index 25e3cad..295b770 100644 --- a/tsUnit.External.Packager/Package.nuspec +++ b/tsUnit.External.Packager/Package.nuspec @@ -2,7 +2,7 @@ tsUnit.external - 1.6.0 + 1.7.0 tsUnit.external Steve Fenton Steve Fenton diff --git a/tsUnit.External.Packager/content/Scripts/tsUnit/tsUnit.ts b/tsUnit.External.Packager/content/Scripts/tsUnit/tsUnit.ts index 6da99e0..1ae400f 100644 --- a/tsUnit.External.Packager/content/Scripts/tsUnit/tsUnit.ts +++ b/tsUnit.External.Packager/content/Scripts/tsUnit/tsUnit.ts @@ -1,7 +1,3 @@ -interface Object { - [index: string]: any; -} - module tsUnit { export class Test { private tests: TestDefintion[] = []; @@ -37,21 +33,21 @@ module tsUnit { var dynamicTestClass = testClass; var testsGroupName = this.tests[i].name; - if (!testRunLimiter.isTestsGroupActive(testsGroupName)) { + if (testRunLimiter && !testRunLimiter.isTestsGroupActive(testsGroupName)) { continue; } for (var unitTestName in testClass) { if (this.isReservedFunctionName(unitTestName) || (typeof dynamicTestClass[unitTestName] !== 'function') - || !testRunLimiter.isTestActive(unitTestName)) { + || (testRunLimiter && !testRunLimiter.isTestActive(unitTestName))) { continue; } if (typeof dynamicTestClass[unitTestName].parameters !== 'undefined') { parameters = dynamicTestClass[unitTestName].parameters; for (var parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) { - if (!testRunLimiter.isParametersSetActive(parameterIndex)) { + if (testRunLimiter && !testRunLimiter.isParametersSetActive(parameterIndex)) { continue; } diff --git a/tsUnit.Node.Examples/Scripts/FizzBuzz.js b/tsUnit.Node.Examples/Scripts/FizzBuzz.js new file mode 100644 index 0000000..2fd6431 --- /dev/null +++ b/tsUnit.Node.Examples/Scripts/FizzBuzz.js @@ -0,0 +1,21 @@ +var FizzBuzz = (function () { + function FizzBuzz() { + } + FizzBuzz.prototype.generate = function (input) { + var output = ''; + + if (input % 3 === 0) { + output += 'Fizz'; + } + + if (input % 5 === 0) { + output += 'Buzz'; + } + + return output === '' ? input : output; + }; + return FizzBuzz; +})(); + +module.exports = FizzBuzz; +//# sourceMappingURL=FizzBuzz.js.map diff --git a/tsUnit.Node.Examples/Scripts/FizzBuzz.js.map b/tsUnit.Node.Examples/Scripts/FizzBuzz.js.map new file mode 100644 index 0000000..dad3da7 --- /dev/null +++ b/tsUnit.Node.Examples/Scripts/FizzBuzz.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FizzBuzz.js","sourceRoot":"","sources":["FizzBuzz.ts"],"names":["FizzBuzz","FizzBuzz.constructor","FizzBuzz.generate"],"mappings":"AAAA;IAAAA;IAcAC,CAACA;AAAAD,IAbGA,8BAAAA,UAASA,KAAaA;QAClBE,IAAIA,MAAMA,GAAGA,EAAEA;;QAEfA,IAAIA,KAAKA,GAAGA,CAACA,KAAKA,CAACA,CAAEA;YACjBA,MAAMA,IAAIA,MAAMA;SACnBA;;QAEDA,IAAIA,KAAKA,GAAGA,CAACA,KAAKA,CAACA,CAAEA;YACjBA,MAAMA,IAAIA,MAAMA;SACnBA;;QAEDA,OAAOA,MAAMA,KAAKA,EAAEA,GAAGA,KAAKA,GAAGA,MAAMA;IACzCA,CAACA;IACLF,gBAACA;AAADA,CAACA,IAAA;;AAED,yBAAkB,CAAA"} \ No newline at end of file diff --git a/tsUnit.Node.Examples/Scripts/FizzBuzz.ts b/tsUnit.Node.Examples/Scripts/FizzBuzz.ts new file mode 100644 index 0000000..1452d3b --- /dev/null +++ b/tsUnit.Node.Examples/Scripts/FizzBuzz.ts @@ -0,0 +1,17 @@ +class FizzBuzz { + generate(input: number): any { + var output = ''; + + if (input % 3 === 0) { + output += 'Fizz'; + } + + if (input % 5 === 0) { + output += 'Buzz'; + } + + return output === '' ? input : output; + } +} + +export = FizzBuzz; \ No newline at end of file diff --git a/tsUnit.Node.Examples/Scripts/FizzBuzzTests.js b/tsUnit.Node.Examples/Scripts/FizzBuzzTests.js new file mode 100644 index 0000000..57d9742 --- /dev/null +++ b/tsUnit.Node.Examples/Scripts/FizzBuzzTests.js @@ -0,0 +1,42 @@ +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var tsUnit = require('./tsUnit/tsUnit'); +var FizzBuzz = require('./FizzBuzz'); + +var target = new FizzBuzz(); + +var FizzBuzzTests = (function (_super) { + __extends(FizzBuzzTests, _super); + function FizzBuzzTests() { + _super.apply(this, arguments); + } + FizzBuzzTests.prototype.normalNumbersReturnOriginalNumber = function () { + this.areIdentical(1, target.generate(1)); + this.areIdentical(2, target.generate(2)); + this.areIdentical(4, target.generate(4)); + }; + + FizzBuzzTests.prototype.numberDivisibleByThreeShouldReturnFizz = function () { + this.areIdentical("Fizz", target.generate(3)); + this.areIdentical("Fizz", target.generate(6)); + this.areIdentical("Fizz", target.generate(9)); + }; + + FizzBuzzTests.prototype.numbersDivisibleByFiveShouldReturnBuzz = function () { + this.areIdentical("Buzz", target.generate(5)); + this.areIdentical("Buzz", target.generate(10)); + this.areIdentical("Buzz", target.generate(20)); + }; + FizzBuzzTests.prototype.numbersDivisibleByThreeAndFiveShouldReturnFizzBuzz = function () { + this.areIdentical("FizzBuzz", target.generate(15)); + this.areIdentical("FizzBuzz", target.generate(30)); + this.areIdentical("FizzBuzz", target.generate(45)); + }; + return FizzBuzzTests; +})(tsUnit.TestClass); +exports.FizzBuzzTests = FizzBuzzTests; +//# sourceMappingURL=FizzBuzzTests.js.map diff --git a/tsUnit.Node.Examples/Scripts/FizzBuzzTests.js.map b/tsUnit.Node.Examples/Scripts/FizzBuzzTests.js.map new file mode 100644 index 0000000..85e81e8 --- /dev/null +++ b/tsUnit.Node.Examples/Scripts/FizzBuzzTests.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FizzBuzzTests.js","sourceRoot":"","sources":["FizzBuzzTests.ts"],"names":["FizzBuzzTests","FizzBuzzTests.constructor","FizzBuzzTests.normalNumbersReturnOriginalNumber","FizzBuzzTests.numberDivisibleByThreeShouldReturnFizz","FizzBuzzTests.numbersDivisibleByFiveShouldReturnBuzz","FizzBuzzTests.numbersDivisibleByThreeAndFiveShouldReturnFizzBuzz"],"mappings":";;;;;;AAAA,uCAA2C;AAC3C,oCAAwC;;AAExC,IAAI,MAAM,GAAG,IAAI,QAAQ,CAAC,CAAC;;AAE3B;IAAmCA,gCAAgBA;IAAnDA;QAAmCC,6BAAgBA;IAwBnDA,CAACA;AAAAD,IAtBGA,4DAAAA;QACIE,IAAIA,CAACA,YAAYA,CAACA,CAACA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,CAACA,CAACA,CAACA;QACxCA,IAAIA,CAACA,YAAYA,CAACA,CAACA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,CAACA,CAACA,CAACA;QACxCA,IAAIA,CAACA,YAAYA,CAACA,CAACA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,CAACA,CAACA,CAACA;IAC5CA,CAACA;;IAEDF,iEAAAA;QACIG,IAAIA,CAACA,YAAYA,CAACA,MAAMA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,CAACA,CAACA,CAACA;QAC7CA,IAAIA,CAACA,YAAYA,CAACA,MAAMA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,CAACA,CAACA,CAACA;QAC7CA,IAAIA,CAACA,YAAYA,CAACA,MAAMA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,CAACA,CAACA,CAACA;IACjDA,CAACA;;IAEDH,iEAAAA;QACII,IAAIA,CAACA,YAAYA,CAACA,MAAMA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,CAACA,CAACA,CAACA;QAC7CA,IAAIA,CAACA,YAAYA,CAACA,MAAMA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,EAAEA,CAACA,CAACA;QAC9CA,IAAIA,CAACA,YAAYA,CAACA,MAAMA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,EAAEA,CAACA,CAACA;IAClDA,CAACA;IACDJ,6EAAAA;QACIK,IAAIA,CAACA,YAAYA,CAACA,UAAUA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,EAAEA,CAACA,CAACA;QAClDA,IAAIA,CAACA,YAAYA,CAACA,UAAUA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,EAAEA,CAACA,CAACA;QAClDA,IAAIA,CAACA,YAAYA,CAACA,UAAUA,EAAEA,MAAMA,CAACA,QAAQA,CAACA,EAAEA,CAACA,CAACA;IACtDA,CAACA;IACLL,qBAACA;AAADA,CAACA,EAxBkC,MAAM,CAAC,SAAS,EAwBlD;AAxBD,sCAwBC;AAAA"} \ No newline at end of file diff --git a/tsUnit.Node.Examples/Scripts/FizzBuzzTests.ts b/tsUnit.Node.Examples/Scripts/FizzBuzzTests.ts new file mode 100644 index 0000000..b1397d1 --- /dev/null +++ b/tsUnit.Node.Examples/Scripts/FizzBuzzTests.ts @@ -0,0 +1,30 @@ +import tsUnit = require('./tsUnit/tsUnit'); +import FizzBuzz = require('./FizzBuzz'); + +var target = new FizzBuzz(); + +export class FizzBuzzTests extends tsUnit.TestClass { + + normalNumbersReturnOriginalNumber() { + this.areIdentical(1, target.generate(1)); + this.areIdentical(2, target.generate(2)); + this.areIdentical(4, target.generate(4)); + } + + numberDivisibleByThreeShouldReturnFizz() { + this.areIdentical("Fizz", target.generate(3)); + this.areIdentical("Fizz", target.generate(6)); + this.areIdentical("Fizz", target.generate(9)); + } + + numbersDivisibleByFiveShouldReturnBuzz() { + this.areIdentical("Buzz", target.generate(5)); + this.areIdentical("Buzz", target.generate(10)); + this.areIdentical("Buzz", target.generate(20)); + } + numbersDivisibleByThreeAndFiveShouldReturnFizzBuzz() { + this.areIdentical("FizzBuzz", target.generate(15)); + this.areIdentical("FizzBuzz", target.generate(30)); + this.areIdentical("FizzBuzz", target.generate(45)); + } +} \ No newline at end of file diff --git a/tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.js b/tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.js new file mode 100644 index 0000000..a059a1d --- /dev/null +++ b/tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.js @@ -0,0 +1,479 @@ +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var tsUnit; +(function (tsUnit) { + var Test = (function () { + function Test() { + var testModules = []; + for (var _i = 0; _i < arguments.length; _i++) { + testModules[_i - 0] = arguments[_i]; + } + this.tests = []; + this.reservedMethodNameContainer = new TestClass(); + this.createTestLimiter(); + for (var i = 0; i < testModules.length; i++) { + var testModule = testModules[i]; + for (var testClass in testModule) { + this.addTestClass(new testModule[testClass](), testClass); + } + } + } + Test.prototype.addTestClass = function (testClass, name) { + if (name === void 0) { name = 'Tests'; } + this.tests.push(new TestDefintion(testClass, name)); + }; + Test.prototype.run = function (testRunLimiter) { + if (testRunLimiter === void 0) { testRunLimiter = null; } + var parameters = null; + var testContext = new TestContext(); + var testResult = new TestResult(); + if (testRunLimiter == null) { + testRunLimiter = this.testRunLimiter; + } + for (var i = 0; i < this.tests.length; ++i) { + var testClass = this.tests[i].testClass; + var dynamicTestClass = testClass; + var testsGroupName = this.tests[i].name; + if (testRunLimiter && !testRunLimiter.isTestsGroupActive(testsGroupName)) { + continue; + } + for (var unitTestName in testClass) { + if (this.isReservedFunctionName(unitTestName) || (typeof dynamicTestClass[unitTestName] !== 'function') || (testRunLimiter && !testRunLimiter.isTestActive(unitTestName))) { + continue; + } + if (typeof dynamicTestClass[unitTestName].parameters !== 'undefined') { + parameters = dynamicTestClass[unitTestName].parameters; + for (var parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) { + if (testRunLimiter && !testRunLimiter.isParametersSetActive(parameterIndex)) { + continue; + } + this.runSingleTest(testResult, testClass, unitTestName, testsGroupName, parameters, parameterIndex); + } + } + else { + this.runSingleTest(testResult, testClass, unitTestName, testsGroupName); + } + } + } + return testResult; + }; + Test.prototype.showResults = function (target, result) { + var template = '
' + '

' + this.getTestResult(result) + '

' + '

' + this.getTestSummary(result) + '

' + this.testRunLimiter.getLimitCleaner() + '
' + '

Errors

' + '
    ' + this.getTestResultList(result.errors) + '
' + '
' + '
' + '

Passing Tests

' + '
    ' + this.getTestResultList(result.passes) + '
' + '
' + '
' + this.testRunLimiter.getLimitCleaner(); + target.innerHTML = template; + }; + Test.prototype.getTapResults = function (result) { + var newLine = '\r\n'; + var template = '1..' + (result.passes.length + result.errors.length).toString() + newLine; + for (var i = 0; i < result.errors.length; i++) { + template += 'not ok ' + result.errors[i].message + ' ' + result.errors[i].testName + newLine; + } + for (var i = 0; i < result.passes.length; i++) { + template += 'ok ' + result.passes[i].testName + newLine; + } + return template; + }; + Test.prototype.createTestLimiter = function () { + try { + if (typeof window !== 'undefined') { + this.testRunLimiter = new TestRunLimiter(); + } + } + catch (ex) { + } + }; + Test.prototype.isReservedFunctionName = function (functionName) { + for (var prop in this.reservedMethodNameContainer) { + if (prop === functionName) { + return true; + } + } + return false; + }; + Test.prototype.runSingleTest = function (testResult, testClass, unitTestName, testsGroupName, parameters, parameterSetIndex) { + if (parameters === void 0) { parameters = null; } + if (parameterSetIndex === void 0) { parameterSetIndex = null; } + if (typeof testClass['setUp'] === 'function') { + testClass['setUp'](); + } + try { + var dynamicTestClass = testClass; + var args = (parameterSetIndex !== null) ? parameters[parameterSetIndex] : null; + dynamicTestClass[unitTestName].apply(testClass, args); + testResult.passes.push(new TestDescription(testsGroupName, unitTestName, parameterSetIndex, 'OK')); + } + catch (err) { + testResult.errors.push(new TestDescription(testsGroupName, unitTestName, parameterSetIndex, err.toString())); + } + if (typeof testClass['tearDown'] === 'function') { + testClass['tearDown'](); + } + }; + Test.prototype.getTestResult = function (result) { + return result.errors.length === 0 ? 'Test Passed' : 'Test Failed'; + }; + Test.prototype.getTestSummary = function (result) { + return 'Total tests: ' + (result.passes.length + result.errors.length).toString() + '. ' + 'Passed tests: ' + result.passes.length + '. ' + 'Failed tests: ' + result.errors.length + '.'; + }; + Test.prototype.getTestResultList = function (testResults) { + var list = ''; + var group = ''; + var isFirst = true; + for (var i = 0; i < testResults.length; ++i) { + var result = testResults[i]; + if (result.testName !== group) { + group = result.testName; + if (isFirst) { + isFirst = false; + } + else { + list += ''; + } + list += '
  • ' + this.testRunLimiter.getLimiterForGroup(group) + result.testName + '
      '; + } + var resultClass = (result.message === 'OK') ? 'success' : 'error'; + var functionLabal = result.funcName + ((result.parameterSetNumber === null) ? '()' : '(' + this.testRunLimiter.getLimiterForTest(group, result.funcName, result.parameterSetNumber) + ' paramater set: ' + result.parameterSetNumber + ')'); + list += '
    • ' + this.testRunLimiter.getLimiterForTest(group, result.funcName) + functionLabal + ': ' + this.encodeHtmlEntities(result.message) + '
    • '; + } + return list + '
    '; + }; + Test.prototype.encodeHtmlEntities = function (input) { + return input.replace(/&/g, '&').replace(//g, '>'); + }; + return Test; + })(); + tsUnit.Test = Test; + var TestRunLimiterRunAll = (function () { + function TestRunLimiterRunAll() { + } + TestRunLimiterRunAll.prototype.isTestsGroupActive = function (groupName) { + return true; + }; + TestRunLimiterRunAll.prototype.isTestActive = function (testName) { + return true; + }; + TestRunLimiterRunAll.prototype.isParametersSetActive = function (paramatersSetNumber) { + return true; + }; + return TestRunLimiterRunAll; + })(); + var TestRunLimiter = (function () { + function TestRunLimiter() { + this.groupName = null; + this.testName = null; + this.parameterSet = null; + this.setRefreshOnLinksWithHash(); + this.translateStringIntoTestsLimit(window.location.hash); + } + TestRunLimiter.prototype.isTestsGroupActive = function (groupName) { + if (this.groupName === null) { + return true; + } + return this.groupName === groupName; + }; + TestRunLimiter.prototype.isTestActive = function (testName) { + if (this.testName === null) { + return true; + } + return this.testName === testName; + }; + TestRunLimiter.prototype.isParametersSetActive = function (paramatersSet) { + if (this.parameterSet === null) { + return true; + } + return this.parameterSet === paramatersSet; + }; + TestRunLimiter.prototype.getLimiterForTest = function (groupName, testName, parameterSet) { + if (parameterSet === void 0) { parameterSet = null; } + if (parameterSet !== null) { + testName += '(' + parameterSet + ')'; + } + return '  '; + }; + TestRunLimiter.prototype.getLimiterForGroup = function (groupName) { + return '  '; + }; + TestRunLimiter.prototype.getLimitCleaner = function () { + return '

    Run all tests

    '; + }; + TestRunLimiter.prototype.setRefreshOnLinksWithHash = function () { + var previousHandler = window.onhashchange; + window.onhashchange = function (ev) { + window.location.reload(); + if (typeof previousHandler === 'function') { + previousHandler(ev); + } + }; + }; + TestRunLimiter.prototype.translateStringIntoTestsLimit = function (value) { + var regex = /^#([_a-zA-Z0-9]+)((\/([_a-zA-Z0-9]+))(\(([0-9]+)\))?)?$/; + var result = regex.exec(value); + if (result === null) { + return; + } + if (result.length > 1 && !!result[1]) { + this.groupName = result[1]; + } + if (result.length > 4 && !!result[4]) { + this.testName = result[4]; + } + if (result.length > 6 && !!result[6]) { + this.parameterSet = parseInt(result[6], 10); + } + }; + return TestRunLimiter; + })(); + var TestContext = (function () { + function TestContext() { + } + TestContext.prototype.setUp = function () { + }; + TestContext.prototype.tearDown = function () { + }; + TestContext.prototype.areIdentical = function (expected, actual, message) { + if (message === void 0) { message = ''; } + if (expected !== actual) { + throw this.getError('areIdentical failed when given ' + this.printVariable(expected) + ' and ' + this.printVariable(actual), message); + } + }; + TestContext.prototype.areNotIdentical = function (expected, actual, message) { + if (message === void 0) { message = ''; } + if (expected === actual) { + throw this.getError('areNotIdentical failed when given ' + this.printVariable(expected) + ' and ' + this.printVariable(actual), message); + } + }; + TestContext.prototype.areCollectionsIdentical = function (expected, actual, message) { + var _this = this; + if (message === void 0) { message = ''; } + function resultToString(result) { + var msg = ''; + while (result.length > 0) { + msg = '[' + result.pop() + ']' + msg; + } + return msg; + } + var compareArray = function (expected, actual, result) { + var indexString = ''; + if (expected === null) { + if (actual !== null) { + indexString = resultToString(result); + throw _this.getError('areCollectionsIdentical failed when array a' + indexString + ' is null and b' + indexString + ' is not null', message); + } + return; // correct: both are nulls + } + else if (actual === null) { + indexString = resultToString(result); + throw _this.getError('areCollectionsIdentical failed when array a' + indexString + ' is not null and b' + indexString + ' is null', message); + } + if (expected.length !== actual.length) { + indexString = resultToString(result); + throw _this.getError('areCollectionsIdentical failed when length of array a' + indexString + ' (length: ' + expected.length + ') is different of length of array b' + indexString + ' (length: ' + actual.length + ')', message); + } + for (var i = 0; i < expected.length; i++) { + if ((expected[i] instanceof Array) && (actual[i] instanceof Array)) { + result.push(i); + compareArray(expected[i], actual[i], result); + result.pop(); + } + else if (expected[i] !== actual[i]) { + result.push(i); + indexString = resultToString(result); + throw _this.getError('areCollectionsIdentical failed when element a' + indexString + ' (' + _this.printVariable(expected[i]) + ') is different than element b' + indexString + ' (' + _this.printVariable(actual[i]) + ')', message); + } + } + return; + }; + compareArray(expected, actual, []); + }; + TestContext.prototype.areCollectionsNotIdentical = function (expected, actual, message) { + if (message === void 0) { message = ''; } + try { + this.areCollectionsIdentical(expected, actual); + } + catch (ex) { + return; + } + throw this.getError('areCollectionsNotIdentical failed when both collections are identical', message); + }; + TestContext.prototype.isTrue = function (actual, message) { + if (message === void 0) { message = ''; } + if (!actual) { + throw this.getError('isTrue failed when given ' + this.printVariable(actual), message); + } + }; + TestContext.prototype.isFalse = function (actual, message) { + if (message === void 0) { message = ''; } + if (actual) { + throw this.getError('isFalse failed when given ' + this.printVariable(actual), message); + } + }; + TestContext.prototype.isTruthy = function (actual, message) { + if (message === void 0) { message = ''; } + if (!actual) { + throw this.getError('isTrue failed when given ' + this.printVariable(actual), message); + } + }; + TestContext.prototype.isFalsey = function (actual, message) { + if (message === void 0) { message = ''; } + if (actual) { + throw this.getError('isFalse failed when given ' + this.printVariable(actual), message); + } + }; + TestContext.prototype.throws = function (a, message, errorString) { + if (message === void 0) { message = ''; } + if (errorString === void 0) { errorString = ''; } + var actual; + if (a.fn) { + actual = a.fn; + message = a.message; + errorString = a.exceptionString; + } + var isThrown = false; + try { + actual(); + } + catch (ex) { + if (!errorString || ex.message === errorString) { + isThrown = true; + } + if (errorString && ex.message !== errorString) { + throw this.getError('different error string than supplied'); + } + } + if (!isThrown) { + throw this.getError('did not throw an error', message || ''); + } + }; + TestContext.prototype.executesWithin = function (actual, timeLimit, message) { + if (message === void 0) { message = null; } + function getTime() { + return window.performance.now(); + } + function timeToString(value) { + return Math.round(value * 100) / 100; + } + var startOfExecution = getTime(); + try { + actual(); + } + catch (ex) { + throw this.getError('isExecuteTimeLessThanLimit fails when given code throws an exception: "' + ex + '"', message); + } + var executingTime = getTime() - startOfExecution; + if (executingTime > timeLimit) { + throw this.getError('isExecuteTimeLessThanLimit fails when execution time of given code (' + timeToString(executingTime) + ' ms) ' + 'exceed the given limit(' + timeToString(timeLimit) + ' ms)', message); + } + }; + TestContext.prototype.fail = function (message) { + if (message === void 0) { message = ''; } + throw this.getError('fail', message); + }; + TestContext.prototype.getError = function (resultMessage, message) { + if (message === void 0) { message = ''; } + if (message) { + return new Error(resultMessage + '. ' + message); + } + return new Error(resultMessage); + }; + TestContext.getNameOfClass = function (inputClass) { + // see: https://www.stevefenton.co.uk/Content/Blog/Date/201304/Blog/Obtaining-A-Class-Name-At-Runtime-In-TypeScript/ + var funcNameRegex = /function (.{1,})\(/; + var results = (funcNameRegex).exec(inputClass.constructor.toString()); + return (results && results.length > 1) ? results[1] : ''; + }; + TestContext.prototype.printVariable = function (variable) { + if (variable === null) { + return '"null"'; + } + if (typeof variable === 'object') { + return '{object: ' + TestContext.getNameOfClass(variable) + '}'; + } + return '{' + (typeof variable) + '} "' + variable + '"'; + }; + return TestContext; + })(); + tsUnit.TestContext = TestContext; + var TestClass = (function (_super) { + __extends(TestClass, _super); + function TestClass() { + _super.apply(this, arguments); + } + TestClass.prototype.parameterizeUnitTest = function (method, parametersArray) { + method.parameters = parametersArray; + }; + return TestClass; + })(TestContext); + tsUnit.TestClass = TestClass; + var FakeFactory = (function () { + function FakeFactory() { + } + FakeFactory.getFake = function (obj) { + var implementations = []; + for (var _i = 1; _i < arguments.length; _i++) { + implementations[_i - 1] = arguments[_i]; + } + var fakeType = function () { + }; + this.populateFakeType(fakeType, obj); + var fake = new fakeType(); + for (var member in fake) { + if (typeof fake[member] === 'function') { + fake[member] = function () { + console.log('Default fake called.'); + }; + } + } + var memberNameIndex = 0; + var memberValueIndex = 1; + for (var i = 0; i < implementations.length; i++) { + var impl = implementations[i]; + fake[impl[memberNameIndex]] = impl[memberValueIndex]; + } + return fake; + }; + FakeFactory.populateFakeType = function (fake, toCopy) { + for (var property in toCopy) { + if (toCopy.hasOwnProperty(property)) { + fake[property] = toCopy[property]; + } + } + var __ = function () { + this.constructor = fake; + }; + __.prototype = toCopy.prototype; + fake.prototype = new __(); + }; + return FakeFactory; + })(); + tsUnit.FakeFactory = FakeFactory; + var TestDefintion = (function () { + function TestDefintion(testClass, name) { + this.testClass = testClass; + this.name = name; + } + return TestDefintion; + })(); + var TestDescription = (function () { + function TestDescription(testName, funcName, parameterSetNumber, message) { + this.testName = testName; + this.funcName = funcName; + this.parameterSetNumber = parameterSetNumber; + this.message = message; + } + return TestDescription; + })(); + tsUnit.TestDescription = TestDescription; + var TestResult = (function () { + function TestResult() { + this.passes = []; + this.errors = []; + } + return TestResult; + })(); + tsUnit.TestResult = TestResult; +})(tsUnit || (tsUnit = {})); +module.exports = tsUnit; +//# sourceMappingURL=tsUnit.js.map \ No newline at end of file diff --git a/tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.js.map b/tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.js.map new file mode 100644 index 0000000..4428b06 --- /dev/null +++ b/tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tsUnit.js","sourceRoot":"","sources":["tsUnit.ts"],"names":["tsUnit","tsUnit.Test","tsUnit.Test.constructor","tsUnit.Test.addTestClass","tsUnit.Test.run","tsUnit.Test.showResults","tsUnit.Test.getTapResults","tsUnit.Test.createTestLimiter","tsUnit.Test.isReservedFunctionName","tsUnit.Test.runSingleTest","tsUnit.Test.getTestResult","tsUnit.Test.getTestSummary","tsUnit.Test.getTestResultList","tsUnit.Test.encodeHtmlEntities","tsUnit.TestRunLimiterRunAll","tsUnit.TestRunLimiterRunAll.constructor","tsUnit.TestRunLimiterRunAll.isTestsGroupActive","tsUnit.TestRunLimiterRunAll.isTestActive","tsUnit.TestRunLimiterRunAll.isParametersSetActive","tsUnit.TestRunLimiter","tsUnit.TestRunLimiter.constructor","tsUnit.TestRunLimiter.isTestsGroupActive","tsUnit.TestRunLimiter.isTestActive","tsUnit.TestRunLimiter.isParametersSetActive","tsUnit.TestRunLimiter.getLimiterForTest","tsUnit.TestRunLimiter.getLimiterForGroup","tsUnit.TestRunLimiter.getLimitCleaner","tsUnit.TestRunLimiter.setRefreshOnLinksWithHash","tsUnit.TestRunLimiter.translateStringIntoTestsLimit","tsUnit.TestContext","tsUnit.TestContext.constructor","tsUnit.TestContext.setUp","tsUnit.TestContext.tearDown","tsUnit.TestContext.areIdentical","tsUnit.TestContext.areNotIdentical","tsUnit.TestContext.areCollectionsIdentical","tsUnit.TestContext.areCollectionsIdentical.resultToString","tsUnit.TestContext.areCollectionsNotIdentical","tsUnit.TestContext.isTrue","tsUnit.TestContext.isFalse","tsUnit.TestContext.isTruthy","tsUnit.TestContext.isFalsey","tsUnit.TestContext.throws","tsUnit.TestContext.executesWithin","tsUnit.TestContext.executesWithin.getTime","tsUnit.TestContext.executesWithin.timeToString","tsUnit.TestContext.fail","tsUnit.TestContext.getError","tsUnit.TestContext.getNameOfClass","tsUnit.TestContext.printVariable","tsUnit.TestClass","tsUnit.TestClass.constructor","tsUnit.TestClass.parameterizeUnitTest","tsUnit.FakeFactory","tsUnit.FakeFactory.constructor","tsUnit.FakeFactory.getFake","tsUnit.FakeFactory.populateFakeType","tsUnit.TestDefintion","tsUnit.TestDefintion.constructor","tsUnit.TestDescription","tsUnit.TestDescription.constructor","tsUnit.TestResult","tsUnit.TestResult.constructor"],"mappings":";;;;;;AAIA,IAAO,MAAM,CAsiBZ;AAtiBD,WAAO,MAAM,EAAC,CAAC;IACXA,IAAaA,IAAIA;QAKbC,SALSA,IAAIA;YAKDC,qBAAqBA;iBAArBA,WAAqBA,CAArBA,sBAAqBA,CAArBA,IAAqBA;gBAArBA,oCAAqBA;;YAJzBA,UAAKA,GAAoBA,EAAEA,CAACA;YAE5BA,gCAA2BA,GAAcA,IAAIA,SAASA,EAAEA,CAACA;YAG7DA,IAAIA,CAACA,iBAAiBA,EAAEA,CAACA;YAEzBA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,WAAWA,CAACA,MAAMA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;gBAC1CA,IAAIA,UAAUA,GAAGA,WAAWA,CAACA,CAACA,CAACA,CAACA;gBAChCA,GAAGA,CAACA,CAACA,GAAGA,CAACA,SAASA,IAAIA,UAAUA,CAACA,CAACA,CAACA;oBAC/BA,IAAIA,CAACA,YAAYA,CAACA,IAAIA,UAAUA,CAACA,SAASA,CAACA,EAAEA,EAAEA,SAASA,CAACA,CAACA;gBAC9DA,CAACA;YACLA,CAACA;QACLA,CAACA;QAEDD,2BAAYA,GAAZA,UAAaA,SAAoBA,EAAEA,IAAsBA;YAAtBE,oBAAsBA,GAAtBA,cA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,SADSA,eAAeA,CACLA,QAAgBA,EAASA,QAAgBA,EAASA,kBAA0BA,EAASA,OAAeA;YAApGC,aAAQA,GAARA,QAAQA,CAAQA;YAASA,aAAQA,GAARA,QAAQA,CAAQA;YAASA,uBAAkBA,GAAlBA,kBAAkBA,CAAQA;YAASA,YAAOA,GAAPA,OAAOA,CAAQA;QACvHA,CAACA;QACLD,sBAACA;IAADA,CAACA,AAHD3D,IAGCA;IAHYA,sBAAeA,GAAfA,eAGZA,CAAAA;IAEDA,IAAaA,UAAUA;QAAvB6D,SAAaA,UAAUA;YACZC,WAAMA,GAAsBA,EAAEA,CAACA;YAC/BA,WAAMA,GAAsBA,EAAEA,CAACA;QAC1CA,CAACA;QAADD,iBAACA;IAADA,CAACA,AAHD7D,IAGCA;IAHYA,iBAAUA,GAAVA,UAGZA,CAAAA;AACLA,CAACA,EAtiBM,MAAM,KAAN,MAAM,QAsiBZ;AAAgB,AAAhB,iBAAS,MAAM,CAAC"} \ No newline at end of file diff --git a/tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.ts b/tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.ts new file mode 100644 index 0000000..b2a50ae --- /dev/null +++ b/tsUnit.Node.Examples/Scripts/tsUnit/tsUnit.ts @@ -0,0 +1,555 @@ +interface Object { + [index: string]: any; +} + +module tsUnit { + export class Test { + private tests: TestDefintion[] = []; + private testRunLimiter: TestRunLimiter; + private reservedMethodNameContainer: TestClass = new TestClass(); + + constructor(...testModules: any[]) { + this.createTestLimiter(); + + for (var i = 0; i < testModules.length; i++) { + var testModule = testModules[i]; + for (var testClass in testModule) { + this.addTestClass(new testModule[testClass](), testClass); + } + } + } + + addTestClass(testClass: TestClass, name: string = 'Tests'): void { + this.tests.push(new TestDefintion(testClass, name)); + } + + run(testRunLimiter: ITestRunLimiter = null) { + var parameters: any[][] = null; + var testContext = new TestContext(); + var testResult = new TestResult(); + + if (testRunLimiter == null) { + testRunLimiter = this.testRunLimiter; + } + + for (var i = 0; i < this.tests.length; ++i) { + var testClass = this.tests[i].testClass; + var dynamicTestClass = testClass; + var testsGroupName = this.tests[i].name; + + if (testRunLimiter && !testRunLimiter.isTestsGroupActive(testsGroupName)) { + continue; + } + + for (var unitTestName in testClass) { + if (this.isReservedFunctionName(unitTestName) + || (typeof dynamicTestClass[unitTestName] !== 'function') + || (testRunLimiter && !testRunLimiter.isTestActive(unitTestName))) { + continue; + } + + if (typeof dynamicTestClass[unitTestName].parameters !== 'undefined') { + parameters = dynamicTestClass[unitTestName].parameters; + for (var parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) { + if (testRunLimiter && !testRunLimiter.isParametersSetActive(parameterIndex)) { + continue; + } + + this.runSingleTest(testResult, testClass, unitTestName, testsGroupName, parameters, parameterIndex); + } + } else { + this.runSingleTest(testResult, testClass, unitTestName, testsGroupName); + } + } + } + + return testResult; + } + + showResults(target: HTMLElement, result: TestResult) { + var template = '
    ' + + '

    ' + this.getTestResult(result) + '

    ' + + '

    ' + this.getTestSummary(result) + '

    ' + + this.testRunLimiter.getLimitCleaner() + + '
    ' + + '

    Errors

    ' + + '
      ' + this.getTestResultList(result.errors) + '
    ' + + '
    ' + + '
    ' + + '

    Passing Tests

    ' + + '
      ' + this.getTestResultList(result.passes) + '
    ' + + '
    ' + + '
    ' + + this.testRunLimiter.getLimitCleaner(); + + target.innerHTML = template; + } + + getTapResults(result: TestResult) { + var newLine = '\r\n'; + var template = '1..' + (result.passes.length + result.errors.length).toString() + newLine; + + for (var i = 0; i < result.errors.length; i++) { + template += 'not ok ' + result.errors[i].message + ' ' + result.errors[i].testName + newLine; + } + + for (var i = 0; i < result.passes.length; i++) { + template += 'ok ' + result.passes[i].testName + newLine; + } + + return template; + } + + private createTestLimiter() { + try { + if (typeof window !== 'undefined') { + this.testRunLimiter = new TestRunLimiter(); + } + } catch (ex) { } + } + + private isReservedFunctionName(functionName: string): boolean { + for (var prop in this.reservedMethodNameContainer) { + if (prop === functionName) { + return true; + } + } + return false; + } + + private runSingleTest(testResult: TestResult, testClass: TestClass, unitTestName: string, testsGroupName: string, parameters: any[][]= null, parameterSetIndex: number = null) { + if (typeof testClass['setUp'] === 'function') { + testClass['setUp'](); + } + + try { + var dynamicTestClass: any = testClass; + var args = (parameterSetIndex !== null) ? parameters[parameterSetIndex] : null; + dynamicTestClass[unitTestName].apply(testClass, args); + + testResult.passes.push(new TestDescription(testsGroupName, unitTestName, parameterSetIndex, 'OK')); + } catch (err) { + testResult.errors.push(new TestDescription(testsGroupName, unitTestName, parameterSetIndex, err.toString())); + } + + if (typeof testClass['tearDown'] === 'function') { + testClass['tearDown'](); + } + } + + private getTestResult(result: TestResult) { + return result.errors.length === 0 ? 'Test Passed' : 'Test Failed'; + } + + private getTestSummary(result: TestResult) { + return 'Total tests: ' + (result.passes.length + result.errors.length).toString() + '. ' + + 'Passed tests: ' + result.passes.length + '. ' + + 'Failed tests: ' + result.errors.length + '.'; + } + + private getTestResultList(testResults: TestDescription[]) { + var list = ''; + var group = ''; + var isFirst = true; + for (var i = 0; i < testResults.length; ++i) { + var result = testResults[i]; + if (result.testName !== group) { + group = result.testName; + if (isFirst) { + isFirst = false; + } else { + list += '
  • '; + } + list += '
  • ' + this.testRunLimiter.getLimiterForGroup(group) + result.testName + '
      '; + } + + var resultClass = (result.message === 'OK') ? 'success' : 'error'; + var functionLabal = result.funcName + ((result.parameterSetNumber === null) + ? '()' + : '(' + this.testRunLimiter.getLimiterForTest(group, result.funcName, result.parameterSetNumber) + ' paramater set: ' + result.parameterSetNumber + ')'); + + list += '
    • ' + this.testRunLimiter.getLimiterForTest(group, result.funcName) + functionLabal + ': ' + this.encodeHtmlEntities(result.message) + '
    • '; + } + return list + '
    '; + } + + private encodeHtmlEntities(input: string) { + return input.replace(/&/g, '&').replace(//g, '>'); + } + } + + export interface ITestRunLimiter { + isTestsGroupActive(groupName: string): boolean; + isTestActive(testName: string): boolean; + isParametersSetActive(paramatersSetNumber: number): boolean; + } + + export interface IThrowsParameters { + fn: () => void; + message?: string; + errorString?: string; + } + + class TestRunLimiterRunAll implements ITestRunLimiter { + isTestsGroupActive(groupName: string): boolean { + return true; + } + + isTestActive(testName: string): boolean { + return true; + } + + isParametersSetActive(paramatersSetNumber: number): boolean { + return true; + } + } + + class TestRunLimiter implements ITestRunLimiter { + private groupName: string = null; + private testName: string = null; + private parameterSet: number = null; + + constructor() { + this.setRefreshOnLinksWithHash(); + this.translateStringIntoTestsLimit(window.location.hash); + } + + public isTestsGroupActive(groupName: string): boolean { + if (this.groupName === null) { + return true; + } + + return this.groupName === groupName; + } + + public isTestActive(testName: string): boolean { + if (this.testName === null) { + return true; + } + + return this.testName === testName; + } + + public isParametersSetActive(paramatersSet: number): boolean { + if (this.parameterSet === null) { + return true; + } + + return this.parameterSet === paramatersSet; + } + + public getLimiterForTest(groupName: string, testName: string, parameterSet: number = null): string { + if (parameterSet !== null) { + testName += '(' + parameterSet + ')'; + } + + return '  '; + } + + public getLimiterForGroup(groupName: string): string { + return '  '; + } + + public getLimitCleaner(): string { + return '

    Run all tests

    '; + } + + private setRefreshOnLinksWithHash() { + var previousHandler = window.onhashchange; + + window.onhashchange = function (ev: Event) { + window.location.reload(); + + if (typeof previousHandler === 'function') { + previousHandler(ev); + } + }; + } + + private translateStringIntoTestsLimit(value: string) { + var regex = /^#([_a-zA-Z0-9]+)((\/([_a-zA-Z0-9]+))(\(([0-9]+)\))?)?$/ + var result = regex.exec(value); + + if (result === null) { + return; + } + + if (result.length > 1 && !!result[1]) { + this.groupName = result[1]; + } + + if (result.length > 4 && !!result[4]) { + this.testName = result[4]; + } + + if (result.length > 6 && !!result[6]) { + this.parameterSet = parseInt(result[6], 10); + } + } + } + + export class TestContext { + setUp() { + } + + tearDown() { + } + + protected areIdentical(expected: any, actual: any, message = ''): void { + if (expected !== actual) { + throw this.getError('areIdentical failed when given ' + + this.printVariable(expected) + ' and ' + this.printVariable(actual), + message); + } + } + + protected areNotIdentical(expected: any, actual: any, message = ''): void { + if (expected === actual) { + throw this.getError('areNotIdentical failed when given ' + + this.printVariable(expected) + ' and ' + this.printVariable(actual), + message); + } + } + + protected areCollectionsIdentical(expected: any[], actual: any[], message = ''): void { + function resultToString(result: number[]): string { + var msg = ''; + + while (result.length > 0) { + msg = '[' + result.pop() + ']' + msg; + } + + return msg; + } + + var compareArray = (expected: any[], actual: any[], result: number[]): void => { + var indexString = ''; + + if (expected === null) { + if (actual !== null) { + indexString = resultToString(result); + throw this.getError('areCollectionsIdentical failed when array a' + + indexString + ' is null and b' + + indexString + ' is not null', + message); + } + + return; // correct: both are nulls + } else if (actual === null) { + indexString = resultToString(result); + throw this.getError('areCollectionsIdentical failed when array a' + + indexString + ' is not null and b' + + indexString + ' is null', + message); + } + + if (expected.length !== actual.length) { + indexString = resultToString(result); + throw this.getError('areCollectionsIdentical failed when length of array a' + + indexString + ' (length: ' + expected.length + ') is different of length of array b' + + indexString + ' (length: ' + actual.length + ')', + message); + } + + for (var i = 0; i < expected.length; i++) { + if ((expected[i] instanceof Array) && (actual[i] instanceof Array)) { + result.push(i); + compareArray(expected[i], actual[i], result); + result.pop(); + } else if (expected[i] !== actual[i]) { + result.push(i); + indexString = resultToString(result); + throw this.getError('areCollectionsIdentical failed when element a' + + indexString + ' (' + this.printVariable(expected[i]) + ') is different than element b' + + indexString + ' (' + this.printVariable(actual[i]) + ')', + message); + } + } + + return; + } + + compareArray(expected, actual, []); + } + + protected areCollectionsNotIdentical(expected: any[], actual: any[], message = ''): void { + try { + this.areCollectionsIdentical(expected, actual); + } catch (ex) { + return; + } + + throw this.getError('areCollectionsNotIdentical failed when both collections are identical', message); + } + + protected isTrue(actual: boolean, message = '') { + if (!actual) { + throw this.getError('isTrue failed when given ' + this.printVariable(actual), message); + } + } + + protected isFalse(actual: boolean, message = '') { + if (actual) { + throw this.getError('isFalse failed when given ' + this.printVariable(actual), message); + } + } + + protected isTruthy(actual: any, message = '') { + if (!actual) { + throw this.getError('isTrue failed when given ' + this.printVariable(actual), message); + } + } + + protected isFalsey(actual: any, message = '') { + if (actual) { + throw this.getError('isFalse failed when given ' + this.printVariable(actual), message); + } + } + + protected throws(params: IThrowsParameters): void; + protected throws(actual: () => void, message?: string): void; + protected throws(a: any, message = '', errorString = '') { + var actual: () => void; + + if (a.fn) { + actual = a.fn; + message = a.message; + errorString = a.exceptionString; + } + + var isThrown = false; + try { + actual(); + } catch (ex) { + if (!errorString || ex.message === errorString) { + isThrown = true; + } + + if (errorString && ex.message !== errorString) { + throw this.getError('different error string than supplied'); + } + + } + if (!isThrown) { + throw this.getError('did not throw an error', message || ''); + } + } + + protected executesWithin(actual: () => void, timeLimit: number, message: string = null): void { + function getTime() { + return window.performance.now(); + } + + function timeToString(value: number) { + return Math.round(value * 100) / 100; + } + + var startOfExecution = getTime(); + + try { + actual(); + } catch (ex) { + throw this.getError('isExecuteTimeLessThanLimit fails when given code throws an exception: "' + ex + '"', message); + } + + var executingTime = getTime() - startOfExecution; + if (executingTime > timeLimit) { + throw this.getError('isExecuteTimeLessThanLimit fails when execution time of given code (' + timeToString(executingTime) + ' ms) ' + + 'exceed the given limit(' + timeToString(timeLimit) + ' ms)', + message); + } + } + + protected fail(message = '') { + throw this.getError('fail', message); + } + + private getError(resultMessage: string, message: string = '') { + if (message) { + return new Error(resultMessage + '. ' + message); + } + + return new Error(resultMessage); + } + + private static getNameOfClass(inputClass: {}) { + // see: https://www.stevefenton.co.uk/Content/Blog/Date/201304/Blog/Obtaining-A-Class-Name-At-Runtime-In-TypeScript/ + var funcNameRegex = /function (.{1,})\(/; + var results = (funcNameRegex).exec(( inputClass).constructor.toString()); + return (results && results.length > 1) ? results[1] : ''; + } + + private printVariable(variable: any) { + if (variable === null) { + return '"null"'; + } + + if (typeof variable === 'object') { + return '{object: ' + TestContext.getNameOfClass(variable) + '}'; + } + + return '{' + (typeof variable) + '} "' + variable + '"'; + } + } + + export class TestClass extends TestContext { + protected parameterizeUnitTest(method: Function, parametersArray: any[][]) { + (method).parameters = parametersArray; + } + } + + export class FakeFactory { + static getFake(obj: any, ...implementations: [string, any][]): T { + var fakeType: any = function () { }; + this.populateFakeType(fakeType, obj); + var fake: any = new fakeType(); + + for (var member in fake) { + if (typeof fake[member] === 'function') { + fake[member] = function () { console.log('Default fake called.'); }; + } + } + + var memberNameIndex = 0; + var memberValueIndex = 1; + + for (var i = 0; i < implementations.length; i++) { + var impl = implementations[i]; + fake[impl[memberNameIndex]] = impl[memberValueIndex]; + } + + return fake; + } + + private static populateFakeType(fake: any, toCopy: any) { + for (var property in toCopy) { + if (toCopy.hasOwnProperty(property)) { + fake[property] = toCopy[property]; + } + } + + var __: any = function () { + this.constructor = fake; + } + + __.prototype = toCopy.prototype; + + fake.prototype = new __(); + } + } + + class TestDefintion { + constructor(public testClass: TestClass, public name: string) { + } + } + + export class TestDescription { + constructor(public testName: string, public funcName: string, public parameterSetNumber: number, public message: string) { + } + } + + export class TestResult { + public passes: TestDescription[] = []; + public errors: TestDescription[] = []; + } +}export = tsUnit; diff --git a/tsUnit.Node.Examples/Scripts/typings/node/node.d.ts b/tsUnit.Node.Examples/Scripts/typings/node/node.d.ts new file mode 100644 index 0000000..337d0a0 --- /dev/null +++ b/tsUnit.Node.Examples/Scripts/typings/node/node.d.ts @@ -0,0 +1,1260 @@ +// Type definitions for Node.js v0.10.1 +// Project: http://nodejs.org/ +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/************************************************ +* * +* Node.js v0.10.1 API * +* * +************************************************/ + +/************************************************ +* * +* GLOBAL * +* * +************************************************/ +declare var process: NodeProcess; +declare var global: any; + +declare var __filename: string; +declare var __dirname: string; + +declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeTimer; +declare function clearTimeout(timeoutId: NodeTimer): void; +declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeTimer; +declare function clearInterval(intervalId: NodeTimer): void; +declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; +declare function clearImmediate(immediateId: any): void; + +declare var require: { + (id: string): any; + resolve(id: string): string; + cache: any; + extensions: any; + main: any; +} + +declare var module: { + exports: any; + require(id: string): any; + id: string; + filename: string; + loaded: boolean; + parent: any; + children: any[]; +} + +// Same as module.exports +declare var exports: any; +declare var SlowBuffer: { + new (str: string, encoding?: string): NodeBuffer; + new (size: number): NodeBuffer; + new (array: any[]): NodeBuffer; + prototype: NodeBuffer; + isBuffer(obj: any): boolean; + byteLength(string: string, encoding?: string): number; + concat(list: NodeBuffer[], totalLength?: number): NodeBuffer; +}; +declare var Buffer: { + new (str: string, encoding?: string): NodeBuffer; + new (size: number): NodeBuffer; + new (array: any[]): NodeBuffer; + prototype: NodeBuffer; + isBuffer(obj: any): boolean; + byteLength(string: string, encoding?: string): number; + concat(list: NodeBuffer[], totalLength?: number): NodeBuffer; +} + +/************************************************ +* * +* INTERFACES * +* * +************************************************/ + +interface ErrnoException extends Error { + errno?: any; + code?: string; + path?: string; + syscall?: string; +} + +interface NodeEventEmitter { + addListener(event: string, listener: Function): NodeEventEmitter; + on(event: string, listener: Function): NodeEventEmitter; + once(event: string, listener: Function): NodeEventEmitter; + removeListener(event: string, listener: Function): NodeEventEmitter; + removeAllListeners(event?: string): NodeEventEmitter; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; +} + +interface ReadableStream extends NodeEventEmitter { + readable: boolean; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: NodeBuffer): void; + wrap(oldStream: ReadableStream): ReadableStream; +} + +interface WritableStream extends NodeEventEmitter { + writable: boolean; + write(buffer: NodeBuffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: NodeBuffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; +} + +interface ReadWriteStream extends ReadableStream, WritableStream { } + +interface NodeProcess extends NodeEventEmitter { + stdout: WritableStream; + stderr: WritableStream; + stdin: ReadableStream; + argv: string[]; + execPath: string; + abort(): void; + chdir(directory: string): void; + cwd(): string; + env: any; + exit(code?: number): void; + getgid(): number; + setgid(id: number): void; + setgid(id: string): void; + getuid(): number; + setuid(id: number): void; + setuid(id: string): void; + version: string; + versions: { http_parser: string; node: string; v8: string; ares: string; uv: string; zlib: string; openssl: string; }; + config: { + target_defaults: { + cflags: any[]; + default_configuration: string; + defines: string[]; + include_dirs: string[]; + libraries: string[]; + }; + variables: { + clang: number; + host_arch: string; + node_install_npm: boolean; + node_install_waf: boolean; + node_prefix: string; + node_shared_openssl: boolean; + node_shared_v8: boolean; + node_shared_zlib: boolean; + node_use_dtrace: boolean; + node_use_etw: boolean; + node_use_openssl: boolean; + target_arch: string; + v8_no_strict_aliasing: number; + v8_use_snapshot: boolean; + visibility: string; + }; + }; + kill(pid: number, signal?: string): void; + pid: number; + title: string; + arch: string; + platform: string; + memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; }; + nextTick(callback: Function): void; + umask(mask?: number): number; + uptime(): number; + hrtime(time?: number[]): number[]; + + // Worker + send? (message: any, sendHandle?: any): void; +} + +// Buffer class +interface NodeBuffer { + [index: number]: number; + write(string: string, offset?: number, length?: number, encoding?: string): number; + toString(encoding?: string, start?: number, end?: number): string; + length: number; + copy(targetBuffer: NodeBuffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + slice(start?: number, end?: number): NodeBuffer; + readUInt8(offset: number, noAsset?: boolean): number; + readUInt16LE(offset: number, noAssert?: boolean): number; + readUInt16BE(offset: number, noAssert?: boolean): number; + readUInt32LE(offset: number, noAssert?: boolean): number; + readUInt32BE(offset: number, noAssert?: boolean): number; + readInt8(offset: number, noAssert?: boolean): number; + readInt16LE(offset: number, noAssert?: boolean): number; + readInt16BE(offset: number, noAssert?: boolean): number; + readInt32LE(offset: number, noAssert?: boolean): number; + readInt32BE(offset: number, noAssert?: boolean): number; + readFloatLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readDoubleBE(offset: number, noAssert?: boolean): number; + writeUInt8(value: number, offset: number, noAssert?: boolean): void; + writeUInt16LE(value: number, offset: number, noAssert?: boolean): void; + writeUInt16BE(value: number, offset: number, noAssert?: boolean): void; + writeUInt32LE(value: number, offset: number, noAssert?: boolean): void; + writeUInt32BE(value: number, offset: number, noAssert?: boolean): void; + writeInt8(value: number, offset: number, noAssert?: boolean): void; + writeInt16LE(value: number, offset: number, noAssert?: boolean): void; + writeInt16BE(value: number, offset: number, noAssert?: boolean): void; + writeInt32LE(value: number, offset: number, noAssert?: boolean): void; + writeInt32BE(value: number, offset: number, noAssert?: boolean): void; + writeFloatLE(value: number, offset: number, noAssert?: boolean): void; + writeFloatBE(value: number, offset: number, noAssert?: boolean): void; + writeDoubleLE(value: number, offset: number, noAssert?: boolean): void; + writeDoubleBE(value: number, offset: number, noAssert?: boolean): void; + fill(value: any, offset?: number, end?: number): void; +} + +interface NodeTimer { + ref(): void; + unref(): void; +} + +/************************************************ +* * +* MODULES * +* * +************************************************/ +declare module "querystring" { + export function stringify(obj: any, sep?: string, eq?: string): string; + export function parse(str: string, sep?: string, eq?: string, options?: { maxKeys?: number; }): any; + export function escape(): any; + export function unescape(): any; +} + +declare module "events" { + export class EventEmitter implements NodeEventEmitter { + static listenerCount(emitter: EventEmitter, event: string): number; + + addListener(event: string, listener: Function): EventEmitter; + on(event: string, listener: Function): EventEmitter; + once(event: string, listener: Function): EventEmitter; + removeListener(event: string, listener: Function): EventEmitter; + removeAllListeners(event?: string): EventEmitter; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + } +} + +declare module "http" { + import events = require("events"); + import net = require("net"); + import stream = require("stream"); + + export interface Server extends NodeEventEmitter { + listen(port: number, hostname?: string, backlog?: number, callback?: Function): void; + listen(path: string, callback?: Function): void; + listen(handle: any, listeningListener?: Function): void; + close(cb?: any): void; + maxHeadersCount: number; + } + export interface ServerRequest extends NodeEventEmitter, ReadableStream { + method: string; + url: string; + headers: any; + trailers: string; + httpVersion: string; + setEncoding(encoding?: string): void; + pause(): void; + resume(): void; + connection: net.NodeSocket; + } + export interface ServerResponse extends NodeEventEmitter, WritableStream { + // Extended base methods + write(buffer: NodeBuffer): boolean; + write(buffer: NodeBuffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + write(str: string, encoding?: string, fd?: string): boolean; + + writeContinue(): void; + writeHead(statusCode: number, reasonPhrase?: string, headers?: any): void; + writeHead(statusCode: number, headers?: any): void; + statusCode: number; + setHeader(name: string, value: string): void; + sendDate: boolean; + getHeader(name: string): string; + removeHeader(name: string): void; + write(chunk: any, encoding?: string): any; + addTrailers(headers: any): void; + + // Extended base methods + end(): void; + end(buffer: NodeBuffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + end(data?: any, encoding?: string): void; + } + export interface ClientRequest extends NodeEventEmitter, WritableStream { + // Extended base methods + write(buffer: NodeBuffer): boolean; + write(buffer: NodeBuffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + write(str: string, encoding?: string, fd?: string): boolean; + + write(chunk: any, encoding?: string): void; + abort(): void; + setTimeout(timeout: number, callback?: Function): void; + setNoDelay(noDelay?: Function): void; + setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; + + // Extended base methods + end(): void; + end(buffer: NodeBuffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + end(data?: any, encoding?: string): void; + } + export interface ClientResponse extends NodeEventEmitter, ReadableStream { + statusCode: number; + httpVersion: string; + headers: any; + trailers: any; + setEncoding(encoding?: string): void; + pause(): void; + resume(): void; + } + export interface Agent { maxSockets: number; sockets: any; requests: any; } + + export var STATUS_CODES: any; + export function createServer(requestListener?: (request: ServerRequest, response: ServerResponse) => void): Server; + export function createClient(port?: number, host?: string): any; + export function request(options: any, callback?: Function): ClientRequest; + export function get(options: any, callback?: Function): ClientRequest; + export var globalAgent: Agent; +} + +declare module "cluster" { + import child = require("child_process"); + import events = require("events"); + + export interface ClusterSettings { + exec?: string; + args?: string[]; + silent?: boolean; + } + + export class Worker extends events.EventEmitter { + id: string; + process: child.ChildProcess; + suicide: boolean; + send(message: any, sendHandle?: any): void; + kill(signal?: string): void; + destroy(signal?: string): void; + disconnect(): void; + } + + export var settings: ClusterSettings; + export var isMaster: boolean; + export var isWorker: boolean; + export function setupMaster(settings?: ClusterSettings): void; + export function fork(env?: any): Worker; + export function disconnect(callback?: Function): void; + export var worker: Worker; + export var workers: Worker[]; + + // Event emitter + export function addListener(event: string, listener: Function): void; + export function on(event: string, listener: Function): any; + export function once(event: string, listener: Function): void; + export function removeListener(event: string, listener: Function): void; + export function removeAllListeners(event?: string): void; + export function setMaxListeners(n: number): void; + export function listeners(event: string): Function[]; + export function emit(event: string, ...args: any[]): boolean; +} + +declare module "zlib" { + import stream = require("stream"); + export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; } + + export interface Gzip extends ReadWriteStream { } + export interface Gunzip extends ReadWriteStream { } + export interface Deflate extends ReadWriteStream { } + export interface Inflate extends ReadWriteStream { } + export interface DeflateRaw extends ReadWriteStream { } + export interface InflateRaw extends ReadWriteStream { } + export interface Unzip extends ReadWriteStream { } + + export function createGzip(options?: ZlibOptions): Gzip; + export function createGunzip(options?: ZlibOptions): Gunzip; + export function createDeflate(options?: ZlibOptions): Deflate; + export function createInflate(options?: ZlibOptions): Inflate; + export function createDeflateRaw(options?: ZlibOptions): DeflateRaw; + export function createInflateRaw(options?: ZlibOptions): InflateRaw; + export function createUnzip(options?: ZlibOptions): Unzip; + + export function deflate(buf: NodeBuffer, callback: (error: Error, result: any) => void): void; + export function deflateRaw(buf: NodeBuffer, callback: (error: Error, result: any) => void): void; + export function gzip(buf: NodeBuffer, callback: (error: Error, result: any) => void): void; + export function gunzip(buf: NodeBuffer, callback: (error: Error, result: any) => void): void; + export function inflate(buf: NodeBuffer, callback: (error: Error, result: any) => void): void; + export function inflateRaw(buf: NodeBuffer, callback: (error: Error, result: any) => void): void; + export function unzip(buf: NodeBuffer, callback: (error: Error, result: any) => void): void; + + // Constants + export var Z_NO_FLUSH: number; + export var Z_PARTIAL_FLUSH: number; + export var Z_SYNC_FLUSH: number; + export var Z_FULL_FLUSH: number; + export var Z_FINISH: number; + export var Z_BLOCK: number; + export var Z_TREES: number; + export var Z_OK: number; + export var Z_STREAM_END: number; + export var Z_NEED_DICT: number; + export var Z_ERRNO: number; + export var Z_STREAM_ERROR: number; + export var Z_DATA_ERROR: number; + export var Z_MEM_ERROR: number; + export var Z_BUF_ERROR: number; + export var Z_VERSION_ERROR: number; + export var Z_NO_COMPRESSION: number; + export var Z_BEST_SPEED: number; + export var Z_BEST_COMPRESSION: number; + export var Z_DEFAULT_COMPRESSION: number; + export var Z_FILTERED: number; + export var Z_HUFFMAN_ONLY: number; + export var Z_RLE: number; + export var Z_FIXED: number; + export var Z_DEFAULT_STRATEGY: number; + export var Z_BINARY: number; + export var Z_TEXT: number; + export var Z_ASCII: number; + export var Z_UNKNOWN: number; + export var Z_DEFLATED: number; + export var Z_NULL: number; +} + +declare module "os" { + export function tmpDir(): string; + export function hostname(): string; + export function type(): string; + export function platform(): string; + export function arch(): string; + export function release(): string; + export function uptime(): number; + export function loadavg(): number[]; + export function totalmem(): number; + export function freemem(): number; + export function cpus(): { model: string; speed: number; times: { user: number; nice: number; sys: number; idle: number; irq: number; }; }[]; + export function networkInterfaces(): any; + export var EOL: string; +} + +declare module "https" { + import tls = require("tls"); + import events = require("events"); + import http = require("http"); + + export interface ServerOptions { + pfx?: any; + key?: any; + passphrase?: string; + cert?: any; + ca?: any; + crl?: any; + ciphers?: string; + honorCipherOrder?: boolean; + requestCert?: boolean; + rejectUnauthorized?: boolean; + NPNProtocols?: any; + SNICallback?: (servername: string) => any; + } + + export interface RequestOptions { + host?: string; + hostname?: string; + port?: number; + path?: string; + method?: string; + headers?: any; + auth?: string; + agent?: any; + pfx?: any; + key?: any; + passphrase?: string; + cert?: any; + ca?: any; + ciphers?: string; + rejectUnauthorized?: boolean; + } + + export interface NodeAgent { + maxSockets: number; + sockets: any; + requests: any; + } + export var Agent: { + new (options?: RequestOptions): NodeAgent; + }; + export interface Server extends tls.Server { } + export function createServer(options: ServerOptions, requestListener?: Function): Server; + export function request(options: RequestOptions, callback?: (res: NodeEventEmitter) => void): http.ClientRequest; + export function get(options: RequestOptions, callback?: (res: NodeEventEmitter) => void): http.ClientRequest; + export var globalAgent: NodeAgent; +} + +declare module "punycode" { + export function decode(string: string): string; + export function encode(string: string): string; + export function toUnicode(domain: string): string; + export function toASCII(domain: string): string; + export var ucs2: ucs2; + interface ucs2 { + decode(string: string): string; + encode(codePoints: number[]): string; + } + export var version: any; +} + +declare module "repl" { + import stream = require("stream"); + import events = require("events"); + + export interface ReplOptions { + prompt?: string; + input?: ReadableStream; + output?: WritableStream; + terminal?: boolean; + eval?: Function; + useColors?: boolean; + useGlobal?: boolean; + ignoreUndefined?: boolean; + writer?: Function; + } + export function start(options: ReplOptions): NodeEventEmitter; +} + +declare module "readline" { + import events = require("events"); + import stream = require("stream"); + + export interface ReadLine extends NodeEventEmitter { + setPrompt(prompt: string, length: number): void; + prompt(preserveCursor?: boolean): void; + question(query: string, callback: Function): void; + pause(): void; + resume(): void; + close(): void; + write(data: any, key?: any): void; + } + export interface ReadLineOptions { + input: ReadableStream; + output: WritableStream; + completer?: Function; + terminal?: boolean; + } + export function createInterface(options: ReadLineOptions): ReadLine; +} + +declare module "vm" { + export interface Context { } + export interface Script { + runInThisContext(): void; + runInNewContext(sandbox?: Context): void; + } + export function runInThisContext(code: string, filename?: string): void; + export function runInNewContext(code: string, sandbox?: Context, filename?: string): void; + export function runInContext(code: string, context: Context, filename?: string): void; + export function createContext(initSandbox?: Context): Context; + export function createScript(code: string, filename?: string): Script; +} + +declare module "child_process" { + import events = require("events"); + import stream = require("stream"); + + export interface ChildProcess extends NodeEventEmitter { + stdin: WritableStream; + stdout: ReadableStream; + stderr: ReadableStream; + pid: number; + kill(signal?: string): void; + send(message: any, sendHandle: any): void; + disconnect(): void; + } + + export function spawn(command: string, args?: string[], options?: { + cwd?: string; + stdio?: any; + custom?: any; + env?: any; + detached?: boolean; + }): ChildProcess; + export function exec(command: string, options: { + cwd?: string; + stdio?: any; + customFds?: any; + env?: any; + encoding?: string; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + }, callback: (error: Error, stdout: NodeBuffer, stderr: NodeBuffer) => void): ChildProcess; + export function exec(command: string, callback: (error: Error, stdout: NodeBuffer, stderr: NodeBuffer) => void): ChildProcess; + export function execFile(file: string, args: string[], options: { + cwd?: string; + stdio?: any; + customFds?: any; + env?: any; + encoding?: string; + timeout?: number; + maxBuffer?: string; + killSignal?: string; + }, callback: (error: Error, stdout: NodeBuffer, stderr: NodeBuffer) => void): ChildProcess; + export function fork(modulePath: string, args?: string[], options?: { + cwd?: string; + env?: any; + encoding?: string; + }): ChildProcess; +} + +declare module "url" { + export interface Url { + href: string; + protocol: string; + auth: string; + hostname: string; + port: string; + host: string; + pathname: string; + search: string; + query: string; + slashes: boolean; + } + + export interface UrlOptions { + protocol?: string; + auth?: string; + hostname?: string; + port?: string; + host?: string; + pathname?: string; + search?: string; + query?: any; + } + + export function parse(urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean): Url; + export function format(url: UrlOptions): string; + export function resolve(from: string, to: string): string; +} + +declare module "dns" { + export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) => void): string; + export function lookup(domain: string, callback: (err: Error, address: string, family: number) => void): string; + export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) => void): string[]; + export function resolve(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; + export function resolve4(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; + export function resolve6(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; + export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; + export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; + export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; + export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; + export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; + export function reverse(ip: string, callback: (err: Error, domains: string[]) => void): string[]; +} + +declare module "net" { + import stream = require("stream"); + + export interface NodeSocket extends ReadWriteStream { + // Extended base methods + write(buffer: NodeBuffer): boolean; + write(buffer: NodeBuffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + write(str: string, encoding?: string, fd?: string): boolean; + + connect(port: number, host?: string, connectionListener?: Function): void; + connect(path: string, connectionListener?: Function): void; + bufferSize: number; + setEncoding(encoding?: string): void; + write(data: any, encoding?: string, callback?: Function): void; + destroy(): void; + pause(): void; + resume(): void; + setTimeout(timeout: number, callback?: Function): void; + setNoDelay(noDelay?: boolean): void; + setKeepAlive(enable?: boolean, initialDelay?: number): void; + address(): { port: number; family: string; address: string; }; + remoteAddress: string; + remotePort: number; + bytesRead: number; + bytesWritten: number; + + // Extended base methods + end(): void; + end(buffer: NodeBuffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + end(data?: any, encoding?: string): void; + } + + export var Socket: { + new (options?: { fd?: string; type?: string; allowHalfOpen?: boolean; }): NodeSocket; + }; + + export interface Server extends NodeSocket { + listen(port: number, host?: string, backlog?: number, listeningListener?: Function): void; + listen(path: string, listeningListener?: Function): void; + listen(handle: any, listeningListener?: Function): void; + close(callback?: Function): void; + address(): { port: number; family: string; address: string; }; + maxConnections: number; + connections: number; + } + export function createServer(connectionListener?: (socket: NodeSocket) => void): Server; + export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: NodeSocket) => void): Server; + export function connect(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): NodeSocket; + export function connect(port: number, host?: string, connectionListener?: Function): NodeSocket; + export function connect(path: string, connectionListener?: Function): NodeSocket; + export function createConnection(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): NodeSocket; + export function createConnection(port: number, host?: string, connectionListener?: Function): NodeSocket; + export function createConnection(path: string, connectionListener?: Function): NodeSocket; + export function isIP(input: string): number; + export function isIPv4(input: string): boolean; + export function isIPv6(input: string): boolean; +} + +declare module "dgram" { + import events = require("events"); + + export function createSocket(type: string, callback?: Function): Socket; + + interface Socket extends NodeEventEmitter { + send(buf: NodeBuffer, offset: number, length: number, port: number, address: string, callback?: Function): void; + bind(port: number, address?: string): void; + close(): void; + address: { address: string; family: string; port: number; }; + setBroadcast(flag: boolean): void; + setMulticastTTL(ttl: number): void; + setMulticastLoopback(flag: boolean): void; + addMembership(multicastAddress: string, multicastInterface?: string): void; + dropMembership(multicastAddress: string, multicastInterface?: string): void; + } +} + +declare module "fs" { + import stream = require("stream"); + + interface Stats { + isFile(): boolean; + isDirectory(): boolean; + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isSymbolicLink(): boolean; + isFIFO(): boolean; + isSocket(): boolean; + dev: number; + ino: number; + mode: number; + nlink: number; + uid: number; + gid: number; + rdev: number; + size: number; + blksize: number; + blocks: number; + atime: Date; + mtime: Date; + ctime: Date; + } + + interface FSWatcher extends NodeEventEmitter { + close(): void; + } + + export interface ReadStream extends ReadableStream { } + export interface WriteStream extends WritableStream { } + + export function rename(oldPath: string, newPath: string, callback?: (err?: ErrnoException) => void): void; + export function renameSync(oldPath: string, newPath: string): void; + export function truncate(path: string, callback?: (err?: ErrnoException) => void): void; + export function truncate(path: string, len: number, callback?: (err?: ErrnoException) => void): void; + export function truncateSync(path: string, len?: number): void; + export function ftruncate(fd: number, callback?: (err?: ErrnoException) => void): void; + export function ftruncate(fd: number, len: number, callback?: (err?: ErrnoException) => void): void; + export function ftruncateSync(fd: number, len?: number): void; + export function chown(path: string, uid: number, gid: number, callback?: (err?: ErrnoException) => void): void; + export function chownSync(path: string, uid: number, gid: number): void; + export function fchown(fd: number, uid: number, gid: number, callback?: (err?: ErrnoException) => void): void; + export function fchownSync(fd: number, uid: number, gid: number): void; + export function lchown(path: string, uid: number, gid: number, callback?: (err?: ErrnoException) => void): void; + export function lchownSync(path: string, uid: number, gid: number): void; + export function chmod(path: string, mode: number, callback?: (err?: ErrnoException) => void): void; + export function chmod(path: string, mode: string, callback?: (err?: ErrnoException) => void): void; + export function chmodSync(path: string, mode: number): void; + export function chmodSync(path: string, mode: string): void; + export function fchmod(fd: number, mode: number, callback?: (err?: ErrnoException) => void): void; + export function fchmod(fd: number, mode: string, callback?: (err?: ErrnoException) => void): void; + export function fchmodSync(fd: number, mode: number): void; + export function fchmodSync(fd: number, mode: string): void; + export function lchmod(path: string, mode: number, callback?: (err?: ErrnoException) => void): void; + export function lchmod(path: string, mode: string, callback?: (err?: ErrnoException) => void): void; + export function lchmodSync(path: string, mode: number): void; + export function lchmodSync(path: string, mode: string): void; + export function stat(path: string, callback?: (err: ErrnoException, stats: Stats) => any): void; + export function lstat(path: string, callback?: (err: ErrnoException, stats: Stats) => any): void; + export function fstat(fd: number, callback?: (err: ErrnoException, stats: Stats) => any): void; + export function statSync(path: string): Stats; + export function lstatSync(path: string): Stats; + export function fstatSync(fd: number): Stats; + export function link(srcpath: string, dstpath: string, callback?: (err?: ErrnoException) => void): void; + export function linkSync(srcpath: string, dstpath: string): void; + export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: ErrnoException) => void): void; + export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; + export function readlink(path: string, callback?: (err: ErrnoException, linkString: string) => any): void; + export function readlinkSync(path: string): string; + export function realpath(path: string, callback?: (err: ErrnoException, resolvedPath: string) => any): void; + export function realpath(path: string, cache: { [path: string]: string }, callback: (err: ErrnoException, resolvedPath: string) => any): void; + export function realpathSync(path: string, cache?: { [path: string]: string }): void; + export function unlink(path: string, callback?: (err?: ErrnoException) => void): void; + export function unlinkSync(path: string): void; + export function rmdir(path: string, callback?: (err?: ErrnoException) => void): void; + export function rmdirSync(path: string): void; + export function mkdir(path: string, callback?: (err?: ErrnoException) => void): void; + export function mkdir(path: string, mode: number, callback?: (err?: ErrnoException) => void): void; + export function mkdir(path: string, mode: string, callback?: (err?: ErrnoException) => void): void; + export function mkdirSync(path: string, mode?: number): void; + export function mkdirSync(path: string, mode?: string): void; + export function readdir(path: string, callback?: (err: ErrnoException, files: string[]) => void): void; + export function readdirSync(path: string): string[]; + export function close(fd: number, callback?: (err?: ErrnoException) => void): void; + export function closeSync(fd: number): void; + export function open(path: string, flags: string, callback?: (err: ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: number, callback?: (err: ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: string, callback?: (err: ErrnoException, fd: number) => any): void; + export function openSync(path: string, flags: string, mode?: number): number; + export function openSync(path: string, flags: string, mode?: string): number; + export function utimes(path: string, atime: number, mtime: number, callback?: (err?: ErrnoException) => void): void; + export function utimesSync(path: string, atime: number, mtime: number): void; + export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: ErrnoException) => void): void; + export function futimesSync(fd: number, atime: number, mtime: number): void; + export function fsync(fd: number, callback?: (err?: ErrnoException) => void): void; + export function fsyncSync(fd: number): void; + export function write(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: ErrnoException, written: number, buffer: NodeBuffer) => void): void; + export function writeSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number; + export function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: ErrnoException, bytesRead: number, buffer: NodeBuffer) => void): void; + export function readSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number; + export function readFile(filename: string, options: { encoding?: string; flag?: string; }, callback: (err: ErrnoException, data: any) => void): void; + export function readFile(filename: string, callback: (err: ErrnoException, data: NodeBuffer) => void): void; + export function readFileSync(filename: string, options?: { flag?: string; }): NodeBuffer; + export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; + export function writeFile(filename: string, data: any, callback?: (err: ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: ErrnoException) => void): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: ErrnoException) => void): void; + export function appendFile(filename: string, data: any, callback?: (err: ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; + export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void; + export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void; + export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher; + export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; + export function exists(path: string, callback?: (exists: boolean) => void): void; + export function existsSync(path: string): boolean; + export function createReadStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: string; + mode?: number; + bufferSize?: number; + }): ReadStream; + export function createReadStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: string; + mode?: string; + bufferSize?: number; + }): ReadStream; + export function createWriteStream(path: string, options?: { + flags?: string; + encoding?: string; + string?: string; + }): WriteStream; +} + +declare module "path" { + export function normalize(p: string): string; + export function join(...paths: any[]): string; + export function resolve(...pathSegments: any[]): string; + export function relative(from: string, to: string): string; + export function dirname(p: string): string; + export function basename(p: string, ext?: string): string; + export function extname(p: string): string; + export var sep: string; +} + +declare module "string_decoder" { + export interface NodeStringDecoder { + write(buffer: NodeBuffer): string; + detectIncompleteChar(buffer: NodeBuffer): number; + } + export var StringDecoder: { + new (encoding: string): NodeStringDecoder; + }; +} + +declare module "tls" { + import crypto = require("crypto"); + import net = require("net"); + import stream = require("stream"); + + var CLIENT_RENEG_LIMIT: number; + var CLIENT_RENEG_WINDOW: number; + + export interface TlsOptions { + pfx?: any; //string or buffer + key?: any; //string or buffer + passphrase?: string; + cert?: any; + ca?: any; //string or buffer + crl?: any; //string or string array + ciphers?: string; + honorCipherOrder?: any; + requestCert?: boolean; + rejectUnauthorized?: boolean; + NPNProtocols?: any; //array or Buffer; + SNICallback?: (servername: string) => any; + } + + export interface ConnectionOptions { + host?: string; + port?: number; + socket?: net.NodeSocket; + pfx?: any; //string | Buffer + key?: any; //string | Buffer + passphrase?: string; + cert?: any; //string | Buffer + ca?: any; //Array of string | Buffer + rejectUnauthorized?: boolean; + NPNProtocols?: any; //Array of string | Buffer + servername?: string; + } + + export interface Server extends net.Server { + // Extended base methods + listen(port: number, host?: string, backlog?: number, listeningListener?: Function): void; + listen(path: string, listeningListener?: Function): void; + listen(handle: any, listeningListener?: Function): void; + + listen(port: number, host?: string, callback?: Function): void; + close(): void; + address(): { port: number; family: string; address: string; }; + addContext(hostName: string, credentials: { + key: string; + cert: string; + ca: string; + }): void; + maxConnections: number; + connections: number; + } + + export interface ClearTextStream extends ReadWriteStream { + authorized: boolean; + authorizationError: Error; + getPeerCertificate(): any; + getCipher: { + name: string; + version: string; + }; + address: { + port: number; + family: string; + address: string; + }; + remoteAddress: string; + remotePort: number; + } + + export interface SecurePair { + encrypted: any; + cleartext: any; + } + + export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) => void): Server; + export function connect(options: TlsOptions, secureConnectionListener?: () => void): ClearTextStream; + export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): ClearTextStream; + export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): ClearTextStream; + export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; +} + +declare module "crypto" { + export interface CredentialDetails { + pfx: string; + key: string; + passphrase: string; + cert: string; + ca: any; //string | string array + crl: any; //string | string array + ciphers: string; + } + export interface Credentials { context?: any; } + export function createCredentials(details: CredentialDetails): Credentials; + export function createHash(algorithm: string): Hash; + export function createHmac(algorithm: string, key: string): Hmac; + interface Hash { + update(data: any, input_encoding?: string): Hash; + digest(encoding?: string): string; + } + interface Hmac { + update(data: any): void; + digest(encoding?: string): void; + } + export function createCipher(algorithm: string, password: any): Cipher; + export function createCipheriv(algorithm: string, key: any, iv: any): Cipher; + interface Cipher { + update(data: any, input_encoding?: string, output_encoding?: string): string; + final(output_encoding?: string): string; + setAutoPadding(auto_padding: boolean): void; + createDecipher(algorithm: string, password: any): Decipher; + createDecipheriv(algorithm: string, key: any, iv: any): Decipher; + } + interface Decipher { + update(data: any, input_encoding?: string, output_encoding?: string): void; + final(output_encoding?: string): string; + setAutoPadding(auto_padding: boolean): void; + } + export function createSign(algorithm: string): Signer; + interface Signer { + update(data: any): void; + sign(private_key: string, output_format: string): string; + } + export function createVerify(algorith: string): Verify; + interface Verify { + update(data: any): void; + verify(object: string, signature: string, signature_format?: string): boolean; + } + export function createDiffieHellman(prime_length: number): DiffieHellman; + export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman; + interface DiffieHellman { + generateKeys(encoding?: string): string; + computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string; + getPrime(encoding?: string): string; + getGenerator(encoding: string): string; + getPublicKey(encoding?: string): string; + getPrivateKey(encoding?: string): string; + setPublicKey(public_key: string, encoding?: string): void; + setPrivateKey(public_key: string, encoding?: string): void; + } + export function getDiffieHellman(group_name: string): DiffieHellman; + export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: string) => any): void; + export function randomBytes(size: number): NodeBuffer; + export function randomBytes(size: number, callback: (err: Error, buf: NodeBuffer) => void): void; + export function pseudoRandomBytes(size: number): NodeBuffer; + export function pseudoRandomBytes(size: number, callback: (err: Error, buf: NodeBuffer) => void): void; +} + +declare module "stream" { + import events = require("events"); + + export interface ReadableOptions { + highWaterMark?: number; + encoding?: string; + objectMode?: boolean; + } + + export class Readable extends events.EventEmitter implements ReadableStream { + readable: boolean; + constructor(opts?: ReadableOptions); + _read(size: number): void; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: NodeBuffer): void; + wrap(oldStream: ReadableStream): ReadableStream; + push(chunk: any, encoding?: string): boolean; + } + + export interface WritableOptions { + highWaterMark?: number; + decodeStrings?: boolean; + } + + export class Writable extends events.EventEmitter implements WritableStream { + writable: boolean; + constructor(opts?: WritableOptions); + _write(data: NodeBuffer, encoding: string, callback: Function): void; + _write(data: string, encoding: string, callback: Function): void; + write(buffer: NodeBuffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: NodeBuffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface DuplexOptions extends ReadableOptions, WritableOptions { + allowHalfOpen?: boolean; + } + + // Note: Duplex extends both Readable and Writable. + export class Duplex extends Readable implements ReadWriteStream { + writable: boolean; + constructor(opts?: DuplexOptions); + _write(data: NodeBuffer, encoding: string, callback: Function): void; + _write(data: string, encoding: string, callback: Function): void; + write(buffer: NodeBuffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: NodeBuffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface TransformOptions extends ReadableOptions, WritableOptions { } + + // Note: Transform lacks the _read and _write methods of Readable/Writable. + export class Transform extends events.EventEmitter implements ReadWriteStream { + readable: boolean; + writable: boolean; + constructor(opts?: TransformOptions); + _transform(chunk: NodeBuffer, encoding: string, callback: Function): void; + _transform(chunk: string, encoding: string, callback: Function): void; + _flush(callback: Function): void; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: NodeBuffer): void; + wrap(oldStream: ReadableStream): ReadableStream; + push(chunk: any, encoding?: string): boolean; + write(buffer: NodeBuffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: NodeBuffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export class PassThrough extends Transform { } +} + +declare module "util" { + export interface InspectOptions { + showHidden?: boolean; + depth?: number; + colors?: boolean; + customInspect?: boolean; + } + + export function format(format: any, ...param: any[]): string; + export function debug(string: string): void; + export function error(...param: any[]): void; + export function puts(...param: any[]): void; + export function print(...param: any[]): void; + export function log(string: string): void; + export function inspect(object: any, showHidden?: boolean, depth?: number, color?: boolean): string; + export function inspect(object: any, options: InspectOptions): string; + export function isArray(object: any): boolean; + export function isRegExp(object: any): boolean; + export function isDate(object: any): boolean; + export function isError(object: any): boolean; + export function inherits(constructor: any, superConstructor: any): void; +} + +declare module "assert" { + function internal(value: any, message?: string): void; + module internal { + export class AssertionError implements Error { + name: string; + message: string; + actual: any; + expected: any; + operator: string; + generatedMessage: boolean; + + constructor(options?: { + message?: string; actual?: any; expected?: any; + operator?: string; stackStartFunction?: Function + }); + } + + export function fail(actual?: any, expected?: any, message?: string, operator?: string): void; + export function ok(value: any, message?: string): void; + export function equal(actual: any, expected: any, message?: string): void; + export function notEqual(actual: any, expected: any, message?: string): void; + export function deepEqual(actual: any, expected: any, message?: string): void; + export function notDeepEqual(acutal: any, expected: any, message?: string): void; + export function strictEqual(actual: any, expected: any, message?: string): void; + export function notStrictEqual(actual: any, expected: any, message?: string): void; + export var throws: { + (block: Function, message?: string): void; + (block: Function, error: Function, message?: string): void; + (block: Function, error: RegExp, message?: string): void; + (block: Function, error: (err: any) => boolean, message?: string): void; + } + + export var doesNotThrow: { + (block: Function, message?: string): void; + (block: Function, error: Function, message?: string): void; + (block: Function, error: RegExp, message?: string): void; + (block: Function, error: (err: any) => boolean, message?: string): void; + } + + export function ifError(value: any): void; + } + + export = internal; +} + +declare module "tty" { + import net = require("net"); + + export function isatty(fd: number): boolean; + export interface ReadStream extends net.NodeSocket { + isRaw: boolean; + setRawMode(mode: boolean): void; + } + export interface WriteStream extends net.NodeSocket { + columns: number; + rows: number; + } +} + +declare module "domain" { + import events = require("events"); + + export class Domain extends events.EventEmitter { + run(fn: Function): void; + add(emitter: NodeEventEmitter): void; + remove(emitter: NodeEventEmitter): void; + bind(cb: (err: Error, data: any) => any): any; + intercept(cb: (data: any) => any): any; + dispose(): void; + + addListener(event: string, listener: Function): Domain; + on(event: string, listener: Function): Domain; + once(event: string, listener: Function): Domain; + removeListener(event: string, listener: Function): Domain; + removeAllListeners(event?: string): Domain; + } + + export function create(): Domain; +} diff --git a/tsUnit.Node.Examples/app.js b/tsUnit.Node.Examples/app.js new file mode 100644 index 0000000..4766a89 --- /dev/null +++ b/tsUnit.Node.Examples/app.js @@ -0,0 +1,20 @@ +var tsUnit = require('./Scripts/tsUnit/tsUnit'); +var FizzBuzzTests = require('./Scripts/FizzBuzzTests'); +var readline = require('readline'); +// Instantiate tsUnit and pass in modules that contain tests +var test = new tsUnit.Test(FizzBuzzTests); +// Run the tests +var result = test.run(); +// Show the test results (TAP output) +console.log(test.getTapResults(result)); +// Show the test results (Your own custom version) +console.log('Errors: ' + result.errors.length); +// Pause the console (the human version... not needed for automation) +var rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); +rl.question("Press any key to continue...", function (answer) { + rl.close(); +}); +//# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/tsUnit.Node.Examples/app.js.map b/tsUnit.Node.Examples/app.js.map new file mode 100644 index 0000000..443f21d --- /dev/null +++ b/tsUnit.Node.Examples/app.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":[],"mappings":"AAAA,IAAO,MAAM,WAAW,yBAAyB,CAAC,CAAC;AACnD,IAAO,aAAa,WAAW,yBAAyB,CAAC,CAAC;AAC1D,IAAO,QAAQ,WAAW,UAAU,CAAC,CAAC;AAGtC,AADA,4DAA4D;IACxD,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAG1C,AADA,gBAAgB;IACZ,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAGxB,AADA,qCAAqC;AACrC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAGxC,AADA,kDAAkD;AAClD,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAG/C,AADA,qEAAqE;IACjE,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,MAAM,EAAE,OAAO,CAAC,MAAM;CACzB,CAAC,CAAC;AAEH,EAAE,CAAC,QAAQ,CAAC,8BAA8B,EAAE,UAAU,MAAM;IACxD,EAAE,CAAC,KAAK,EAAE,CAAC;AACf,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/tsUnit.Node.Examples/app.ts b/tsUnit.Node.Examples/app.ts new file mode 100644 index 0000000..e01ea25 --- /dev/null +++ b/tsUnit.Node.Examples/app.ts @@ -0,0 +1,25 @@ +import tsUnit = require('./Scripts/tsUnit/tsUnit'); +import FizzBuzzTests = require('./Scripts/FizzBuzzTests'); +import readline = require('readline'); + +// Instantiate tsUnit and pass in modules that contain tests +var test = new tsUnit.Test(FizzBuzzTests); + +// Run the tests +var result = test.run(); + +// Show the test results (TAP output) +console.log(test.getTapResults(result)); + +// Show the test results (Your own custom version) +console.log('Errors: ' + result.errors.length); + +// Pause the console (the human version... not needed for automation) +var rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +rl.question("Press any key to continue...", function (answer) { + rl.close(); +}); \ No newline at end of file diff --git a/tsUnit.Node.Examples/obj/Release/Scripts/FizzBuzz.ts b/tsUnit.Node.Examples/obj/Release/Scripts/FizzBuzz.ts new file mode 100644 index 0000000..1452d3b --- /dev/null +++ b/tsUnit.Node.Examples/obj/Release/Scripts/FizzBuzz.ts @@ -0,0 +1,17 @@ +class FizzBuzz { + generate(input: number): any { + var output = ''; + + if (input % 3 === 0) { + output += 'Fizz'; + } + + if (input % 5 === 0) { + output += 'Buzz'; + } + + return output === '' ? input : output; + } +} + +export = FizzBuzz; \ No newline at end of file diff --git a/tsUnit.Node.Examples/obj/Release/Scripts/FizzBuzzTests.ts b/tsUnit.Node.Examples/obj/Release/Scripts/FizzBuzzTests.ts new file mode 100644 index 0000000..b1397d1 --- /dev/null +++ b/tsUnit.Node.Examples/obj/Release/Scripts/FizzBuzzTests.ts @@ -0,0 +1,30 @@ +import tsUnit = require('./tsUnit/tsUnit'); +import FizzBuzz = require('./FizzBuzz'); + +var target = new FizzBuzz(); + +export class FizzBuzzTests extends tsUnit.TestClass { + + normalNumbersReturnOriginalNumber() { + this.areIdentical(1, target.generate(1)); + this.areIdentical(2, target.generate(2)); + this.areIdentical(4, target.generate(4)); + } + + numberDivisibleByThreeShouldReturnFizz() { + this.areIdentical("Fizz", target.generate(3)); + this.areIdentical("Fizz", target.generate(6)); + this.areIdentical("Fizz", target.generate(9)); + } + + numbersDivisibleByFiveShouldReturnBuzz() { + this.areIdentical("Buzz", target.generate(5)); + this.areIdentical("Buzz", target.generate(10)); + this.areIdentical("Buzz", target.generate(20)); + } + numbersDivisibleByThreeAndFiveShouldReturnFizzBuzz() { + this.areIdentical("FizzBuzz", target.generate(15)); + this.areIdentical("FizzBuzz", target.generate(30)); + this.areIdentical("FizzBuzz", target.generate(45)); + } +} \ No newline at end of file diff --git a/tsUnit.Node.Examples/obj/Release/Scripts/tsUnit/tsUnit.ts b/tsUnit.Node.Examples/obj/Release/Scripts/tsUnit/tsUnit.ts new file mode 100644 index 0000000..b2a50ae --- /dev/null +++ b/tsUnit.Node.Examples/obj/Release/Scripts/tsUnit/tsUnit.ts @@ -0,0 +1,555 @@ +interface Object { + [index: string]: any; +} + +module tsUnit { + export class Test { + private tests: TestDefintion[] = []; + private testRunLimiter: TestRunLimiter; + private reservedMethodNameContainer: TestClass = new TestClass(); + + constructor(...testModules: any[]) { + this.createTestLimiter(); + + for (var i = 0; i < testModules.length; i++) { + var testModule = testModules[i]; + for (var testClass in testModule) { + this.addTestClass(new testModule[testClass](), testClass); + } + } + } + + addTestClass(testClass: TestClass, name: string = 'Tests'): void { + this.tests.push(new TestDefintion(testClass, name)); + } + + run(testRunLimiter: ITestRunLimiter = null) { + var parameters: any[][] = null; + var testContext = new TestContext(); + var testResult = new TestResult(); + + if (testRunLimiter == null) { + testRunLimiter = this.testRunLimiter; + } + + for (var i = 0; i < this.tests.length; ++i) { + var testClass = this.tests[i].testClass; + var dynamicTestClass = testClass; + var testsGroupName = this.tests[i].name; + + if (testRunLimiter && !testRunLimiter.isTestsGroupActive(testsGroupName)) { + continue; + } + + for (var unitTestName in testClass) { + if (this.isReservedFunctionName(unitTestName) + || (typeof dynamicTestClass[unitTestName] !== 'function') + || (testRunLimiter && !testRunLimiter.isTestActive(unitTestName))) { + continue; + } + + if (typeof dynamicTestClass[unitTestName].parameters !== 'undefined') { + parameters = dynamicTestClass[unitTestName].parameters; + for (var parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) { + if (testRunLimiter && !testRunLimiter.isParametersSetActive(parameterIndex)) { + continue; + } + + this.runSingleTest(testResult, testClass, unitTestName, testsGroupName, parameters, parameterIndex); + } + } else { + this.runSingleTest(testResult, testClass, unitTestName, testsGroupName); + } + } + } + + return testResult; + } + + showResults(target: HTMLElement, result: TestResult) { + var template = '
    ' + + '

    ' + this.getTestResult(result) + '

    ' + + '

    ' + this.getTestSummary(result) + '

    ' + + this.testRunLimiter.getLimitCleaner() + + '
    ' + + '

    Errors

    ' + + '
      ' + this.getTestResultList(result.errors) + '
    ' + + '
    ' + + '
    ' + + '

    Passing Tests

    ' + + '
      ' + this.getTestResultList(result.passes) + '
    ' + + '
    ' + + '
    ' + + this.testRunLimiter.getLimitCleaner(); + + target.innerHTML = template; + } + + getTapResults(result: TestResult) { + var newLine = '\r\n'; + var template = '1..' + (result.passes.length + result.errors.length).toString() + newLine; + + for (var i = 0; i < result.errors.length; i++) { + template += 'not ok ' + result.errors[i].message + ' ' + result.errors[i].testName + newLine; + } + + for (var i = 0; i < result.passes.length; i++) { + template += 'ok ' + result.passes[i].testName + newLine; + } + + return template; + } + + private createTestLimiter() { + try { + if (typeof window !== 'undefined') { + this.testRunLimiter = new TestRunLimiter(); + } + } catch (ex) { } + } + + private isReservedFunctionName(functionName: string): boolean { + for (var prop in this.reservedMethodNameContainer) { + if (prop === functionName) { + return true; + } + } + return false; + } + + private runSingleTest(testResult: TestResult, testClass: TestClass, unitTestName: string, testsGroupName: string, parameters: any[][]= null, parameterSetIndex: number = null) { + if (typeof testClass['setUp'] === 'function') { + testClass['setUp'](); + } + + try { + var dynamicTestClass: any = testClass; + var args = (parameterSetIndex !== null) ? parameters[parameterSetIndex] : null; + dynamicTestClass[unitTestName].apply(testClass, args); + + testResult.passes.push(new TestDescription(testsGroupName, unitTestName, parameterSetIndex, 'OK')); + } catch (err) { + testResult.errors.push(new TestDescription(testsGroupName, unitTestName, parameterSetIndex, err.toString())); + } + + if (typeof testClass['tearDown'] === 'function') { + testClass['tearDown'](); + } + } + + private getTestResult(result: TestResult) { + return result.errors.length === 0 ? 'Test Passed' : 'Test Failed'; + } + + private getTestSummary(result: TestResult) { + return 'Total tests: ' + (result.passes.length + result.errors.length).toString() + '. ' + + 'Passed tests: ' + result.passes.length + '. ' + + 'Failed tests: ' + result.errors.length + '.'; + } + + private getTestResultList(testResults: TestDescription[]) { + var list = ''; + var group = ''; + var isFirst = true; + for (var i = 0; i < testResults.length; ++i) { + var result = testResults[i]; + if (result.testName !== group) { + group = result.testName; + if (isFirst) { + isFirst = false; + } else { + list += '
  • '; + } + list += '
  • ' + this.testRunLimiter.getLimiterForGroup(group) + result.testName + '
      '; + } + + var resultClass = (result.message === 'OK') ? 'success' : 'error'; + var functionLabal = result.funcName + ((result.parameterSetNumber === null) + ? '()' + : '(' + this.testRunLimiter.getLimiterForTest(group, result.funcName, result.parameterSetNumber) + ' paramater set: ' + result.parameterSetNumber + ')'); + + list += '
    • ' + this.testRunLimiter.getLimiterForTest(group, result.funcName) + functionLabal + ': ' + this.encodeHtmlEntities(result.message) + '
    • '; + } + return list + '
    '; + } + + private encodeHtmlEntities(input: string) { + return input.replace(/&/g, '&').replace(//g, '>'); + } + } + + export interface ITestRunLimiter { + isTestsGroupActive(groupName: string): boolean; + isTestActive(testName: string): boolean; + isParametersSetActive(paramatersSetNumber: number): boolean; + } + + export interface IThrowsParameters { + fn: () => void; + message?: string; + errorString?: string; + } + + class TestRunLimiterRunAll implements ITestRunLimiter { + isTestsGroupActive(groupName: string): boolean { + return true; + } + + isTestActive(testName: string): boolean { + return true; + } + + isParametersSetActive(paramatersSetNumber: number): boolean { + return true; + } + } + + class TestRunLimiter implements ITestRunLimiter { + private groupName: string = null; + private testName: string = null; + private parameterSet: number = null; + + constructor() { + this.setRefreshOnLinksWithHash(); + this.translateStringIntoTestsLimit(window.location.hash); + } + + public isTestsGroupActive(groupName: string): boolean { + if (this.groupName === null) { + return true; + } + + return this.groupName === groupName; + } + + public isTestActive(testName: string): boolean { + if (this.testName === null) { + return true; + } + + return this.testName === testName; + } + + public isParametersSetActive(paramatersSet: number): boolean { + if (this.parameterSet === null) { + return true; + } + + return this.parameterSet === paramatersSet; + } + + public getLimiterForTest(groupName: string, testName: string, parameterSet: number = null): string { + if (parameterSet !== null) { + testName += '(' + parameterSet + ')'; + } + + return '  '; + } + + public getLimiterForGroup(groupName: string): string { + return '  '; + } + + public getLimitCleaner(): string { + return '

    Run all tests

    '; + } + + private setRefreshOnLinksWithHash() { + var previousHandler = window.onhashchange; + + window.onhashchange = function (ev: Event) { + window.location.reload(); + + if (typeof previousHandler === 'function') { + previousHandler(ev); + } + }; + } + + private translateStringIntoTestsLimit(value: string) { + var regex = /^#([_a-zA-Z0-9]+)((\/([_a-zA-Z0-9]+))(\(([0-9]+)\))?)?$/ + var result = regex.exec(value); + + if (result === null) { + return; + } + + if (result.length > 1 && !!result[1]) { + this.groupName = result[1]; + } + + if (result.length > 4 && !!result[4]) { + this.testName = result[4]; + } + + if (result.length > 6 && !!result[6]) { + this.parameterSet = parseInt(result[6], 10); + } + } + } + + export class TestContext { + setUp() { + } + + tearDown() { + } + + protected areIdentical(expected: any, actual: any, message = ''): void { + if (expected !== actual) { + throw this.getError('areIdentical failed when given ' + + this.printVariable(expected) + ' and ' + this.printVariable(actual), + message); + } + } + + protected areNotIdentical(expected: any, actual: any, message = ''): void { + if (expected === actual) { + throw this.getError('areNotIdentical failed when given ' + + this.printVariable(expected) + ' and ' + this.printVariable(actual), + message); + } + } + + protected areCollectionsIdentical(expected: any[], actual: any[], message = ''): void { + function resultToString(result: number[]): string { + var msg = ''; + + while (result.length > 0) { + msg = '[' + result.pop() + ']' + msg; + } + + return msg; + } + + var compareArray = (expected: any[], actual: any[], result: number[]): void => { + var indexString = ''; + + if (expected === null) { + if (actual !== null) { + indexString = resultToString(result); + throw this.getError('areCollectionsIdentical failed when array a' + + indexString + ' is null and b' + + indexString + ' is not null', + message); + } + + return; // correct: both are nulls + } else if (actual === null) { + indexString = resultToString(result); + throw this.getError('areCollectionsIdentical failed when array a' + + indexString + ' is not null and b' + + indexString + ' is null', + message); + } + + if (expected.length !== actual.length) { + indexString = resultToString(result); + throw this.getError('areCollectionsIdentical failed when length of array a' + + indexString + ' (length: ' + expected.length + ') is different of length of array b' + + indexString + ' (length: ' + actual.length + ')', + message); + } + + for (var i = 0; i < expected.length; i++) { + if ((expected[i] instanceof Array) && (actual[i] instanceof Array)) { + result.push(i); + compareArray(expected[i], actual[i], result); + result.pop(); + } else if (expected[i] !== actual[i]) { + result.push(i); + indexString = resultToString(result); + throw this.getError('areCollectionsIdentical failed when element a' + + indexString + ' (' + this.printVariable(expected[i]) + ') is different than element b' + + indexString + ' (' + this.printVariable(actual[i]) + ')', + message); + } + } + + return; + } + + compareArray(expected, actual, []); + } + + protected areCollectionsNotIdentical(expected: any[], actual: any[], message = ''): void { + try { + this.areCollectionsIdentical(expected, actual); + } catch (ex) { + return; + } + + throw this.getError('areCollectionsNotIdentical failed when both collections are identical', message); + } + + protected isTrue(actual: boolean, message = '') { + if (!actual) { + throw this.getError('isTrue failed when given ' + this.printVariable(actual), message); + } + } + + protected isFalse(actual: boolean, message = '') { + if (actual) { + throw this.getError('isFalse failed when given ' + this.printVariable(actual), message); + } + } + + protected isTruthy(actual: any, message = '') { + if (!actual) { + throw this.getError('isTrue failed when given ' + this.printVariable(actual), message); + } + } + + protected isFalsey(actual: any, message = '') { + if (actual) { + throw this.getError('isFalse failed when given ' + this.printVariable(actual), message); + } + } + + protected throws(params: IThrowsParameters): void; + protected throws(actual: () => void, message?: string): void; + protected throws(a: any, message = '', errorString = '') { + var actual: () => void; + + if (a.fn) { + actual = a.fn; + message = a.message; + errorString = a.exceptionString; + } + + var isThrown = false; + try { + actual(); + } catch (ex) { + if (!errorString || ex.message === errorString) { + isThrown = true; + } + + if (errorString && ex.message !== errorString) { + throw this.getError('different error string than supplied'); + } + + } + if (!isThrown) { + throw this.getError('did not throw an error', message || ''); + } + } + + protected executesWithin(actual: () => void, timeLimit: number, message: string = null): void { + function getTime() { + return window.performance.now(); + } + + function timeToString(value: number) { + return Math.round(value * 100) / 100; + } + + var startOfExecution = getTime(); + + try { + actual(); + } catch (ex) { + throw this.getError('isExecuteTimeLessThanLimit fails when given code throws an exception: "' + ex + '"', message); + } + + var executingTime = getTime() - startOfExecution; + if (executingTime > timeLimit) { + throw this.getError('isExecuteTimeLessThanLimit fails when execution time of given code (' + timeToString(executingTime) + ' ms) ' + + 'exceed the given limit(' + timeToString(timeLimit) + ' ms)', + message); + } + } + + protected fail(message = '') { + throw this.getError('fail', message); + } + + private getError(resultMessage: string, message: string = '') { + if (message) { + return new Error(resultMessage + '. ' + message); + } + + return new Error(resultMessage); + } + + private static getNameOfClass(inputClass: {}) { + // see: https://www.stevefenton.co.uk/Content/Blog/Date/201304/Blog/Obtaining-A-Class-Name-At-Runtime-In-TypeScript/ + var funcNameRegex = /function (.{1,})\(/; + var results = (funcNameRegex).exec(( inputClass).constructor.toString()); + return (results && results.length > 1) ? results[1] : ''; + } + + private printVariable(variable: any) { + if (variable === null) { + return '"null"'; + } + + if (typeof variable === 'object') { + return '{object: ' + TestContext.getNameOfClass(variable) + '}'; + } + + return '{' + (typeof variable) + '} "' + variable + '"'; + } + } + + export class TestClass extends TestContext { + protected parameterizeUnitTest(method: Function, parametersArray: any[][]) { + (method).parameters = parametersArray; + } + } + + export class FakeFactory { + static getFake(obj: any, ...implementations: [string, any][]): T { + var fakeType: any = function () { }; + this.populateFakeType(fakeType, obj); + var fake: any = new fakeType(); + + for (var member in fake) { + if (typeof fake[member] === 'function') { + fake[member] = function () { console.log('Default fake called.'); }; + } + } + + var memberNameIndex = 0; + var memberValueIndex = 1; + + for (var i = 0; i < implementations.length; i++) { + var impl = implementations[i]; + fake[impl[memberNameIndex]] = impl[memberValueIndex]; + } + + return fake; + } + + private static populateFakeType(fake: any, toCopy: any) { + for (var property in toCopy) { + if (toCopy.hasOwnProperty(property)) { + fake[property] = toCopy[property]; + } + } + + var __: any = function () { + this.constructor = fake; + } + + __.prototype = toCopy.prototype; + + fake.prototype = new __(); + } + } + + class TestDefintion { + constructor(public testClass: TestClass, public name: string) { + } + } + + export class TestDescription { + constructor(public testName: string, public funcName: string, public parameterSetNumber: number, public message: string) { + } + } + + export class TestResult { + public passes: TestDescription[] = []; + public errors: TestDescription[] = []; + } +}export = tsUnit; diff --git a/tsUnit.Node.Examples/obj/Release/app.js b/tsUnit.Node.Examples/obj/Release/app.js new file mode 100644 index 0000000..de0f991 --- /dev/null +++ b/tsUnit.Node.Examples/obj/Release/app.js @@ -0,0 +1,17 @@ +var tsUnit = require('./Scripts/tsUnit/tsUnit'); +var FizzBuzzTests = require('./Scripts/FizzBuzzTests'); +var readline = require('readline'); +// Instantiate tsUnit and pass in modules that contain tests +var test = new tsUnit.Test(FizzBuzzTests); +// Show the test results +var result = test.run(); +console.log(test.showResults(result)); +console.log(result.errors.length); +var rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); +rl.question("Press any key to continue...", function (answer) { + rl.close(); +}); +//# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/tsUnit.Node.Examples/obj/Release/bin/Microsoft.NodejsTools.WebRole.dll b/tsUnit.Node.Examples/obj/Release/bin/Microsoft.NodejsTools.WebRole.dll new file mode 100644 index 0000000000000000000000000000000000000000..f5eb71132a82aa7ea9f82050185727c7be816c0b GIT binary patch literal 24776 zcmeHv3tUuH*Y`eWt_;_i;iiHPDvHWwhKrzriXeg)KtQ}}?68mJl~wrVb+{z)|;it{SK6JhvQpYO{9XHg19qxOaB|)bX}L z@8%y3vnpry0r@ufl%% zp}Mg|LT2g+xz&LX7oJMUmT*G8hpbGEAl6R))63R{ak>3n*Khdr_1K*B+c8PO4Qys7 z$@4FsZoRA5&JMpv)E;>G<*a2pW_5_zzu^7U(19JJ2RF9sb!J<1^83ZV$jTeJ7;*47 zJxs&j?sol^MN_JZRu=BK@XEkfSB#E78Z>l5A7$fjt+KeMmhQQ6Z_(us-y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-`(rA&k?9M;{pv$lmvhUt~IE!@Pmj>ACzU8_obS9DLvODhP~vU$#bDm|;5!Pxa?YtDVgLlbrm$Qz9re{W{s91UIfwuN literal 0 HcmV?d00001 diff --git a/tsUnit.Node.Examples/package.json b/tsUnit.Node.Examples/package.json new file mode 100644 index 0000000..0522e57 --- /dev/null +++ b/tsUnit.Node.Examples/package.json @@ -0,0 +1,10 @@ +{ + "name": "tsUnit.Node.Examples", + "version": "0.0.0", + "description": "tsUnit.Node.Examples", + "main": "app.js", + "author": { + "name": "HP", + "email": "" + } +} diff --git a/tsUnit.Node.Examples/tsUnit.Node.Examples.njsproj b/tsUnit.Node.Examples/tsUnit.Node.Examples.njsproj new file mode 100644 index 0000000..bf43f2c --- /dev/null +++ b/tsUnit.Node.Examples/tsUnit.Node.Examples.njsproj @@ -0,0 +1,88 @@ + + + + 11.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + tsUnit.Node.Examples + tsUnit.Node.Examples + + + + Debug + 2.0 + 20c55c8a-bdd2-43d8-8b18-4d17f468706f + . + app.js + False + + + . + . + v4.0 + {3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD} + ProjectFiles + true + CommonJS + true + false + + + true + + + true + + + + + + + + + + + + + + + + + + + + + False + True + 0 + / + http://localhost:48022/ + False + True + http://localhost:1337 + False + + + + + + + CurrentPage + True + False + False + False + + + + + + + + + False + False + + + + + \ No newline at end of file diff --git a/tsUnit.Packager/Package.nuspec b/tsUnit.Packager/Package.nuspec index 346d767..7398bfb 100644 --- a/tsUnit.Packager/Package.nuspec +++ b/tsUnit.Packager/Package.nuspec @@ -2,7 +2,7 @@ tsUnit - 1.6.0 + 1.7.0 tsUnit Steve Fenton Steve Fenton diff --git a/tsUnit.Packager/content/Scripts/tsUnit/tsUnit.ts b/tsUnit.Packager/content/Scripts/tsUnit/tsUnit.ts index 5204ea5..e22465f 100644 --- a/tsUnit.Packager/content/Scripts/tsUnit/tsUnit.ts +++ b/tsUnit.Packager/content/Scripts/tsUnit/tsUnit.ts @@ -1,7 +1,3 @@ -interface Object { - [index: string]: any; -} - module tsUnit { export class Test { private tests: TestDefintion[] = []; @@ -37,21 +33,21 @@ module tsUnit { var dynamicTestClass = testClass; var testsGroupName = this.tests[i].name; - if (!testRunLimiter.isTestsGroupActive(testsGroupName)) { + if (testRunLimiter && !testRunLimiter.isTestsGroupActive(testsGroupName)) { continue; } for (var unitTestName in testClass) { if (this.isReservedFunctionName(unitTestName) || (typeof dynamicTestClass[unitTestName] !== 'function') - || !testRunLimiter.isTestActive(unitTestName)) { + || (testRunLimiter && !testRunLimiter.isTestActive(unitTestName))) { continue; } if (typeof dynamicTestClass[unitTestName].parameters !== 'undefined') { parameters = dynamicTestClass[unitTestName].parameters; for (var parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) { - if (!testRunLimiter.isParametersSetActive(parameterIndex)) { + if (testRunLimiter && !testRunLimiter.isParametersSetActive(parameterIndex)) { continue; } diff --git a/tsUnit.sln b/tsUnit.sln index fc3e592..5050be4 100644 --- a/tsUnit.sln +++ b/tsUnit.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30626.0 +VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tsUnit", "tsUnit\tsUnit.csproj", "{ECF9ECAE-AD1C-42AB-A821-600A3882E46A}" EndProject @@ -17,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{1A EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet Packages", "NuGet Packages", "{264E5159-8DD7-49F0-B2F7-9222D3365FCF}" EndProject +Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "tsUnit.Node.Examples", "tsUnit.Node.Examples\tsUnit.Node.Examples.njsproj", "{20C55C8A-BDD2-43D8-8B18-4D17F468706F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -43,6 +45,10 @@ Global {DA6EF2A8-EB7D-475E-9AF5-D215732920C7}.Debug|Any CPU.Build.0 = Debug|Any CPU {DA6EF2A8-EB7D-475E-9AF5-D215732920C7}.Release|Any CPU.ActiveCfg = Release|Any CPU {DA6EF2A8-EB7D-475E-9AF5-D215732920C7}.Release|Any CPU.Build.0 = Release|Any CPU + {20C55C8A-BDD2-43D8-8B18-4D17F468706F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20C55C8A-BDD2-43D8-8B18-4D17F468706F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20C55C8A-BDD2-43D8-8B18-4D17F468706F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20C55C8A-BDD2-43D8-8B18-4D17F468706F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -52,5 +58,6 @@ Global {E31C1A48-7177-49CB-9690-85C6D4EA05A7} = {264E5159-8DD7-49F0-B2F7-9222D3365FCF} {41008459-C342-4DE4-ABD3-1076CF50D3CF} = {1AAB0A16-1431-48E2-9AD7-5E915E9BA57F} {DA6EF2A8-EB7D-475E-9AF5-D215732920C7} = {1AAB0A16-1431-48E2-9AD7-5E915E9BA57F} + {20C55C8A-BDD2-43D8-8B18-4D17F468706F} = {1AAB0A16-1431-48E2-9AD7-5E915E9BA57F} EndGlobalSection EndGlobal diff --git a/tsUnit/Scripts/tsUnit/tsUnit.ts b/tsUnit/Scripts/tsUnit/tsUnit.ts index 5204ea5..e22465f 100644 --- a/tsUnit/Scripts/tsUnit/tsUnit.ts +++ b/tsUnit/Scripts/tsUnit/tsUnit.ts @@ -1,7 +1,3 @@ -interface Object { - [index: string]: any; -} - module tsUnit { export class Test { private tests: TestDefintion[] = []; @@ -37,21 +33,21 @@ module tsUnit { var dynamicTestClass = testClass; var testsGroupName = this.tests[i].name; - if (!testRunLimiter.isTestsGroupActive(testsGroupName)) { + if (testRunLimiter && !testRunLimiter.isTestsGroupActive(testsGroupName)) { continue; } for (var unitTestName in testClass) { if (this.isReservedFunctionName(unitTestName) || (typeof dynamicTestClass[unitTestName] !== 'function') - || !testRunLimiter.isTestActive(unitTestName)) { + || (testRunLimiter && !testRunLimiter.isTestActive(unitTestName))) { continue; } if (typeof dynamicTestClass[unitTestName].parameters !== 'undefined') { parameters = dynamicTestClass[unitTestName].parameters; for (var parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) { - if (!testRunLimiter.isParametersSetActive(parameterIndex)) { + if (testRunLimiter && !testRunLimiter.isParametersSetActive(parameterIndex)) { continue; }