Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

alsatian

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alsatian - npm Package Compare versions

Comparing version 2.2.0-20180126 to 2.2.0-20180127

core/results/get-overall-outcome.d.ts

11

cli/alsatian-cli-options.js

@@ -8,2 +8,3 @@ "use strict";

var unused_1 = require("../core/unused");
var remove_item_by_index_1 = require("../core/utils/remove-item-by-index");
var AlsatianCliOptions = (function () {

@@ -106,6 +107,3 @@ function AlsatianCliOptions(args) {

this._versionRequested = true;
return args.filter(function (value, index) {
unused_1.Unused(value);
return index !== versionRequestedIndex;
});
return remove_item_by_index_1.removeItemByIndex(args, versionRequestedIndex);
}

@@ -118,6 +116,3 @@ return args;

this._helpRequested = true;
return args.filter(function (value, index) {
unused_1.Unused(value);
return index !== helpRequestedIndex;
});
return remove_item_by_index_1.removeItemByIndex(args, helpRequestedIndex);
}

@@ -124,0 +119,0 @@ return args;

@@ -16,2 +16,3 @@ import { Matcher } from "./matcher";

toBeGreaterThan(lowerLimit: number): void;
private _validateValues(limit, functionName, limitType);
}

@@ -28,8 +28,3 @@ "use strict";

NumberMatcher.prototype.toBeLessThan = function (upperLimit) {
if (upperLimit === null || upperLimit === undefined) {
throw new TypeError("toBeLessThan upper limit must not be null or undefined.");
}
if (typeof this.actualValue !== "number") {
throw new TypeError("toBeLessThan can only check numbers.");
}
this._validateValues(upperLimit, "toBeLessThan", "upper limit");
if (this.actualValue < upperLimit !== this.shouldMatch) {

@@ -44,8 +39,3 @@ throw new errors_1.LessThanMatchError(this.actualValue, upperLimit, this.shouldMatch);

NumberMatcher.prototype.toBeGreaterThan = function (lowerLimit) {
if (lowerLimit === null || lowerLimit === undefined) {
throw new TypeError("toBeGreaterThan lower limit must not be null or undefined.");
}
if (typeof this.actualValue !== "number") {
throw new TypeError("toBeGreaterThan can only check numbers.");
}
this._validateValues(lowerLimit, "toBeGreaterThan", "lower limit");
if (this.actualValue > lowerLimit !== this.shouldMatch) {

@@ -55,2 +45,10 @@ throw new errors_1.GreaterThanMatchError(this.actualValue, lowerLimit, this.shouldMatch);

};
NumberMatcher.prototype._validateValues = function (limit, functionName, limitType) {
if (limit === null || limit === undefined) {
throw new TypeError(functionName + " " + limitType + " must not be null or undefined.");
}
if (typeof this.actualValue !== "number") {
throw new TypeError(functionName + " can only check numbers.");
}
};
return NumberMatcher;

@@ -57,0 +55,0 @@ }(matcher_1.Matcher));

import { ITest } from "../_interfaces/test.i";
import { TestOutcome } from "./test-outcome";
export declare class TestCaseResult {
import { IResultWithOutcome } from "./result-with-outcome.i";
export declare class TestCaseResult implements IResultWithOutcome {
private _test;

@@ -5,0 +6,0 @@ private _arguments;

@@ -5,3 +5,4 @@ import { ITestFixture } from "../_interfaces/test-fixture.i";

import { TestResults } from "./test-results";
export declare class TestFixtureResults {
import { IResultWithOutcome } from "./result-with-outcome.i";
export declare class TestFixtureResults implements IResultWithOutcome {
private _testFixture;

@@ -8,0 +9,0 @@ private _testResults;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var test_outcome_1 = require("./test-outcome");
var test_results_1 = require("./test-results");
var get_overall_outcome_1 = require("./get-overall-outcome");
var TestFixtureResults = (function () {

@@ -26,13 +26,3 @@ function TestFixtureResults(_testFixture) {

get: function () {
var outcomes = this._testResults.map(function (testResult) { return testResult.outcome; });
if (outcomes.indexOf(test_outcome_1.TestOutcome.Error) !== -1) {
return test_outcome_1.TestOutcome.Error;
}
if (outcomes.indexOf(test_outcome_1.TestOutcome.Fail) !== -1) {
return test_outcome_1.TestOutcome.Fail;
}
if (outcomes.indexOf(test_outcome_1.TestOutcome.Pass) !== -1) {
return test_outcome_1.TestOutcome.Pass;
}
return test_outcome_1.TestOutcome.Skip;
return get_overall_outcome_1.getOverallOutcome(this._testResults);
},

@@ -39,0 +29,0 @@ enumerable: true,

import { ITest } from "../_interfaces/test.i";
import { TestCaseResult } from "./test-case-result";
import { TestOutcome } from "./test-outcome";
export declare class TestResults {
import { IResultWithOutcome } from "./result-with-outcome.i";
export declare class TestResults implements IResultWithOutcome {
private _test;

@@ -6,0 +7,0 @@ private _testCaseResults;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var test_case_result_1 = require("./test-case-result");
var test_outcome_1 = require("./test-outcome");
var get_overall_outcome_1 = require("./get-overall-outcome");
var TestResults = (function () {

@@ -19,13 +19,3 @@ function TestResults(_test) {

get: function () {
var outcomes = this._testCaseResults.map(function (testCaseResult) { return testCaseResult.outcome; });
if (outcomes.indexOf(test_outcome_1.TestOutcome.Error) !== -1) {
return test_outcome_1.TestOutcome.Error;
}
if (outcomes.indexOf(test_outcome_1.TestOutcome.Fail) !== -1) {
return test_outcome_1.TestOutcome.Fail;
}
if (outcomes.indexOf(test_outcome_1.TestOutcome.Pass) !== -1) {
return test_outcome_1.TestOutcome.Pass;
}
return test_outcome_1.TestOutcome.Skip;
return get_overall_outcome_1.getOverallOutcome(this._testCaseResults);
},

@@ -32,0 +22,0 @@ enumerable: true,

import { ITestFixture } from "../_interfaces/test-fixture.i";
import { TestFixtureResults } from "./test-fixture-results";
import { TestOutcome } from "./test-outcome";
export declare class TestSetResults {
import { IResultWithOutcome } from "./result-with-outcome.i";
export declare class TestSetResults implements IResultWithOutcome {
private _testFixtureResults;

@@ -6,0 +7,0 @@ readonly testFixtureResults: TestFixtureResults[];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var test_fixture_results_1 = require("./test-fixture-results");
var test_outcome_1 = require("./test-outcome");
var get_overall_outcome_1 = require("./get-overall-outcome");
var TestSetResults = (function () {

@@ -18,13 +18,3 @@ function TestSetResults() {

get: function () {
var outcomes = this._testFixtureResults.map(function (testFixtureResult) { return testFixtureResult.outcome; });
if (outcomes.indexOf(test_outcome_1.TestOutcome.Error) !== -1) {
return test_outcome_1.TestOutcome.Error;
}
if (outcomes.indexOf(test_outcome_1.TestOutcome.Fail) !== -1) {
return test_outcome_1.TestOutcome.Fail;
}
if (outcomes.indexOf(test_outcome_1.TestOutcome.Pass) !== -1) {
return test_outcome_1.TestOutcome.Pass;
}
return test_outcome_1.TestOutcome.Skip;
return get_overall_outcome_1.getOverallOutcome(this._testFixtureResults);
},

@@ -31,0 +21,0 @@ enumerable: true,

@@ -15,2 +15,4 @@ import "reflect-metadata";

private _runTests(testSetRunInfo, results);
private _getTestFixtures(testItems);
private _getTestItemResult(testItem, testSetRunInfo, testFixtureResults);
private _setupFixture(fixture);

@@ -17,0 +19,0 @@ private _teardownFixture(fixture);

@@ -93,58 +93,56 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var currentTestFixtureResults, currentTestResults, errorOccurredRunningTest, _loop_1, this_1, _i, _a, testItem, lastTestItem;
return __generator(this, function (_b) {
switch (_b.label) {
var testItems, testFixtures, _loop_1, this_1, _i, testFixtures_1, testFixture;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_loop_1 = function (testItem) {
var testItemIndex, previousTestItem, result, error_1;
testItems = testSetRunInfo.testPlan.testItems;
testFixtures = this._getTestFixtures(testItems);
_loop_1 = function (testFixture) {
var testFixtureItems, testFixtureResults, _loop_2, _i, testFixtureItems_1, testItem;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
testItemIndex = testSetRunInfo.testPlan.testItems.indexOf(testItem);
previousTestItem = testSetRunInfo.testPlan.testItems[testItemIndex - 1];
if (!(!previousTestItem ||
previousTestItem.testFixture !== testItem.testFixture)) return [3 /*break*/, 4];
if (!previousTestItem) return [3 /*break*/, 2];
return [4 /*yield*/, this_1._teardownFixture(previousTestItem.testFixture.fixture)];
testFixtureItems = testItems.filter(function (testItem) { return testItem.testFixture === testFixture; });
return [4 /*yield*/, this_1._setupFixture(testFixture.fixture)];
case 1:
_a.sent();
this_1._outputStream.emitFixture(testFixture);
testFixtureResults = results.addTestFixtureResult(testFixture);
_loop_2 = function (testItem) {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this_1._getTestItemResult(testItem, testSetRunInfo, testFixtureResults)];
case 1:
result = _a.sent();
this_1._onTestCompleteCBs.forEach(function (onTestCompleteCB) {
onTestCompleteCB({
error: result.error,
outcome: result.outcome,
test: testItem.test,
testCase: testItem.testCase,
testFixture: testItem.testFixture,
testId: testSetRunInfo.testPlan.testItems.indexOf(testItem) + 1
});
});
this_1._outputStream.emitResult(testItems.indexOf(testItem) + 1, result);
return [2 /*return*/];
}
});
};
_i = 0, testFixtureItems_1 = testFixtureItems;
_a.label = 2;
case 2: return [4 /*yield*/, this_1._setupFixture(testItem.testFixture.fixture)];
case 2:
if (!(_i < testFixtureItems_1.length)) return [3 /*break*/, 5];
testItem = testFixtureItems_1[_i];
return [5 /*yield**/, _loop_2(testItem)];
case 3:
_a.sent();
this_1._outputStream.emitFixture(testItem.testFixture);
currentTestFixtureResults = results.addTestFixtureResult(testItem.testFixture);
_a.label = 4;
case 4:
// if new test
if (!previousTestItem || previousTestItem.test !== testItem.test) {
currentTestResults = currentTestFixtureResults.addTestResult(testItem.test);
}
_a.label = 5;
case 5:
_a.trys.push([5, 7, , 8]);
return [4 /*yield*/, testItem.run(testSetRunInfo.timeout)];
_i++;
return [3 /*break*/, 2];
case 5: return [4 /*yield*/, this_1._teardownFixture(testFixture.fixture)];
case 6:
_a.sent();
result = currentTestResults.addTestCaseResult(testItem.testCase.caseArguments);
errorOccurredRunningTest = null;
return [3 /*break*/, 8];
case 7:
error_1 = _a.sent();
result = currentTestResults.addTestCaseResult(testItem.testCase.caseArguments, error_1);
errorOccurredRunningTest = error_1;
return [3 /*break*/, 8];
case 8:
// emit onComplete event
this_1._onTestCompleteCBs.forEach(function (onTestCompleteCB) {
onTestCompleteCB({
error: errorOccurredRunningTest,
outcome: result.outcome,
test: testItem.test,
testCase: testItem.testCase,
testFixture: testItem.testFixture,
testId: testSetRunInfo.testPlan.testItems.indexOf(testItem) + 1
});
});
this_1._outputStream.emitResult(testItemIndex + 1, result);
return [2 /*return*/];

@@ -155,11 +153,11 @@ }

this_1 = this;
_i = 0, _a = testSetRunInfo.testPlan.testItems;
_b.label = 1;
_i = 0, testFixtures_1 = testFixtures;
_a.label = 1;
case 1:
if (!(_i < _a.length)) return [3 /*break*/, 4];
testItem = _a[_i];
return [5 /*yield**/, _loop_1(testItem)];
if (!(_i < testFixtures_1.length)) return [3 /*break*/, 4];
testFixture = testFixtures_1[_i];
return [5 /*yield**/, _loop_1(testFixture)];
case 2:
_b.sent();
_b.label = 3;
_a.sent();
_a.label = 3;
case 3:

@@ -169,6 +167,2 @@ _i++;

case 4:
lastTestItem = testSetRunInfo.testPlan.testItems[testSetRunInfo.testPlan.testItems.length - 1];
return [4 /*yield*/, this._teardownFixture(lastTestItem.testFixture.fixture)];
case 5:
_b.sent();
this._outputStream.end();

@@ -180,2 +174,32 @@ return [2 /*return*/];

};
TestRunner.prototype._getTestFixtures = function (testItems) {
return testItems
.map(function (testItem) { return testItem.testFixture; })
.filter(function (fixture, index, array) { return array.indexOf(fixture) === index; });
};
TestRunner.prototype._getTestItemResult = function (testItem, testSetRunInfo, testFixtureResults) {
return __awaiter(this, void 0, void 0, function () {
var error, e_1, testResults;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, testItem.run(testSetRunInfo.timeout)];
case 1:
_a.sent();
return [3 /*break*/, 3];
case 2:
e_1 = _a.sent();
error = e_1;
return [3 /*break*/, 3];
case 3:
testResults = testFixtureResults.testResults.find(function (result) { return result.test === testItem.test; });
if (testResults === undefined) {
testResults = testFixtureResults.addTestResult(testItem.test);
}
return [2 /*return*/, testResults.addTestCaseResult(testItem.testCase.caseArguments, error)];
}
});
});
};
TestRunner.prototype._setupFixture = function (fixture) {

@@ -182,0 +206,0 @@ return __awaiter(this, void 0, void 0, function () {

{
"name": "alsatian",
"version": "2.2.0-20180126",
"version": "2.2.0-20180127",
"description": "TypeScript and JavaScript testing framework for beautiful and readable tests",

@@ -5,0 +5,0 @@ "author": "James Richford <=> (=)",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc