@betterer/betterer
Advanced tools
Comparing version 0.1.4 to 0.2.0
@@ -11,3 +11,3 @@ "use strict"; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var configPath, filters, resultsPath, imported, tests, testsToRun, expectedResults, _a, obsoleteNames, stats, results, ran, nnew, failed, obsolete, better, worse, same, completed, messages, printed, printError, _b; | ||
var configPaths, filters, resultsPath, tests, testsToRun, expectedResults, _a, obsoleteNames, stats, results, ran, nnew, failed, obsolete, better, worse, same, completed, messages, printed, printError, _b; | ||
var _this = this; | ||
@@ -18,7 +18,18 @@ return tslib_1.__generator(this, function (_c) { | ||
logger_1.info('running betterer!'); | ||
configPath = config.configPath, filters = config.filters, resultsPath = config.resultsPath; | ||
return [4 /*yield*/, Promise.resolve().then(function () { return require(configPath); })]; | ||
configPaths = config.configPaths, filters = config.filters, resultsPath = config.resultsPath; | ||
tests = {}; | ||
return [4 /*yield*/, Promise.all(configPaths.map(function (configPath) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var moreTests; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, getTests(configPath)]; | ||
case 1: | ||
moreTests = _a.sent(); | ||
tests = tslib_1.__assign(tslib_1.__assign({}, tests), moreTests); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }))]; | ||
case 1: | ||
imported = _c.sent(); | ||
tests = imported.default ? imported.default : imported; | ||
_c.sent(); | ||
testsToRun = Object.keys(tests).filter(function (testName) { | ||
@@ -122,3 +133,3 @@ if (!filters) { | ||
stats.worse.push(testName); | ||
stats.messages.push("\"" + testName + "\" got worse"); | ||
stats.messages.push("\"" + testName + "\" got worse."); | ||
results[testName] = previous; | ||
@@ -199,2 +210,23 @@ return [2 /*return*/]; | ||
} | ||
function getTests(configPath) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var imported, _a; | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_b.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, Promise.resolve().then(function () { return require(configPath); })]; | ||
case 1: | ||
imported = _b.sent(); | ||
return [2 /*return*/, imported.default ? imported.default : imported]; | ||
case 2: | ||
_a = _b.sent(); | ||
return [3 /*break*/, 3]; | ||
case 3: | ||
logger_1.error("could not read tests from \"" + configPath + "\". \uD83D\uDE14"); | ||
throw new Error(); | ||
} | ||
}); | ||
}); | ||
} | ||
//# sourceMappingURL=betterer.js.map |
@@ -12,3 +12,3 @@ declare type BetterTest<T = unknown> = () => T | Promise<T>; | ||
export declare type BetterConfig = { | ||
configPath: string; | ||
configPaths: Array<string>; | ||
resultsPath?: string; | ||
@@ -15,0 +15,0 @@ filters?: Array<RegExp>; |
{ | ||
"name": "@betterer/betterer", | ||
"description": "Main engine for runing betterer tests", | ||
"version": "0.1.4", | ||
"version": "0.2.0", | ||
"license": "MIT", | ||
@@ -27,6 +27,6 @@ "publishConfig": { | ||
"dependencies": { | ||
"@betterer/logger": "^0.1.4", | ||
"@betterer/logger": "^0.2.0", | ||
"tslib": "^1.10.0" | ||
}, | ||
"gitHead": "c131906cf8ec699fa792db0245bae1121dec0bb8" | ||
"gitHead": "a04aad0c3e1d977edbb3a56431db740d6743a7ae" | ||
} |
Sorry, the diff of this file is not supported yet
26508
24
360
+ Added@betterer/logger@0.2.0(transitive)
- Removed@betterer/logger@0.1.4(transitive)
Updated@betterer/logger@^0.2.0