testit-adapter-cypress 3.7.5

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.
Files changed (46) hide show
  1. package/README.md +240 -0
  2. package/dist/browser/commandLog.d.ts +10 -0
  3. package/dist/browser/commandLog.js +213 -0
  4. package/dist/browser/events/cypress.d.ts +2 -0
  5. package/dist/browser/events/cypress.js +38 -0
  6. package/dist/browser/events/index.d.ts +2 -0
  7. package/dist/browser/events/index.js +15 -0
  8. package/dist/browser/events/mocha.d.ts +3 -0
  9. package/dist/browser/events/mocha.js +80 -0
  10. package/dist/browser/index.d.ts +1 -0
  11. package/dist/browser/index.js +14 -0
  12. package/dist/browser/lifecycle.d.ts +21 -0
  13. package/dist/browser/lifecycle.js +227 -0
  14. package/dist/browser/patching.d.ts +5 -0
  15. package/dist/browser/patching.js +117 -0
  16. package/dist/browser/runtime.d.ts +31 -0
  17. package/dist/browser/runtime.js +284 -0
  18. package/dist/browser/serialize.d.ts +3 -0
  19. package/dist/browser/serialize.js +57 -0
  20. package/dist/browser/state.d.ts +28 -0
  21. package/dist/browser/state.js +80 -0
  22. package/dist/browser/steps.d.ts +14 -0
  23. package/dist/browser/steps.js +114 -0
  24. package/dist/browser/testplan.d.ts +2 -0
  25. package/dist/browser/testplan.js +55 -0
  26. package/dist/browser/types.d.ts +35 -0
  27. package/dist/browser/types.js +30 -0
  28. package/dist/browser/utils.d.ts +65 -0
  29. package/dist/browser/utils.js +187 -0
  30. package/dist/converter.d.ts +43 -0
  31. package/dist/converter.js +84 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +6 -0
  34. package/dist/models/index.d.ts +0 -0
  35. package/dist/models/index.js +1 -0
  36. package/dist/models/status.d.ts +5 -0
  37. package/dist/models/status.js +9 -0
  38. package/dist/models/types.d.ts +280 -0
  39. package/dist/models/types.js +2 -0
  40. package/dist/node-utils.d.ts +15 -0
  41. package/dist/node-utils.js +93 -0
  42. package/dist/reporter.d.ts +24 -0
  43. package/dist/reporter.js +382 -0
  44. package/dist/utils.d.ts +17 -0
  45. package/dist/utils.js +34 -0
  46. package/package.json +50 -0
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGlobalTestRuntime = exports.setGlobalTestRuntime = exports.serialize = exports.isPromise = exports.getMessageAndTraceFromError = exports.resolveRenderProps = exports.resolveConsoleProps = exports.getStatusDataOfTestSkippedByHookError = exports.isLastRootAfterHook = exports.isRootAfterAllHook = exports.isTmsHook = exports.getTestMetadata = exports.generateApiStepId = exports.getSuiteTitlePath = exports.getSuitePath = exports.iterateTests = exports.iterateSuites = exports.isTestReported = exports.markTestAsReported = exports.getStepStopData = exports.getTestSkipData = exports.getTestStopData = exports.getTestStartData = exports.uint8ArrayToBase64 = exports.resolveSpecRelativePath = exports.getFileNameFromPath = void 0;
4
+ const testit_js_commons_1 = require("testit-js-commons");
5
+ const mocha_js_1 = require("./events/mocha.js");
6
+ const state_js_1 = require("./state.js");
7
+ const steps_js_1 = require("./steps.js");
8
+ const types_js_1 = require("./types.js");
9
+ const IS_WIN = Cypress.platform === "win32";
10
+ const getFileNameFromPath = (path) => path.substring(path.lastIndexOf(IS_WIN ? "\\" : "/") + 1);
11
+ exports.getFileNameFromPath = getFileNameFromPath;
12
+ const resolveSpecRelativePath = (spec) => {
13
+ const projectDir = (0, state_js_1.getProjectDir)();
14
+ const specPath = projectDir ? spec.absolute.substring(projectDir.length + 1) : spec.relative;
15
+ return IS_WIN ? specPath.replaceAll("\\", "/") : specPath;
16
+ };
17
+ exports.resolveSpecRelativePath = resolveSpecRelativePath;
18
+ const uint8ArrayToBase64 = (data) => {
19
+ // @ts-ignore
20
+ const u8arrayLike = Array.isArray(data) || data.buffer;
21
+ if (!u8arrayLike) {
22
+ return data;
23
+ }
24
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
25
+ return btoa(String.fromCharCode.apply(null, data));
26
+ };
27
+ exports.uint8ArrayToBase64 = uint8ArrayToBase64;
28
+ const getTestStartData = (test) => ({
29
+ ...(0, exports.getTestMetadata)(test),
30
+ start: typeof test.wallClockStartedAt === "string"
31
+ ? Date.parse(test.wallClockStartedAt)
32
+ : test.wallClockStartedAt?.getTime?.() || Date.now(),
33
+ });
34
+ exports.getTestStartData = getTestStartData;
35
+ const getTestStopData = (test) => ({
36
+ duration: test.duration ?? 0,
37
+ retries: test._retries ?? 0,
38
+ });
39
+ exports.getTestStopData = getTestStopData;
40
+ const getTestSkipData = () => ({
41
+ statusDetails: { message: "This is a pending test" },
42
+ });
43
+ exports.getTestSkipData = getTestSkipData;
44
+ const getStepStopData = (step, status, statusDetails) => {
45
+ const data = {
46
+ id: step.id,
47
+ stop: Date.now(),
48
+ status: status ?? (0, steps_js_1.resolveStepStatus)(step),
49
+ };
50
+ if (statusDetails) {
51
+ data.statusDetails = statusDetails;
52
+ }
53
+ return data;
54
+ };
55
+ exports.getStepStopData = getStepStopData;
56
+ const testReportedKey = Symbol("The test has been reported to Tms");
57
+ const markTestAsReported = (test) => {
58
+ test[testReportedKey] = true;
59
+ };
60
+ exports.markTestAsReported = markTestAsReported;
61
+ const isTestReported = (test) => test[testReportedKey] === true;
62
+ exports.isTestReported = isTestReported;
63
+ const iterateSuites = function* (parent) {
64
+ const suiteStack = [];
65
+ for (let s = parent; s; s = suiteStack.pop()) {
66
+ yield s;
67
+ // Pushing in reverse allows us to maintain depth-first pre-order traversal;
68
+ // the same order is used by Mocha & Cypress.
69
+ for (let i = s.suites.length - 1; i >= 0; i--) {
70
+ suiteStack.push(s.suites[i]);
71
+ }
72
+ }
73
+ };
74
+ exports.iterateSuites = iterateSuites;
75
+ const iterateTests = function* (parent) {
76
+ for (const suite of (0, exports.iterateSuites)(parent)) {
77
+ yield* suite.tests;
78
+ }
79
+ };
80
+ exports.iterateTests = iterateTests;
81
+ const getSuitePath = (test) => {
82
+ const suites = [];
83
+ for (let s = test.parent; s; s = s.parent) {
84
+ suites.push(s);
85
+ }
86
+ suites.reverse();
87
+ return suites;
88
+ };
89
+ exports.getSuitePath = getSuitePath;
90
+ const getSuiteTitlePath = (test) => (0, exports.getSuitePath)(test)
91
+ .filter((s) => s.title)
92
+ .map((s) => s.title);
93
+ exports.getSuiteTitlePath = getSuiteTitlePath;
94
+ const generateApiStepId = () => ((0, state_js_1.getTmsState)().nextApiStepId++).toString();
95
+ exports.generateApiStepId = generateApiStepId;
96
+ const getTestMetadata = (test) => {
97
+ const suites = test.titlePath().slice(0, -1);
98
+ const fullNameSuffix = `${[...suites, test.title].join(" ")}`;
99
+ return { name: test.title, fullNameSuffix };
100
+ };
101
+ exports.getTestMetadata = getTestMetadata;
102
+ const isTmsHook = (hook) => hook.title.includes(mocha_js_1.TMS_REPORT_SYSTEM_HOOK);
103
+ exports.isTmsHook = isTmsHook;
104
+ const isRootAfterAllHook = (hook) => hook.parent.root && hook.hookName === "after all";
105
+ exports.isRootAfterAllHook = isRootAfterAllHook;
106
+ const isLastRootAfterHook = (context) => {
107
+ const currentAfterAll = context.test;
108
+ const rootSuite = context.test.parent;
109
+ const hooks = rootSuite.hooks;
110
+ const lastAfterAll = hooks.findLast((h) => h.hookName === "after all");
111
+ return lastAfterAll?.hookId === currentAfterAll.hookId;
112
+ };
113
+ exports.isLastRootAfterHook = isLastRootAfterHook;
114
+ const getStatusDataOfTestSkippedByHookError = (hookTitle, isEachHook, err, suite) => {
115
+ const status = isEachHook ? testit_js_commons_1.Status.SKIPPED : testit_js_commons_1.Status.FAILED;
116
+ const { message, trace } = (0, exports.getMessageAndTraceFromError)(err);
117
+ return {
118
+ status,
119
+ statusDetails: {
120
+ message: isEachHook ? getSkipReason(hookTitle, suite) : message,
121
+ trace,
122
+ },
123
+ };
124
+ };
125
+ exports.getStatusDataOfTestSkippedByHookError = getStatusDataOfTestSkippedByHookError;
126
+ const getSkipReason = (hookTitle, suite) => {
127
+ const suiteName = suite.title ? `'${suite.title}'` : "root";
128
+ return `'${hookTitle}' defined in the ${suiteName} suite has failed`;
129
+ };
130
+ const resolveConsoleProps = (entry) => {
131
+ // consoleProps can be a function or an object(cy.origin just return an object)
132
+ return typeof entry.attributes.consoleProps === "function"
133
+ ? entry.attributes.consoleProps()
134
+ : entry.attributes.consoleProps;
135
+ };
136
+ exports.resolveConsoleProps = resolveConsoleProps;
137
+ const resolveRenderProps = (entry) => {
138
+ // renderProps can be a function or an object(cy.origin just return an object)
139
+ return typeof entry?.attributes?.renderProps === "function"
140
+ ? entry.attributes.renderProps()
141
+ : entry.attributes?.renderProps;
142
+ };
143
+ exports.resolveRenderProps = resolveRenderProps;
144
+ const getMessageAndTraceFromError = (error) => {
145
+ const message = error.message ?? undefined;
146
+ const trace = error.stack ?? undefined;
147
+ const v = error;
148
+ const actual = v.actual !== undefined ? (0, exports.serialize)(v.actual) : undefined;
149
+ const expected = v.expected !== undefined ? (0, exports.serialize)(v.expected) : undefined;
150
+ return { message, trace, actual, expected };
151
+ };
152
+ exports.getMessageAndTraceFromError = getMessageAndTraceFromError;
153
+ const isPromise = (obj) => !!obj &&
154
+ (typeof obj === "object" || typeof obj === "function") &&
155
+ "then" in obj &&
156
+ typeof obj.then === "function";
157
+ exports.isPromise = isPromise;
158
+ const serialize = (value, opts = {}) => {
159
+ const { maxLength = 0 } = opts;
160
+ let stringValue;
161
+ if (typeof value === "object" && value !== null) {
162
+ try {
163
+ stringValue = JSON.stringify(value);
164
+ }
165
+ catch {
166
+ stringValue = String(value);
167
+ }
168
+ }
169
+ else {
170
+ stringValue = String(value);
171
+ }
172
+ if (maxLength && stringValue.length > maxLength) {
173
+ return stringValue.slice(0, maxLength) + "...";
174
+ }
175
+ return stringValue;
176
+ };
177
+ exports.serialize = serialize;
178
+ const KEY = "tmsTestRuntime";
179
+ const setGlobalTestRuntime = (r) => {
180
+ globalThis[KEY] = () => r;
181
+ };
182
+ exports.setGlobalTestRuntime = setGlobalTestRuntime;
183
+ const getGlobalTestRuntime = () => {
184
+ const fn = globalThis[KEY];
185
+ return fn?.() ?? types_js_1.noopRuntime;
186
+ };
187
+ exports.getGlobalTestRuntime = getGlobalTestRuntime;
@@ -0,0 +1,43 @@
1
+ import type { AutotestPost, AutotestResult, Outcome } from "testit-js-commons";
2
+ import { Label, Link } from "testit-js-commons";
3
+ export interface StepData {
4
+ id: string;
5
+ name: string;
6
+ start: number;
7
+ stop?: number;
8
+ duration?: number;
9
+ status?: Outcome;
10
+ statusDetails?: {
11
+ message?: string;
12
+ trace?: string;
13
+ };
14
+ attachmentIds: string[];
15
+ children: StepData[];
16
+ }
17
+ export interface TestData {
18
+ fullNameSuffix: string;
19
+ displayName: string;
20
+ description?: string;
21
+ title?: string;
22
+ namespace?: string;
23
+ classname?: string;
24
+ labels: Label[];
25
+ tags: string[];
26
+ links: Link[];
27
+ workItemIds: string[];
28
+ start?: number;
29
+ stop?: number;
30
+ outcome: Outcome;
31
+ duration?: number;
32
+ statusDetails?: {
33
+ message?: string;
34
+ trace?: string;
35
+ };
36
+ steps: StepData[];
37
+ attachmentIds: string[];
38
+ parameters?: Record<string, string>;
39
+ properties?: Record<string, string>;
40
+ externalKey: string;
41
+ }
42
+ export declare function toAutotestPost(specPath: string, t: TestData): AutotestPost;
43
+ export declare function toAutotestResult(externalId: string, t: TestData, outcome: Outcome, extraAttachmentIds?: string[]): AutotestResult;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toAutotestPost = toAutotestPost;
4
+ exports.toAutotestResult = toAutotestResult;
5
+ const testit_js_commons_1 = require("testit-js-commons");
6
+ function stepDataToStep(s) {
7
+ const step = {
8
+ title: s.name,
9
+ outcome: s.status,
10
+ attachments: s.attachmentIds.map((id) => ({ id })),
11
+ steps: s.children.length ? s.children.map(stepDataToStep) : undefined,
12
+ };
13
+ if (s.start != null)
14
+ step.startedOn = new Date(s.start);
15
+ if (s.stop != null)
16
+ step.completedOn = new Date(s.stop);
17
+ if (s.duration != null)
18
+ step.duration = s.duration;
19
+ else if (s.start != null && s.stop != null)
20
+ step.duration = s.stop - s.start;
21
+ if (s.statusDetails?.message)
22
+ step.info = s.statusDetails.message;
23
+ return step;
24
+ }
25
+ function stepDataToShortStep(s) {
26
+ return {
27
+ title: s.name,
28
+ steps: s.children.length ? s.children.map(stepDataToShortStep) : undefined,
29
+ };
30
+ }
31
+ function toAutotestPost(specPath, t) {
32
+ const fullName = `${specPath}#${t.fullNameSuffix}`;
33
+ const externalId = testit_js_commons_1.Utils.getHash(fullName);
34
+ const name = (t.displayName ?? t.fullNameSuffix).replace(/#/g, " > ");
35
+ const labels = t.labels?.map((l) => ({ name: l.name })) ?? [];
36
+ return {
37
+ externalId,
38
+ name,
39
+ title: t.title,
40
+ description: t.description,
41
+ workItemIds: t.workItemIds,
42
+ namespace: t.namespace,
43
+ classname: t.classname,
44
+ links: t.links?.length ? t.links : undefined,
45
+ labels: labels.length ? labels : undefined,
46
+ tags: t.tags?.length ? t.tags : undefined,
47
+ steps: t.steps.map(s => stepDataToShortStep(s)),
48
+ externalKey: t.externalKey,
49
+ };
50
+ }
51
+ function toAutotestResult(externalId, t, outcome, extraAttachmentIds = []) {
52
+ const result = {
53
+ autoTestExternalId: externalId,
54
+ outcome,
55
+ attachments: [...t.attachmentIds, ...extraAttachmentIds].map((id) => ({ id })),
56
+ stepResults: t.steps.map(s => stepDataToStep(s)),
57
+ };
58
+ if (t.links?.length) {
59
+ result.links = t.links;
60
+ }
61
+ if (t.duration != null) {
62
+ result.duration = t.duration;
63
+ }
64
+ if (t.start != null) {
65
+ result.startedOn = new Date(t.start);
66
+ if (t.duration != null) {
67
+ result.completedOn = new Date(t.start + t.duration);
68
+ }
69
+ else if (t.stop != null) {
70
+ result.completedOn = new Date(t.stop);
71
+ }
72
+ }
73
+ if (t.parameters) {
74
+ result.parameters = t.parameters;
75
+ }
76
+ if (t.properties) {
77
+ result.properties = t.properties;
78
+ }
79
+ if (t.statusDetails?.message)
80
+ result.message = t.statusDetails.message;
81
+ if (t.statusDetails?.trace)
82
+ result.traces = t.statusDetails.trace;
83
+ return result;
84
+ }
@@ -0,0 +1,2 @@
1
+ import { initializeTms } from "./browser/index.js";
2
+ export { initializeTms };
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initializeTms = void 0;
4
+ const index_js_1 = require("./browser/index.js");
5
+ Object.defineProperty(exports, "initializeTms", { enumerable: true, get: function () { return index_js_1.initializeTms; } });
6
+ (0, index_js_1.initializeTms)();
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,5 @@
1
+ export declare enum Status {
2
+ FAILED = "Failed",
3
+ PASSED = "Passed",
4
+ SKIPPED = "Skipped"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Status = void 0;
4
+ var Status;
5
+ (function (Status) {
6
+ Status["FAILED"] = "Failed";
7
+ Status["PASSED"] = "Passed";
8
+ Status["SKIPPED"] = "Skipped";
9
+ })(Status || (exports.Status = Status = {}));
@@ -0,0 +1,280 @@
1
+ import type { Label, Link, Status } from "testit-js-commons";
2
+ export interface Parameter {
3
+ name: string;
4
+ value: string;
5
+ }
6
+ export interface StatusDetails {
7
+ message?: string;
8
+ trace?: string;
9
+ actual?: string;
10
+ expected?: string;
11
+ }
12
+ export type ReporterConfig = {
13
+ resultsDir?: string;
14
+ };
15
+ export type TmsCypressConfig = ReporterConfig & {
16
+ videoOnFailOnly?: boolean;
17
+ stepsFromCommands?: Partial<TmsSpecState["config"]["stepsFromCommands"]>;
18
+ };
19
+ export type CypressSuite = Mocha.Suite & {
20
+ id: string;
21
+ parent: CypressSuite | undefined;
22
+ tests: CypressTest[];
23
+ suites: CypressSuite[];
24
+ };
25
+ export type CypressTest = Mocha.Test & {
26
+ wallClockStartedAt?: Date;
27
+ parent: CypressSuite | undefined;
28
+ };
29
+ export type CypressHook = Mocha.Hook & {
30
+ hookId: string;
31
+ hookName: string;
32
+ parent: CypressSuite | undefined;
33
+ };
34
+ export type CypressCommand = {
35
+ attributes: {
36
+ name: string;
37
+ id: string;
38
+ args: any[];
39
+ };
40
+ state: "passed" | "failed" | "queued";
41
+ };
42
+ export type CypressRenderProps = {
43
+ message?: string;
44
+ };
45
+ export type CypressConsoleProps = {
46
+ name: string;
47
+ props: Record<string, unknown>;
48
+ };
49
+ export type CypressLogEntry = ReturnType<typeof Cypress.log> & {
50
+ attributes: {
51
+ id: string;
52
+ error?: Error;
53
+ name: string;
54
+ message: string;
55
+ displayName?: string;
56
+ event: boolean;
57
+ type: string;
58
+ instrument: string;
59
+ groupStart: boolean;
60
+ createdAtTimestamp: number;
61
+ updatedAtTimestamp: number;
62
+ end?: boolean;
63
+ renderProps: (() => CypressRenderProps) | CypressRenderProps;
64
+ consoleProps: (() => CypressConsoleProps) | CypressConsoleProps;
65
+ };
66
+ endGroup: () => unknown;
67
+ };
68
+ export type CupressRunStart = {
69
+ type: "cypress_run_start";
70
+ data: object;
71
+ };
72
+ export type CypressSuiteStartMessage = {
73
+ type: "cypress_suite_start";
74
+ data: {
75
+ id: string;
76
+ name: string;
77
+ root: boolean;
78
+ start: number;
79
+ };
80
+ };
81
+ export type CypressSuiteEndMessage = {
82
+ type: "cypress_suite_end";
83
+ data: {
84
+ root: boolean;
85
+ stop: number;
86
+ };
87
+ };
88
+ export type CypressHookStartMessage = {
89
+ type: "cypress_hook_start";
90
+ data: {
91
+ name: string;
92
+ scopeType: "each" | "all";
93
+ position: "before" | "after";
94
+ start: number;
95
+ };
96
+ };
97
+ export type CypressHookEndMessage = {
98
+ type: "cypress_hook_end";
99
+ data: {
100
+ duration: number;
101
+ };
102
+ };
103
+ export type CypressTestStartMessage = {
104
+ type: "cypress_test_start";
105
+ data: {
106
+ name: string;
107
+ fullNameSuffix: string;
108
+ start: number;
109
+ labels: Label[];
110
+ tags: string[];
111
+ links: Link[];
112
+ workItemIds: string[];
113
+ };
114
+ };
115
+ export type CypressFailMessage = {
116
+ type: "cypress_fail";
117
+ data: {
118
+ status: Status;
119
+ statusDetails: StatusDetails;
120
+ };
121
+ };
122
+ export type CypressTestSkipMessage = {
123
+ type: "cypress_test_skip";
124
+ data: {
125
+ statusDetails?: StatusDetails;
126
+ };
127
+ };
128
+ export type CypressTestPassMessage = {
129
+ type: "cypress_test_pass";
130
+ data: object;
131
+ };
132
+ export type CypressSkippedTestMessage = {
133
+ type: "cypress_skipped_test";
134
+ data: CypressTestStartMessage["data"] & CypressFailMessage["data"] & CypressTestEndMessage["data"] & {
135
+ suites: string[];
136
+ };
137
+ };
138
+ export type CypressTestEndMessage = {
139
+ type: "cypress_test_end";
140
+ data: {
141
+ duration: number;
142
+ retries: number;
143
+ };
144
+ };
145
+ export type CypressStepStartMessage = {
146
+ type: "cypress_step_start";
147
+ data: {
148
+ id: string;
149
+ name: string;
150
+ start: number;
151
+ };
152
+ };
153
+ export type CypressStepStopMessage = {
154
+ type: "cypress_step_stop";
155
+ data: {
156
+ id: string;
157
+ status: Status;
158
+ statusDetails?: StatusDetails;
159
+ stop: number;
160
+ };
161
+ };
162
+ export type CypressStepFinalizeMessage = {
163
+ type: "cypress_step_finalize";
164
+ data: {
165
+ id: string;
166
+ name?: string;
167
+ parameters?: Parameter[];
168
+ statusDetails?: StatusDetails;
169
+ };
170
+ };
171
+ type RuntimeMessageBase<T extends string> = {
172
+ type: T;
173
+ };
174
+ export type RuntimeMetadataMessage = RuntimeMessageBase<"metadata"> & {
175
+ data: {
176
+ labels?: Label[];
177
+ links?: Link[];
178
+ tags?: string[];
179
+ workItemIds?: string[];
180
+ parameters?: Parameter[];
181
+ description?: string;
182
+ displayName?: string;
183
+ title?: string;
184
+ namespace?: string;
185
+ classname?: string;
186
+ };
187
+ };
188
+ export type RuntimeStartStepMessage = RuntimeMessageBase<"step_start"> & {
189
+ data: {
190
+ name: string;
191
+ start: number;
192
+ };
193
+ };
194
+ export type RuntimeStopStepMessage = RuntimeMessageBase<"step_stop"> & {
195
+ data: {
196
+ stop: number;
197
+ status: Status;
198
+ statusDetails?: StatusDetails;
199
+ };
200
+ };
201
+ export type RuntimeAttachmentContentMessage = RuntimeMessageBase<"attachment_content"> & {
202
+ data: {
203
+ name: string;
204
+ content: string;
205
+ encoding: BufferEncoding;
206
+ contentType: string;
207
+ fileExtension?: string;
208
+ };
209
+ };
210
+ export type RuntimeAttachmentPathMessage = RuntimeMessageBase<"attachment_path"> & {
211
+ data: {
212
+ name: string;
213
+ path: string;
214
+ contentType: string;
215
+ fileExtension?: string;
216
+ };
217
+ };
218
+ export type RuntimeMessage = RuntimeMetadataMessage | RuntimeStartStepMessage | RuntimeStopStepMessage | RuntimeAttachmentContentMessage | RuntimeAttachmentPathMessage | (RuntimeMessageBase<string> & {
219
+ data?: unknown;
220
+ });
221
+ export interface TestPlanV1 {
222
+ version: "1.0";
223
+ tests: Array<{
224
+ id?: string | number;
225
+ selector?: string;
226
+ }>;
227
+ }
228
+ export type CypressMessage = Exclude<RuntimeMessage, RuntimeStartStepMessage | RuntimeStopStepMessage> | CupressRunStart | CypressSuiteStartMessage | CypressSuiteEndMessage | CypressHookStartMessage | CypressHookEndMessage | CypressTestStartMessage | CypressStepStartMessage | CypressStepStopMessage | CypressStepFinalizeMessage | CypressTestPassMessage | CypressFailMessage | CypressTestSkipMessage | CypressSkippedTestMessage | CypressTestEndMessage;
229
+ export type SpecContext = {
230
+ specPath: string;
231
+ test: string | undefined;
232
+ fixture: string | undefined;
233
+ stepsByFrontEndId: Map<string, string>;
234
+ videoScope: string;
235
+ suiteIdToScope: Map<string, string>;
236
+ suiteScopeToId: Map<string, string>;
237
+ suiteScopes: string[];
238
+ testScope: string | undefined;
239
+ suiteNames: string[];
240
+ failed: boolean;
241
+ };
242
+ type StepDescriptorBase = {
243
+ id: string;
244
+ error?: Error;
245
+ };
246
+ export type LogStepDescriptor = StepDescriptorBase & {
247
+ type: "log";
248
+ attachmentName?: string;
249
+ log: CypressLogEntry;
250
+ };
251
+ export type ApiStepDescriptor = StepDescriptorBase & {
252
+ type: "api";
253
+ };
254
+ export type StepDescriptor = LogStepDescriptor | ApiStepDescriptor;
255
+ export type StepFinalizer = (message: CypressStepFinalizeMessage["data"]) => void;
256
+ export type TmsSpecState = {
257
+ config: {
258
+ stepsFromCommands: {
259
+ maxArgumentLength: number;
260
+ maxArgumentDepth: number;
261
+ };
262
+ };
263
+ initialized: boolean;
264
+ testPlan: TestPlanV1 | null | undefined;
265
+ projectDir?: string;
266
+ messages: CypressMessage[];
267
+ currentTest?: CypressTest;
268
+ stepStack: StepDescriptor[];
269
+ stepsToFinalize: [step: StepDescriptor, finalizer: StepFinalizer | undefined][];
270
+ nextApiStepId: number;
271
+ };
272
+ export type TmsCypressTaskArgs = {
273
+ absolutePath: string;
274
+ messages: readonly CypressMessage[];
275
+ isInteractive: boolean;
276
+ };
277
+ export type CypressSuiteFunction = (title: string, configOrFn?: Cypress.SuiteConfigOverrides | ((this: Mocha.Suite) => void), fn?: (this: Mocha.Suite) => void) => Mocha.Suite;
278
+ export type DirectHookImplementation = Mocha.AsyncFunc | ((this: Mocha.Context) => void);
279
+ export type HookImplementation = Mocha.Func | DirectHookImplementation;
280
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Helpers that use Node.js built-in modules. Import only in Node context (e.g. reporter, plugins).
3
+ * Do not import in browser bundle (Cypress support/specs).
4
+ */
5
+ export declare function getProjectRoot(): string;
6
+ export declare function getRelativePath(absolutePath: string): string;
7
+ export declare function getPosixPath(filepath: string): string;
8
+ export interface TestPlanV1 {
9
+ version: "1.0";
10
+ tests: Array<{
11
+ id?: string | number;
12
+ selector?: string;
13
+ }>;
14
+ }
15
+ export declare function parseTestPlan(): TestPlanV1 | undefined;