@saucelabs/sauce-json-reporter
Advanced tools
Comparing version 0.0.3 to 1.0.0
@@ -0,1 +1,4 @@ | ||
declare type HasKeyOf<T> = { | ||
[P in keyof T]?: T[P]; | ||
}; | ||
export declare enum Status { | ||
@@ -46,3 +49,3 @@ Passed = "passed", | ||
withSuite(name: string): Suite; | ||
withTest(name: string, status?: Status, duration?: number, output?: string, startTime?: Date, metadata?: object, attachments?: Attachment[]): Test; | ||
withTest(name: string, options?: HasKeyOf<Test>): Test; | ||
} | ||
@@ -60,6 +63,14 @@ /** | ||
metadata: object; | ||
constructor(name: string, status?: Status, duration?: number, output?: string, startTime?: Date, attachments?: Attachment[], metadata?: object); | ||
code?: TestCode; | ||
constructor(name: string, status?: Status, duration?: number, output?: string, startTime?: Date, attachments?: Attachment[], metadata?: object, code?: TestCode); | ||
attach(attachment: Attachment): void; | ||
} | ||
/** | ||
* TestCode represents the code associated to a test. | ||
*/ | ||
export declare class TestCode { | ||
lines: string[]; | ||
constructor(lines: string[]); | ||
} | ||
/** | ||
* Determines the final status of the parent based on the child's status. | ||
@@ -76,1 +87,2 @@ * | ||
export declare function statusOf(parent: Stateful, child: Stateful): Status; | ||
export {}; |
@@ -22,3 +22,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.statusOf = exports.Test = exports.Suite = exports.TestRun = exports.Status = void 0; | ||
exports.statusOf = exports.TestCode = exports.Test = exports.Suite = exports.TestRun = exports.Status = void 0; | ||
var fs = __importStar(require("fs")); | ||
@@ -120,9 +120,5 @@ var Status; | ||
}; | ||
Suite.prototype.withTest = function (name, status, duration, output, startTime, metadata, attachments) { | ||
if (status === void 0) { status = Status.Skipped; } | ||
if (duration === void 0) { duration = 0; } | ||
if (startTime === void 0) { startTime = new Date(); } | ||
if (metadata === void 0) { metadata = {}; } | ||
if (attachments === void 0) { attachments = new Array(); } | ||
var test = new Test(name, status, duration, output, startTime, attachments, metadata); | ||
Suite.prototype.withTest = function (name, options) { | ||
if (options === void 0) { options = {}; } | ||
var test = new Test(name, options.status, options.duration, options.output, options.startTime, options.attachments, options.metadata, options.code); | ||
this.addTest(test); | ||
@@ -138,3 +134,3 @@ return test; | ||
var Test = /** @class */ (function () { | ||
function Test(name, status, duration, output, startTime, attachments, metadata) { | ||
function Test(name, status, duration, output, startTime, attachments, metadata, code) { | ||
if (status === void 0) { status = Status.Skipped; } | ||
@@ -152,2 +148,3 @@ if (duration === void 0) { duration = 0; } | ||
this.attachments = attachments; | ||
this.code = code; | ||
} | ||
@@ -162,2 +159,12 @@ Test.prototype.attach = function (attachment) { | ||
/** | ||
* TestCode represents the code associated to a test. | ||
*/ | ||
var TestCode = /** @class */ (function () { | ||
function TestCode(lines) { | ||
this.lines = lines; | ||
} | ||
return TestCode; | ||
}()); | ||
exports.TestCode = TestCode; | ||
/** | ||
* Determines the final status of the parent based on the child's status. | ||
@@ -164,0 +171,0 @@ * |
{ | ||
"name": "@saucelabs/sauce-json-reporter", | ||
"version": "0.0.3", | ||
"version": "1.0.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -12,4 +12,10 @@ # sauce-json-reporter-js | ||
const s2 = s1.withSuite('somefile.test.js') | ||
s2.withTest('yay', Status.Passed, 123) | ||
s2.withTest('nay', Status.Failed, 123) | ||
s2.withTest('yay', { | ||
status: Status.Passed, | ||
duration: 123, | ||
}) | ||
s2.withTest('nay', { | ||
status: Status.Failed, | ||
duration: 123, | ||
}) | ||
@@ -16,0 +22,0 @@ r.stringify() // returns a JSON string representing the entire test run |
Sorry, the diff of this file is not supported yet
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
16299
269
1
65