Comparing version 1.0.0-alpha.5 to 1.0.0-alpha.6
@@ -14,3 +14,16 @@ #! /usr/bin/env node | ||
var testRunner = new alsatian_core_1.TestRunner(); | ||
testRunner.run(testSet); | ||
try { | ||
testRunner.run(testSet).then(function (results) { | ||
if (results.filter(function (test) { return test.result !== "Pass"; }).length > 0) { | ||
process.exit(1); | ||
} | ||
else { | ||
process.exit(0); | ||
} | ||
}); | ||
} | ||
catch (error) { | ||
process.stderr.write(error.message); | ||
process.exit(1); | ||
} | ||
//# sourceMappingURL=alsatian-cli.js.map |
@@ -11,3 +11,5 @@ import { TestSet } from "./_namespace"; | ||
private _testsFailed; | ||
run(testSet: TestSet): void; | ||
private _testResults; | ||
private _resultPromise; | ||
run(testSet: TestSet): any; | ||
private _runTest(testFixture, test, testCaseArguments); | ||
@@ -14,0 +16,0 @@ private _handleError(error, test, testCaseArguments); |
@@ -12,2 +12,13 @@ "use strict"; | ||
this._testsFailed = false; | ||
this._testResults = []; | ||
this._resultPromise = { | ||
resolve: function () { | ||
}, | ||
then: function (callback) { | ||
// console.log("then", callback); | ||
_this._resultPromise.resolve = callback; | ||
}, | ||
catch: function (error) { | ||
} | ||
}; | ||
this._getTestDescription = function (test, testCaseArguments) { | ||
@@ -38,4 +49,3 @@ var testDescription = _this._currentTestId + " - " + test.description; | ||
if (totalTestCount === 0) { | ||
process.stderr.write("no tests to run"); | ||
process.exit(1); | ||
throw new Error("no tests to run."); | ||
} | ||
@@ -47,2 +57,3 @@ else { | ||
} | ||
return this._resultPromise; | ||
}; | ||
@@ -90,2 +101,9 @@ TestRunner.prototype._runTest = function (testFixture, test, testCaseArguments) { | ||
process.stdout.write(" ---\n message: \"" + error.message + "\"\n severity: fail\n data:\n got: " + JSON.stringify(error.actualValue) + "\n expect: " + JSON.stringify(error.expectedValue) + "\n ...\n"); | ||
this._testResults.push({ | ||
result: "Fail", | ||
testDescription: this._getTestDescription(test, testCaseArguments), | ||
message: error.message, | ||
expected: error.expectedValue, | ||
actual: error.actualValue | ||
}); | ||
} | ||
@@ -95,2 +113,7 @@ else { | ||
process.stdout.write("# Unknown Error\n"); | ||
this._testResults.push({ | ||
result: "Error", | ||
testDescription: this._getTestDescription(test, testCaseArguments), | ||
message: error.message | ||
}); | ||
} | ||
@@ -102,2 +125,6 @@ this._runNextTestCase(); | ||
process.stdout.write("ok " + this._getTestDescription(test, testCaseArguments) + "\n"); | ||
this._testResults.push({ | ||
result: "Pass", | ||
testDescription: this._getTestDescription(test, testCaseArguments) | ||
}); | ||
this._runNextTestCase(); | ||
@@ -115,8 +142,10 @@ }; | ||
TestRunner.prototype._exit = function () { | ||
if (this._testsFailed) { | ||
process.exit(1); | ||
/*if (this._testsFailed) { | ||
process.exit(1); | ||
} | ||
else { | ||
process.exit(0); | ||
} | ||
process.exit(0); | ||
}*/ | ||
// console.log(this._resultPromise); | ||
this._resultPromise.resolve(this._testResults); | ||
}; | ||
@@ -123,0 +152,0 @@ TestRunner.prototype._runNextTestFixture = function () { |
{ | ||
"name": "alsatian", | ||
"version": "1.0.0-alpha.5", | ||
"version": "1.0.0-alpha.6", | ||
"description": "TypeScript testing framework with test cases", | ||
@@ -5,0 +5,0 @@ "main": "./core/alsatian-core.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
651690
2167