mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 14:38:20 +08:00
Add defenition for allure-js-commons
This commit is contained in:
24
types/allure-js-commons/allure-js-commons-tests.ts
Normal file
24
types/allure-js-commons/allure-js-commons-tests.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import * as Allure from "allure-js-commons";
|
||||
|
||||
const shouldMakeError = new Allure("test"); // $ExpectError
|
||||
const allure = new Allure();
|
||||
|
||||
allure.startSuite("suite");
|
||||
allure.startCase("case");
|
||||
allure.startCase("case", 123456789);
|
||||
|
||||
allure.endCase("passed");
|
||||
allure.endCase("pending");
|
||||
allure.endCase("skipped");
|
||||
allure.endCase("failed");
|
||||
allure.endCase("broken", 1232131232);
|
||||
allure.endCase("error"); // $ExpectError
|
||||
|
||||
allure.startStep("error");
|
||||
allure.endStep("error"); // $ExpectError
|
||||
|
||||
allure.setDescription("description");
|
||||
allure.addAttachment("image", {}, "image/jpeg");
|
||||
allure.pendingCase("pending");
|
||||
|
||||
allure.endSuite();
|
||||
109
types/allure-js-commons/index.d.ts
vendored
Normal file
109
types/allure-js-commons/index.d.ts
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
// Type definitions for allure-js-commons 0.0
|
||||
// Project: https://github.com/allure-framework/allure-js-commons
|
||||
// Definitions by: Denis Artyuhovich <https://github.com/zaqqaz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
declare class Allure {
|
||||
constructor();
|
||||
|
||||
setOptions(options: Allure.Options): void;
|
||||
|
||||
getCurrentSuite(): Allure.Suite;
|
||||
|
||||
getCurrentTest(): Allure.Test;
|
||||
|
||||
startSuite(suiteName: string, timestamp?: number): void;
|
||||
|
||||
endSuite(timestamp?: number): void;
|
||||
|
||||
startCase(testName: string, timestamp?: number): void;
|
||||
|
||||
endCase(status: Allure.Status, err?: {}, timestamp?: number): void;
|
||||
|
||||
startStep(stepName: string, timestamp?: number): void;
|
||||
|
||||
endStep(status: Allure.Status, timestamp?: number): void;
|
||||
|
||||
setDescription(description: string, timestamp?: number): void;
|
||||
|
||||
addAttachment(attachmentName: string, buffer: any, type: string): void;
|
||||
|
||||
pendingCase(testName: string, timestamp?: number): void;
|
||||
}
|
||||
|
||||
export = Allure;
|
||||
export as namespace Allure;
|
||||
declare namespace Allure {
|
||||
interface Options {
|
||||
targetDir: string;
|
||||
}
|
||||
|
||||
type Status = "passed" | "pending" | "skipped" | "failed" | "broken";
|
||||
|
||||
enum TYPE {
|
||||
TEXT = "text",
|
||||
HTML = "html",
|
||||
MARKDOWN = "markdown"
|
||||
}
|
||||
|
||||
class Suite {
|
||||
constructor(name: string, timestamp?: number);
|
||||
|
||||
end(timestamp?: number): void;
|
||||
|
||||
hasTests(): boolean;
|
||||
|
||||
addTest(test: Test): boolean;
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
|
||||
class Test {
|
||||
constructor(name: string, timestamp?: number);
|
||||
|
||||
setDescription(description: string, type: TYPE): void;
|
||||
|
||||
addLabel(name: string, value: string): void;
|
||||
|
||||
addParameter(kind: any, name: string, value: string): void;
|
||||
|
||||
addStep(step: Step): void;
|
||||
|
||||
addAttachment(attachment: Attachment): void;
|
||||
|
||||
end(status: Status, error: Error, timestamp?: number): void;
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
|
||||
class Description {
|
||||
constructor(value: string, type: TYPE);
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
|
||||
class Step {
|
||||
constructor(name: string, timestamp?: number);
|
||||
|
||||
addStep(step: Step): void;
|
||||
|
||||
addAttachment(attachment: Attachment): void;
|
||||
|
||||
end(status: Status, error: Error, timestamp?: number): void;
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
|
||||
class Attachment {
|
||||
constructor(title: string, source: any, size: number, mime: string);
|
||||
|
||||
addStep(step: Step): void;
|
||||
|
||||
addAttachment(attachment: Attachment): void;
|
||||
|
||||
end(status: Status, error: Error, timestamp?: number): void;
|
||||
|
||||
toXML(): string;
|
||||
}
|
||||
}
|
||||
23
types/allure-js-commons/tsconfig.json
Normal file
23
types/allure-js-commons/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"allure-js-commons-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/allure-js-commons/tslint.json
Normal file
1
types/allure-js-commons/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user