protractor-smartrunner
Advanced tools
Comparing version 0.1.1 to 1.0.0
import { SmartRunnerResults } from './smartrunner-results'; | ||
export declare class SmartRunnerReporter { | ||
private results; | ||
private startTime; | ||
constructor(results: SmartRunnerResults); | ||
jasmineStarted(suiteInfo: any): void; | ||
suiteStarted(result: any): void; | ||
specStarted(result: any): void; | ||
specDone(result: any): void; | ||
@@ -8,0 +10,0 @@ suiteDone(result: any): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SmartRunnerReporter = void 0; | ||
class SmartRunnerReporter { | ||
constructor(results) { | ||
this.results = results; | ||
this.startTime = new Date(); | ||
} | ||
jasmineStarted(suiteInfo) { | ||
this.startTime = new Date(); | ||
} | ||
suiteStarted(result) { | ||
} | ||
specStarted(result) { | ||
this.startTime = new Date(); | ||
} | ||
specDone(result) { | ||
const duration = new Date().getTime() - this.startTime.getTime(); | ||
const specName = result.description; | ||
const suiteName = result.fullName.replace(specName, '').trim(); | ||
if (result.status !== 'disabled') { | ||
this.results.set(suiteName, specName, result.status === 'passed' || result.status === 'pending'); | ||
this.results.set(suiteName, specName, result.status === 'passed' || result.status === 'pending', duration); | ||
} | ||
@@ -17,0 +24,0 @@ } |
@@ -0,3 +1,8 @@ | ||
export interface TestResult { | ||
retries: number; | ||
passed: boolean; | ||
duration: number; | ||
} | ||
export interface TestResults { | ||
[testName: string]: boolean; | ||
[testName: string]: TestResult; | ||
} | ||
@@ -16,5 +21,5 @@ export interface SuiteResults { | ||
load(): void; | ||
set(suiteName: string, testName: string, passed: boolean): void; | ||
get(suiteName: string, testName: string): boolean; | ||
set(suiteName: string, testName: string, passed: boolean, duration: number): void; | ||
get(suiteName: string, testName: string): TestResult; | ||
save(): void; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SmartRunnerResults = void 0; | ||
const path_1 = require("path"); | ||
const chalk_1 = require("chalk"); | ||
const fs = require('fs-extra'); | ||
@@ -9,2 +11,6 @@ const filenamify = require('filenamify'); | ||
this.affectedSuites = {}; | ||
if (!(repoHash === null || repoHash === void 0 ? void 0 : repoHash.length)) { | ||
console.log(chalk_1.red('ERROR: repoHash is not defined, terminating...')); | ||
process.exit(1); | ||
} | ||
this.smartRunDir = path_1.resolve(outputDirectory, repoHash); | ||
@@ -16,13 +22,18 @@ fs.ensureDirSync(this.smartRunDir); | ||
.map((jsonFile) => fs.readJsonSync(path_1.resolve(this.smartRunDir, `./${jsonFile}`))) | ||
.reduce((accumulator, currentValue) => (Object.assign({}, accumulator, currentValue)), {}); | ||
.reduce((accumulator, currentValue) => (Object.assign(Object.assign({}, accumulator), currentValue)), {}); | ||
} | ||
set(suiteName, testName, passed) { | ||
set(suiteName, testName, passed, duration) { | ||
var _a, _b, _c; | ||
if (!this.results[suiteName]) { | ||
this.results[suiteName] = {}; | ||
} | ||
this.results[suiteName][testName] = passed; | ||
this.results[suiteName][testName] = { | ||
retries: ((_c = (_b = (_a = this.results) === null || _a === void 0 ? void 0 : _a[suiteName]) === null || _b === void 0 ? void 0 : _b[testName]) === null || _c === void 0 ? void 0 : _c.retries) + 1 || 0, | ||
passed, | ||
duration | ||
}; | ||
this.affectedSuites[suiteName] = true; | ||
} | ||
get(suiteName, testName) { | ||
return this.results[suiteName] && this.results[suiteName][testName] || false; | ||
return this.results[suiteName] && this.results[suiteName][testName] || {}; | ||
} | ||
@@ -36,3 +47,3 @@ save() { | ||
const fileName = path_1.resolve(this.smartRunDir, filenamify(`./${suite}.json`)); | ||
fs.outputJsonSync(fileName, { [suite]: this.results[suite] }); | ||
fs.outputJsonSync(fileName, { [suite]: this.results[suite] }, { spaces: 4 }); | ||
} | ||
@@ -39,0 +50,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SmartRunner = void 0; | ||
const smartrunner_results_1 = require("./smartrunner-results"); | ||
@@ -17,3 +18,3 @@ const smartrunner_reporter_1 = require("./smartrunner-reporter"); | ||
static apply(options) { | ||
return new SmartRunner(Object.assign({}, DEFAULT_OPTIONS, options)); | ||
return new SmartRunner(Object.assign(Object.assign({}, DEFAULT_OPTIONS), options)); | ||
} | ||
@@ -40,3 +41,3 @@ static withOptionalExclusions(filePath) { | ||
const testPassedInPreviousRun = this.results.get(suiteName, testName); | ||
return !testPassedInPreviousRun && oldSpecFilter(spec); | ||
return !testPassedInPreviousRun.passed && oldSpecFilter(spec); | ||
}; | ||
@@ -43,0 +44,0 @@ } |
{ | ||
"name": "protractor-smartrunner", | ||
"version": "0.1.1", | ||
"version": "1.0.0", | ||
"description": "Protractor utility for keeping track of passed/failed tests between runs. Works together with protractor-retry.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
12466
184
0