testcafe-reporter-testit 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,158 @@
1
+ # Test IT TMS adapters for TestCafe
2
+ ![Test IT](https://raw.githubusercontent.com/testit-tms/adapters-js/master/images/banner.png)
3
+
4
+ ## Getting Started
5
+
6
+ ### Installation
7
+ ```
8
+ npm install testcafe-reporter-testit
9
+ ```
10
+
11
+ ## Configuration
12
+
13
+ | Description | File property | Environment variable |
14
+ |------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------|-----------------------------------|
15
+ | Location of the TMS instance | url | TMS_URL |
16
+ | API secret key <br/>[How to getting API secret key?](https://github.com/testit-tms/.github/tree/main/configuration#privatetoken) | privateToken | TMS_PRIVATE_TOKEN |
17
+ | ID of project in TMS instance <br/>[How to getting project ID?](https://github.com/testit-tms/.github/tree/main/configuration#projectid) | projectId | TMS_PROJECT_ID |
18
+ | ID of configuration in TMS instance <br/>[How to getting configuration ID?](https://github.com/testit-tms/.github/tree/main/configuration#configurationid) | configurationId | TMS_CONFIGURATION_ID |
19
+ | ID of the created test run in TMS instance.<br/>It's necessary for **adapterMode** 0 or 1 | testRunId | TMS_TEST_RUN_ID |
20
+ | Parameter for specifying the name of test run in TMS instance (**It's optional**). <br/>If it is not provided, it is created automatically | testRunName | TMS_TEST_RUN_NAME |
21
+ | Adapter mode * | adapterMode | TMS_ADAPTER_MODE |
22
+ | Mode of automatic creation test cases ** (**It's optional**). | automaticCreationTestCases | TMS_AUTOMATIC_CREATION_TEST_CASES |
23
+
24
+ *The adapter supports following modes:
25
+ * 0 - in this mode, the adapter filters tests by external id and sends the results to the test run. **Default value**.
26
+ * 1 - in this mode, the adapter sends all results to the test run without filtering
27
+ * 2 - in this mode, the adapter creates a new test run and sends results to the new test run
28
+
29
+ **The adapter supports following modes:
30
+ * true - in this mode, the adapter will create a test case linked to the created autotest (not to the updated autotest)
31
+ * false - in this mode, the adapter will not create a test case. **Default value**.
32
+
33
+ ### File
34
+
35
+ 1. Adapter configuration file: `tms.config.json`
36
+
37
+ ```json
38
+ {
39
+ "url": "URL",
40
+ "privateToken": "USER_PRIVATE_TOKEN",
41
+ "projectId": "PROJECT_ID",
42
+ "configurationId": "CONFIGURATION_ID",
43
+ "testRunId": "TEST_RUN_ID",
44
+ "adapterMode": 0,
45
+ "automaticCreationTestCases": false
46
+ }
47
+ ```
48
+
49
+ 2. You can set adapter config to environment variables: `.env`.
50
+
51
+ ```dotenv
52
+ TMS_PRIVATE_TOKEN=YourPrivateToken
53
+ TMS_URL=URL
54
+ TMS_PROJECT_ID=YourProjectId;
55
+ TMS_CONFIGURATION_ID=YourConfigurationId;
56
+ TMS_TEST_RUN_ID=TestRunId;
57
+ TMS_TEST_RUN_NAME=TestRunName; # optional
58
+ TMS_ADAPTER_MODE=0; # or 1, or 2
59
+ TMS_CONFIG_FILE=pathToAnotherConfigFile; #optional
60
+ TMS_AUTOMATIC_CREATION_TEST_CASES=false; # or true, optional
61
+ ```
62
+
63
+ ### Parallel run
64
+ To create and complete TestRun you can use the Test IT CLI (use adapterMode 1 for parallel run):
65
+
66
+ ```
67
+ $ export TMS_TOKEN=<YOUR_TOKEN>
68
+ $ testit testrun create
69
+ --url https://tms.testit.software \
70
+ --project-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
71
+ --testrun-name "New test run" \
72
+ --output tmp/output.txt
73
+
74
+ $ export TMS_TEST_RUN_ID=$(cat tmp/output.txt)
75
+
76
+ $ npx testcafe chrome tests/test.spec.ts -r testit
77
+
78
+ $ testit testrun complete
79
+ --url https://tms.testit.software \
80
+ --testrun-id $(cat tmp/output.txt)
81
+ ```
82
+
83
+ ## Usage
84
+
85
+ Methods and properties can be used to specify information about autotest.
86
+
87
+ ### Properties
88
+
89
+ Description of metadata properties:
90
+ - `workItemsIds` - a method that links autotests with manual tests. Receives the array of manual tests' IDs
91
+ - `displayName` - internal autotest name (used in Test IT)
92
+ - `externalId` - unique internal autotest ID (used in Test IT)
93
+ - `title` - autotest name specified in the autotest card. If not specified, the name from the displayName method is used
94
+ - `description` - autotest description specified in the autotest card
95
+ - `labels` - tags listed in the autotest card
96
+ - `links` - links listed in the autotest card
97
+ - `nameSpace` - directory in the TMS system (default - directory's name of test)
98
+ - `className` - subdirectory in the TMS system (default - file's name of test)
99
+
100
+ ### Methods
101
+
102
+ Description of methods:
103
+ - `adapter.addLinks` - links in the autotest result
104
+ - `adapter.addAttachments` - uploading files in the autotest result or step result
105
+ - `adapter.addMessage` - information about autotest in the autotest result
106
+
107
+ ## Examples
108
+
109
+ ### Simple test
110
+
111
+ ```ts
112
+ // annotations.spec.ts
113
+ const adapter = require('testcafe-reporter-testit')();
114
+ import { Selector } from 'testcafe';
115
+ import { Link } from 'testit-js-commons';
116
+ import { join } from "path";
117
+
118
+ fixture('TestCafé Example Fixture - Documentation').page('http://devexpress.github.io/testcafe/example');
119
+
120
+ const links: Link[] = [
121
+ { url: "https://test01.example", title: "Example01", description: "Example01 description", type: "Issue" },
122
+ { url: "https://test02.example", title: "Example02", description: "Example02 description", type: "Issue" },
123
+ ];
124
+
125
+ const paths = [
126
+ join(__dirname, "../attachments/file.txt"),
127
+ join(__dirname, "../attachments/image.jpg")
128
+ ];
129
+
130
+ test.meta({
131
+ externalId: 'externalId',
132
+ displayName: 'displayName',
133
+ description: 'description',
134
+ title: 'title',
135
+ namespace: 'namespace',
136
+ classname: 'classname',
137
+ workItemIds: ['123', '321'],
138
+ labels: ['label1', 'label2'],
139
+ })('test', async t => {
140
+ adapter.addMessage(t, "Message");
141
+ adapter.addAttachments(t, paths);
142
+ adapter.addLinks(t, links);
143
+ });
144
+ ```
145
+
146
+ # Contributing
147
+
148
+ You can help to develop the project. Any contributions are **greatly appreciated**.
149
+
150
+ * If you have suggestions for adding or removing projects, feel free to [open an issue](https://github.com/testit-tms/adapters-js/issues/new) to discuss it, or directly create a pull request after you edit the *README.md* file with necessary changes.
151
+ * Please make sure you check your spelling and grammar.
152
+ * Create individual PR for each suggestion.
153
+ * Please also read through the [Code Of Conduct](https://github.com/testit-tms/adapters-js/blob/master/CODE_OF_CONDUCT.md) before posting your first idea as well.
154
+
155
+ # License
156
+
157
+ Distributed under the Apache-2.0 License. See [LICENSE](https://github.com/testit-tms/adapters-js/blob/master/LICENSE.md) for more information.
158
+
@@ -0,0 +1,19 @@
1
+ import { AutotestPost, AutotestResult } from "testit-js-commons";
2
+ import Metadata from "./metadata";
3
+ import { TestRunInfo } from "./types";
4
+ declare enum Status {
5
+ PASSED = "Passed",
6
+ FAILED = "Failed",
7
+ SKIPPED = "Skipped"
8
+ }
9
+ export declare class Converter {
10
+ static convertTestCaseToAutotestPost(autotestData: Metadata): AutotestPost;
11
+ static convertAutotestPostToAutotestResult(autotestData: Metadata, testRunInfo: TestRunInfo): AutotestResult;
12
+ static convertStatus(testRunInfo: TestRunInfo): Status;
13
+ }
14
+ export declare type StatusDetails = {
15
+ message?: string;
16
+ trace?: string;
17
+ };
18
+ export declare const stripAscii: (str: string) => string;
19
+ export {};
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.stripAscii = exports.Converter = void 0;
7
+ const utils_1 = __importDefault(require("./utils"));
8
+ var Status;
9
+ (function (Status) {
10
+ Status["PASSED"] = "Passed";
11
+ Status["FAILED"] = "Failed";
12
+ Status["SKIPPED"] = "Skipped";
13
+ })(Status || (Status = {}));
14
+ class Converter {
15
+ static convertTestCaseToAutotestPost(autotestData) {
16
+ return {
17
+ externalId: autotestData.externalId,
18
+ name: autotestData.displayName,
19
+ title: autotestData.title,
20
+ description: autotestData.description,
21
+ labels: autotestData.labels?.map((label) => ({ name: label })),
22
+ links: autotestData.links,
23
+ namespace: autotestData.namespace,
24
+ classname: autotestData.classname,
25
+ workItemIds: autotestData.workItemIds,
26
+ };
27
+ }
28
+ static convertAutotestPostToAutotestResult(autotestData, testRunInfo) {
29
+ const autotestResult = {
30
+ autoTestExternalId: autotestData.externalId,
31
+ outcome: this.convertStatus(testRunInfo),
32
+ duration: testRunInfo.durationMs ?? 0,
33
+ };
34
+ if (!!testRunInfo.errs && !!testRunInfo.errs.length) {
35
+ const status = getStatusDetails(testRunInfo);
36
+ autotestResult.message = status.message;
37
+ autotestResult.traces = status.trace;
38
+ }
39
+ return autotestResult;
40
+ }
41
+ static convertStatus(testRunInfo) {
42
+ const hasErrors = !!testRunInfo.errs && !!testRunInfo.errs.length;
43
+ const isSkipped = testRunInfo.skipped;
44
+ if (isSkipped) {
45
+ return Status.SKIPPED;
46
+ }
47
+ if (hasErrors) {
48
+ return Status.FAILED;
49
+ }
50
+ return Status.PASSED;
51
+ }
52
+ ;
53
+ }
54
+ exports.Converter = Converter;
55
+ const getStatusDetails = (testRunInfo) => {
56
+ const mergedErrors = mergeErrors(testRunInfo.errs);
57
+ let testMessages = '';
58
+ let testDetails = '';
59
+ mergedErrors.forEach((error) => {
60
+ if (error.errMsg) {
61
+ testMessages = (0, utils_1.default)(testMessages, error.errMsg);
62
+ }
63
+ const callSite = error.callsite;
64
+ let stacktrace = 'NO_STACKTRACE_DATA_FOUND';
65
+ if (callSite) {
66
+ if (callSite.filename) {
67
+ testDetails = (0, utils_1.default)(testDetails, `File name: ${callSite.filename}`);
68
+ }
69
+ if (callSite.lineNum) {
70
+ testDetails = (0, utils_1.default)(testDetails, `Line number: ${callSite.lineNum}`);
71
+ }
72
+ try {
73
+ const noColorRenderer = require('callsite-record').renderers.noColor;
74
+ stacktrace = error.callsite.renderSync({
75
+ renderer: noColorRenderer,
76
+ });
77
+ testDetails = (0, utils_1.default)(testDetails, `Stacktrace:\n${stacktrace}`);
78
+ }
79
+ catch (err) {
80
+ console.error(`Error in callsite.renderSync in reporting:\n${err}`);
81
+ }
82
+ }
83
+ if (error.userAgent) {
84
+ testDetails = (0, utils_1.default)(testDetails, `User Agent(s): ${error.userAgent}`);
85
+ }
86
+ });
87
+ return {
88
+ message: testMessages,
89
+ trace: testDetails,
90
+ };
91
+ };
92
+ const mergeErrors = (errors) => {
93
+ const mergedErrors = [];
94
+ errors.forEach((error) => {
95
+ if (error && error.errMsg) {
96
+ let errorExists = false;
97
+ mergedErrors.forEach((mergedError) => {
98
+ if (error.errMsg === mergedError.errMsg) {
99
+ errorExists = true;
100
+ if (error.userAgent && mergedError.userAgent !== error.userAgent) {
101
+ mergedError.userAgent = `${mergedError.userAgent}, ${error.userAgent}`;
102
+ }
103
+ }
104
+ });
105
+ if (!errorExists) {
106
+ mergedErrors.push(error);
107
+ }
108
+ }
109
+ });
110
+ return mergedErrors;
111
+ };
112
+ const stripAscii = (str) => {
113
+ return str.replace(asciiRegex, "");
114
+ };
115
+ exports.stripAscii = stripAscii;
116
+ const asciiRegex = new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))", "g");
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/lib/index.js ADDED
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const reporter_1 = __importDefault(require("./reporter"));
7
+ const testsData = {};
8
+ module.exports = function () {
9
+ return {
10
+ reporter: null,
11
+ async reportTaskStart(startTime, userAgents) {
12
+ this.reporter = new reporter_1.default();
13
+ },
14
+ async reportFixtureStart(name, path, meta) {
15
+ await this.reporter.onFixtureBegin(name, path, meta);
16
+ },
17
+ async reportTestDone(name, testRunInfo, meta) {
18
+ await this.reporter.onTestEnd(name, testRunInfo, meta, testsData[testRunInfo.testId]);
19
+ },
20
+ async reportTaskDone() {
21
+ await this.reporter.onEnd();
22
+ },
23
+ addMessage(t, message) {
24
+ if (t === undefined) {
25
+ return;
26
+ }
27
+ if (t.testRun === undefined) {
28
+ return;
29
+ }
30
+ if (t.testRun.test === undefined) {
31
+ return;
32
+ }
33
+ if (t.testRun.test.id === undefined) {
34
+ return;
35
+ }
36
+ const id = t.testRun.test.id;
37
+ if (testsData[id] === undefined) {
38
+ testsData[id] = {};
39
+ }
40
+ testsData[id].message = message;
41
+ },
42
+ addAttachments(t, paths) {
43
+ if (t === undefined) {
44
+ return;
45
+ }
46
+ if (t.testRun === undefined) {
47
+ return;
48
+ }
49
+ if (t.testRun.test === undefined) {
50
+ return;
51
+ }
52
+ if (t.testRun.test.id === undefined) {
53
+ return;
54
+ }
55
+ const id = t.testRun.test.id;
56
+ if (testsData[id] === undefined) {
57
+ testsData[id] = {};
58
+ }
59
+ if (Array.isArray(paths)) {
60
+ testsData[id].attachments = paths;
61
+ }
62
+ else if (testsData[id].attachments !== undefined) {
63
+ testsData[id].attachments.append(paths);
64
+ }
65
+ else {
66
+ testsData[id].attachments = [paths];
67
+ }
68
+ },
69
+ addLinks(t, links) {
70
+ if (t === undefined) {
71
+ return;
72
+ }
73
+ if (t.testRun === undefined) {
74
+ return;
75
+ }
76
+ if (t.testRun.test === undefined) {
77
+ return;
78
+ }
79
+ if (t.testRun.test.id === undefined) {
80
+ return;
81
+ }
82
+ const id = t.testRun.test.id;
83
+ if (testsData[id] === undefined) {
84
+ testsData[id] = {};
85
+ }
86
+ testsData[id].links = links;
87
+ },
88
+ };
89
+ };
@@ -0,0 +1,17 @@
1
+ import { Link } from 'testit-js-commons';
2
+ export default class Metadata {
3
+ externalId: string | undefined;
4
+ displayName: string | undefined;
5
+ title: string | undefined;
6
+ description: string | undefined;
7
+ links: Link[] | undefined;
8
+ labels: string[] | undefined;
9
+ workItemIds: string[] | undefined;
10
+ namespace: string | undefined;
11
+ classname: string | undefined;
12
+ otherMeta: Map<string, string>;
13
+ constructor(meta?: any, path?: string, name?: string);
14
+ mergeMetadata(metadata: Metadata): void;
15
+ private isString;
16
+ private generateExternalId;
17
+ }
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const testit_js_commons_1 = require("testit-js-commons");
4
+ class Metadata {
5
+ constructor(meta, path, name) {
6
+ this.otherMeta = new Map();
7
+ if (meta) {
8
+ const { externalId, displayName, title, description, links, labels, workItemIds, namespace, classname, ...otherMeta } = meta;
9
+ if (this.isString(externalId)) {
10
+ this.externalId = externalId;
11
+ }
12
+ else if (path !== undefined && name !== undefined) {
13
+ this.externalId = this.generateExternalId(name, path);
14
+ }
15
+ if (this.isString(displayName)) {
16
+ this.displayName = displayName;
17
+ }
18
+ else if (name !== undefined) {
19
+ this.displayName = name;
20
+ }
21
+ if (this.isString(title)) {
22
+ this.title = title;
23
+ }
24
+ if (this.isString(description)) {
25
+ this.description = description;
26
+ }
27
+ if (Array.isArray(links)) {
28
+ this.links = links;
29
+ }
30
+ else if (this.isString(links)) {
31
+ this.links = [links];
32
+ }
33
+ if (Array.isArray(labels)) {
34
+ this.labels = labels;
35
+ }
36
+ else if (this.isString(labels)) {
37
+ this.labels = [labels];
38
+ }
39
+ if (Array.isArray(workItemIds)) {
40
+ this.workItemIds = workItemIds;
41
+ }
42
+ else if (this.isString(workItemIds)) {
43
+ this.workItemIds = [workItemIds];
44
+ }
45
+ if (this.isString(namespace)) {
46
+ this.namespace = namespace;
47
+ }
48
+ if (this.isString(classname)) {
49
+ this.classname = classname;
50
+ }
51
+ Object.keys(otherMeta).forEach((key) => {
52
+ if (this.isString(otherMeta[key])) {
53
+ this.otherMeta.set(key, otherMeta[key]);
54
+ }
55
+ });
56
+ }
57
+ }
58
+ mergeMetadata(metadata) {
59
+ if (!this.externalId && metadata.externalId) {
60
+ this.externalId = metadata.externalId;
61
+ }
62
+ if (!this.displayName && metadata.displayName) {
63
+ this.displayName = metadata.displayName;
64
+ }
65
+ if (!this.title && metadata.title) {
66
+ this.title = metadata.title;
67
+ }
68
+ if (!this.description && metadata.description) {
69
+ this.description = metadata.description;
70
+ }
71
+ if (!this.links && metadata.links) {
72
+ this.links = metadata.links;
73
+ }
74
+ if (!this.labels && metadata.labels) {
75
+ this.labels = metadata.labels;
76
+ }
77
+ if (!this.workItemIds && metadata.workItemIds) {
78
+ this.workItemIds = metadata.workItemIds;
79
+ }
80
+ if (!this.namespace && metadata.namespace) {
81
+ this.namespace = metadata.namespace;
82
+ }
83
+ if (!this.classname && metadata.classname) {
84
+ this.classname = metadata.classname;
85
+ }
86
+ if (metadata.otherMeta.size > 0) {
87
+ Array.from(metadata.otherMeta.entries()).map((entry) => {
88
+ if (!this.otherMeta.has(entry[0])) {
89
+ this.otherMeta.set(entry[0], entry[1]);
90
+ }
91
+ });
92
+ }
93
+ }
94
+ isString(value) {
95
+ if (!value) {
96
+ return false;
97
+ }
98
+ return typeof value === 'string';
99
+ }
100
+ generateExternalId(testName, testPath) {
101
+ return testit_js_commons_1.Utils.getHash(JSON.stringify({
102
+ path: testPath,
103
+ name: testName,
104
+ }));
105
+ }
106
+ }
107
+ exports.default = Metadata;
@@ -0,0 +1,17 @@
1
+ import { IStrategy } from "testit-js-commons";
2
+ import { TestRunInfo } from "./types";
3
+ export default class TmsReporter {
4
+ strategy: IStrategy;
5
+ private readonly additions;
6
+ private testCache;
7
+ private loadTestPromises;
8
+ private groupMetadata;
9
+ private groupPath;
10
+ constructor();
11
+ onFixtureBegin(name: string, path: string, meta: object): void;
12
+ onTestBegin(meta: object): void;
13
+ onTestEnd(name: string, testRunInfo: TestRunInfo, meta: object, testData: any): Promise<void>;
14
+ onEnd(): Promise<void>;
15
+ private loadTest;
16
+ private addAttachments;
17
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const testit_js_commons_1 = require("testit-js-commons");
7
+ const converter_1 = require("./converter");
8
+ const metadata_1 = __importDefault(require("./metadata"));
9
+ class TmsReporter {
10
+ constructor() {
11
+ this.testCache = new Array();
12
+ this.loadTestPromises = new Array();
13
+ const config = new testit_js_commons_1.ConfigComposer().compose();
14
+ const client = new testit_js_commons_1.Client(config);
15
+ this.strategy = testit_js_commons_1.StrategyFactory.create(client, config);
16
+ this.additions = new testit_js_commons_1.Additions(client);
17
+ }
18
+ onFixtureBegin(name, path, meta) {
19
+ this.groupMetadata = new metadata_1.default(meta);
20
+ this.groupPath = path;
21
+ }
22
+ onTestBegin(meta) {
23
+ this.testCache.push(meta);
24
+ }
25
+ async onTestEnd(name, testRunInfo, meta, testData) {
26
+ await this.loadTestPromises.push(this.loadTest(name, testRunInfo, meta, testData));
27
+ }
28
+ async onEnd() {
29
+ await Promise.all(this.loadTestPromises);
30
+ }
31
+ async loadTest(name, testRunInfo, meta, testData) {
32
+ const autotestData = new metadata_1.default(meta, this.groupPath, name);
33
+ autotestData.mergeMetadata(this.groupMetadata);
34
+ const autotest = converter_1.Converter.convertTestCaseToAutotestPost(autotestData);
35
+ const autotestResult = converter_1.Converter.convertAutotestPostToAutotestResult(autotestData, testRunInfo);
36
+ autotestResult.links = this.additions.links;
37
+ autotestResult.message = this.additions.messages.join("\n");
38
+ if (testData !== undefined) {
39
+ if (testData.message !== undefined) {
40
+ autotestResult.message = testData.message;
41
+ }
42
+ if (testData.links !== undefined) {
43
+ autotestResult.links = testData.links;
44
+ }
45
+ if (testData.attachments !== undefined) {
46
+ autotestResult.attachments = await this.addAttachments(testData.attachments);
47
+ }
48
+ }
49
+ await this.strategy.loadAutotest(autotest, true);
50
+ await this.strategy.loadTestRun([autotestResult]);
51
+ }
52
+ addAttachments(paths) {
53
+ const promise = typeof paths === "string"
54
+ ? this.additions.addAttachments([paths])
55
+ : this.additions.addAttachments(paths);
56
+ return promise;
57
+ }
58
+ ;
59
+ }
60
+ exports.default = TmsReporter;
package/lib/types.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ import { CallsiteRecord } from 'callsite-record';
2
+ export {};
3
+ declare global {
4
+ interface TestController {
5
+ testRun: TestRun;
6
+ }
7
+ interface TestRun {
8
+ test: Test;
9
+ }
10
+ interface Test {
11
+ meta: object;
12
+ }
13
+ }
14
+ export interface Screenshot {
15
+ screenshotPath?: string;
16
+ thumbnailPath?: string;
17
+ userAgent?: string;
18
+ quarantineAttempt?: number;
19
+ takenOnFail?: boolean;
20
+ }
21
+ export declare type TestCafeError = {
22
+ errMsg: string;
23
+ originError?: string;
24
+ callsite?: CallsiteRecord;
25
+ };
26
+ export interface TestRunInfo {
27
+ errs?: TestCafeError[];
28
+ warnings?: string[];
29
+ durationMs?: number;
30
+ unstable?: boolean;
31
+ screenshotPath?: string;
32
+ screenshots?: Screenshot[];
33
+ quarantine?: object;
34
+ skipped?: boolean;
35
+ testId: string;
36
+ }
37
+ export interface ErrorObject {
38
+ errMsg?: string;
39
+ callsite?: CallSite;
40
+ userAgent?: string;
41
+ }
42
+ export interface CallSite extends CallsiteRecord {
43
+ filename?: string;
44
+ lineNum?: string;
45
+ }
package/lib/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/lib/utils.d.ts ADDED
@@ -0,0 +1 @@
1
+ export default function addNewLine(text: string, line: string): string;
package/lib/utils.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function addNewLine(text, line) {
4
+ if (text === null || text.length === 0) {
5
+ return line;
6
+ }
7
+ return `${text}\n${line}`;
8
+ }
9
+ exports.default = addNewLine;
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "testcafe-reporter-testit",
3
+ "version": "2.2.2",
4
+ "description": "TestCafe adapter for Test IT",
5
+ "keywords": [],
6
+ "author": {
7
+ "name": "Integration team",
8
+ "email": "integrations@testit.software"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/testit-tms/adapters-js.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/testit-tms/adapters-js/issues"
16
+ },
17
+ "homepage": "https://github.com/testit-tms/adapters-js",
18
+ "main": "lib/index",
19
+ "files": [
20
+ "lib"
21
+ ],
22
+ "scripts": {
23
+ "prebuild": "npm --prefix ../testit-js-commons run build && npm link ../testit-js-commons",
24
+ "build": "tsc -p tsconfig.json",
25
+ "watch": "tsc -p tsconfig.json -w"
26
+ },
27
+ "devDependencies": {
28
+ "@babel/core": "^7.9.0",
29
+ "@babel/preset-env": "^7.9.5",
30
+ "@babel/eslint-parser": "^7.22.9",
31
+ "babel-plugin-add-module-exports": "^1.0.2",
32
+ "callsite-record": "^4.1.3",
33
+ "del": "^5.1.0",
34
+ "gulp": "^4.0.2",
35
+ "gulp-babel": "^8.0.0",
36
+ "gulp-eslint": "^6.0.0",
37
+ "gulp-mocha": "^7.0.2",
38
+ "lodash.findlastindex": "^4.6.0",
39
+ "normalize-newline": "^3.0.0",
40
+ "read-file-relative": "^1.2.0",
41
+ "testcafe": "^3.0.1"
42
+ },
43
+ "dependencies": {
44
+ "testit-js-commons": "~2.2.2"
45
+ }
46
+ }