@wdio/browserstack-service 8.40.6 → 8.41.0
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/build/Percy/Percy.d.ts.map +1 -1
- package/build/Percy/Percy.js +2 -1
- package/build/Percy/PercySDK.d.ts.map +1 -1
- package/build/Percy/PercySDK.js +53 -4
- package/build/accessibility-handler.d.ts +1 -0
- package/build/accessibility-handler.d.ts.map +1 -1
- package/build/accessibility-handler.js +22 -28
- package/build/cleanup.js +4 -4
- package/build/constants.d.ts +6 -3
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +10 -3
- package/build/crash-reporter.js +2 -2
- package/build/exitHandler.js +2 -2
- package/build/insights-handler.d.ts +5 -5
- package/build/insights-handler.d.ts.map +1 -1
- package/build/insights-handler.js +24 -18
- package/build/instrumentation/funnelInstrumentation.d.ts.map +1 -1
- package/build/instrumentation/funnelInstrumentation.js +17 -10
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +89 -65
- package/build/reporter.d.ts +1 -1
- package/build/reporter.d.ts.map +1 -1
- package/build/reporter.js +8 -5
- package/build/scripts/accessibility-scripts.d.ts +2 -7
- package/build/scripts/accessibility-scripts.d.ts.map +1 -1
- package/build/service.d.ts.map +1 -1
- package/build/service.js +21 -19
- package/build/testHub/utils.d.ts +7 -0
- package/build/testHub/utils.d.ts.map +1 -0
- package/build/testHub/utils.js +57 -0
- package/build/testOps/listener.d.ts +6 -0
- package/build/testOps/listener.d.ts.map +1 -1
- package/build/testOps/listener.js +38 -1
- package/build/testOps/requestUtils.js +3 -3
- package/build/types.d.ts +34 -1
- package/build/types.d.ts.map +1 -1
- package/build/util.d.ts +8 -3
- package/build/util.d.ts.map +1 -1
- package/build/util.js +93 -153
- package/package.json +6 -6
- package/tsconfig.prod.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Percy.d.ts","sourceRoot":"","sources":["../../src/Percy/Percy.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"Percy.d.ts","sourceRoot":"","sources":["../../src/Percy/Percy.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAK1C,cAAM,KAAK;;IAWP,gBAAgB,UAAQ;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAO;IAC7B,gBAAgB,UAAQ;IACxB,KAAK,EAAE,OAAO,CAAA;gBAEF,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU;IAiBxG,WAAW;IAYX,KAAK;IA2CL,IAAI;IAWV,SAAS;IAIH,eAAe;IAoCf,iBAAiB;CA8B1B;AAED,eAAe,KAAK,CAAA"}
|
package/build/Percy/Percy.js
CHANGED
|
@@ -5,6 +5,7 @@ import { spawn } from 'node:child_process';
|
|
|
5
5
|
import { nodeRequest, getBrowserStackUser, getBrowserStackKey, sleep } from '../util.js';
|
|
6
6
|
import { PercyLogger } from './PercyLogger.js';
|
|
7
7
|
import PercyBinary from './PercyBinary.js';
|
|
8
|
+
import { BROWSERSTACK_TESTHUB_UUID } from '../constants.js';
|
|
8
9
|
const logDir = 'logs';
|
|
9
10
|
class Percy {
|
|
10
11
|
#logfile = path.join(logDir, 'percy.log');
|
|
@@ -59,7 +60,7 @@ class Percy {
|
|
|
59
60
|
if (configPath) {
|
|
60
61
|
commandArgs.push('-c', configPath);
|
|
61
62
|
}
|
|
62
|
-
this.#proc = spawn(binaryPath, commandArgs, { env: { ...process.env, PERCY_TOKEN: token } });
|
|
63
|
+
this.#proc = spawn(binaryPath, commandArgs, { env: { ...process.env, PERCY_TOKEN: token, TH_BUILD_UUID: process.env[BROWSERSTACK_TESTHUB_UUID] } });
|
|
63
64
|
this.#proc.stdout.pipe(logStream);
|
|
64
65
|
this.#proc.stderr.pipe(logStream);
|
|
65
66
|
this.isProcessRunning = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PercySDK.d.ts","sourceRoot":"","sources":["../../src/Percy/PercySDK.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PercySDK.d.ts","sourceRoot":"","sources":["../../src/Percy/PercySDK.ts"],"names":[],"mappings":"AAsCA,eAAO,MAAM,QAAQ,YApBW,GAAG,EAAE,SAoBE,CAAA;AA2CvC,eAAO,MAAM,UAAU,YARiB,GAAG,EAAE,kBAQF,CAAA;AAW3C,eAAO,MAAM,aAAa,YARiB,GAAG,EAAE,kBAQC,CAAA"}
|
package/build/Percy/PercySDK.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import InsightsHandler from '../insights-handler.js';
|
|
2
|
+
import TestReporter from '../reporter.js';
|
|
1
3
|
import { PercyLogger } from './PercyLogger.js';
|
|
4
|
+
import { isUndefined } from '../util.js';
|
|
2
5
|
const tryRequire = async function (pkg, fallback) {
|
|
3
6
|
try {
|
|
4
7
|
return (await import(pkg)).default;
|
|
@@ -14,19 +17,63 @@ let snapshotHandler = (...args) => {
|
|
|
14
17
|
PercyLogger.error('Unsupported driver for percy');
|
|
15
18
|
};
|
|
16
19
|
if (percySnapshot) {
|
|
17
|
-
snapshotHandler = (browser,
|
|
20
|
+
snapshotHandler = (browser, snapshotName, options) => {
|
|
18
21
|
if (process.env.PERCY_SNAPSHOT === 'true') {
|
|
19
|
-
|
|
22
|
+
let { name, uuid } = InsightsHandler.currentTest;
|
|
23
|
+
if (isUndefined(name)) {
|
|
24
|
+
({ name, uuid } = TestReporter.currentTest);
|
|
25
|
+
}
|
|
26
|
+
options ||= {};
|
|
27
|
+
options = {
|
|
28
|
+
...options,
|
|
29
|
+
testCase: name || '',
|
|
30
|
+
thTestCaseExecutionId: uuid || '',
|
|
31
|
+
};
|
|
32
|
+
return percySnapshot(browser, snapshotName, options);
|
|
20
33
|
}
|
|
21
34
|
};
|
|
22
35
|
}
|
|
23
36
|
export const snapshot = snapshotHandler;
|
|
37
|
+
/*
|
|
38
|
+
This is a helper method which appends some internal fields
|
|
39
|
+
to the options object being sent to Percy methods
|
|
40
|
+
*/
|
|
41
|
+
const screenshotHelper = (type, driverOrName, nameOrOptions, options) => {
|
|
42
|
+
let { name, uuid } = InsightsHandler.currentTest;
|
|
43
|
+
if (isUndefined(name)) {
|
|
44
|
+
({ name, uuid } = TestReporter.currentTest);
|
|
45
|
+
}
|
|
46
|
+
if (!driverOrName || typeof driverOrName === 'string') {
|
|
47
|
+
nameOrOptions ||= {};
|
|
48
|
+
if (typeof nameOrOptions === 'object') {
|
|
49
|
+
nameOrOptions = {
|
|
50
|
+
...nameOrOptions,
|
|
51
|
+
testCase: name || '',
|
|
52
|
+
thTestCaseExecutionId: uuid || '',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
options ||= {};
|
|
58
|
+
options = {
|
|
59
|
+
...options,
|
|
60
|
+
testCase: name || '',
|
|
61
|
+
thTestCaseExecutionId: uuid || '',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (type === 'app') {
|
|
65
|
+
return percyAppScreenshot(driverOrName, nameOrOptions, options);
|
|
66
|
+
}
|
|
67
|
+
return percySnapshot.percyScreenshot(driverOrName, nameOrOptions, options);
|
|
68
|
+
};
|
|
24
69
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
25
70
|
let screenshotHandler = async (...args) => {
|
|
26
71
|
PercyLogger.error('Unsupported driver for percy');
|
|
27
72
|
};
|
|
28
73
|
if (percySnapshot && percySnapshot.percyScreenshot) {
|
|
29
|
-
screenshotHandler =
|
|
74
|
+
screenshotHandler = (browser, screenshotName, options) => {
|
|
75
|
+
return screenshotHelper('web', browser, screenshotName, options);
|
|
76
|
+
};
|
|
30
77
|
}
|
|
31
78
|
export const screenshot = screenshotHandler;
|
|
32
79
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
@@ -34,6 +81,8 @@ let screenshotAppHandler = async (...args) => {
|
|
|
34
81
|
PercyLogger.error('Unsupported driver for percy');
|
|
35
82
|
};
|
|
36
83
|
if (percyAppScreenshot) {
|
|
37
|
-
screenshotAppHandler =
|
|
84
|
+
screenshotAppHandler = (driverOrName, nameOrOptions, options) => {
|
|
85
|
+
return screenshotHelper('app', driverOrName, nameOrOptions, options);
|
|
86
|
+
};
|
|
38
87
|
}
|
|
39
88
|
export const screenshotApp = screenshotAppHandler;
|
|
@@ -14,6 +14,7 @@ declare class _AccessibilityHandler {
|
|
|
14
14
|
private _testMetadata;
|
|
15
15
|
private static _a11yScanSessionMap;
|
|
16
16
|
private _sessionId;
|
|
17
|
+
private listener;
|
|
17
18
|
constructor(_browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser, _capabilities: Capabilities.RemoteCapability, isAppAutomate?: boolean, _framework?: string | undefined, _accessibilityAutomation?: (boolean | string) | undefined, _accessibilityOpts?: {
|
|
18
19
|
[key: string]: any;
|
|
19
20
|
} | undefined);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessibility-handler.d.ts","sourceRoot":"","sources":["../src/accessibility-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"accessibility-handler.d.ts","sourceRoot":"","sources":["../src/accessibility-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAA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;MAEE;IACI,cAAc,CAAE,KAAK,EAAE,sBAAsB;IAqC7C,aAAa,CAAE,KAAK,EAAE,sBAAsB;YAsCpC,cAAc;YAcd,iBAAiB;IAO/B,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,kBAAkB;YAOZ,iBAAiB;IAkB/B,OAAO,CAAC,MAAM,CAAC,wBAAwB;CAU1C;AAGD,QAAA,MAAM,oBAAoB,EAAE,OAAO,qBAAoE,CAAA;AACvG,KAAK,oBAAoB,GAAG,qBAAqB,CAAA;AAEjD,eAAe,oBAAoB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import util from 'node:util';
|
|
2
|
+
import Listener from './testOps/listener.js';
|
|
2
3
|
import { getA11yResultsSummary, getA11yResults, performA11yScan, getUniqueIdentifier, getUniqueIdentifierForCucumber, isAccessibilityAutomationSession, isBrowserstackSession, o11yClassErrorHandler, shouldScanTestForAccessibility, validateCapsWithA11y, isTrue } from './util.js';
|
|
3
4
|
import accessibilityScripts from './scripts/accessibility-scripts.js';
|
|
4
5
|
import { BStackLogger } from './bstackLogger.js';
|
|
@@ -16,6 +17,7 @@ class _AccessibilityHandler {
|
|
|
16
17
|
_testMetadata = {};
|
|
17
18
|
static _a11yScanSessionMap = {};
|
|
18
19
|
_sessionId = null;
|
|
20
|
+
listener = Listener.getInstance();
|
|
19
21
|
constructor(_browser, _capabilities, isAppAutomate, _framework, _accessibilityAutomation, _accessibilityOpts) {
|
|
20
22
|
this._browser = _browser;
|
|
21
23
|
this._capabilities = _capabilities;
|
|
@@ -105,6 +107,8 @@ class _AccessibilityHandler {
|
|
|
105
107
|
try {
|
|
106
108
|
if (this._framework !== 'mocha' ||
|
|
107
109
|
!this.shouldRunTestHooks(this._browser, this._accessibility)) {
|
|
110
|
+
/* This is to be used when test events are sent */
|
|
111
|
+
Listener.setTestRunAccessibilityVar(false);
|
|
108
112
|
return;
|
|
109
113
|
}
|
|
110
114
|
const shouldScanTest = shouldScanTestForAccessibility(suiteTitle, test.title, this._accessibilityOptions);
|
|
@@ -114,6 +118,8 @@ class _AccessibilityHandler {
|
|
|
114
118
|
/* For case with multiple tests under one browser, before hook of 2nd test should change this map value */
|
|
115
119
|
AccessibilityHandler._a11yScanSessionMap[this._sessionId] = shouldScanTest;
|
|
116
120
|
}
|
|
121
|
+
/* This is to be used when test events are sent */
|
|
122
|
+
Listener.setTestRunAccessibilityVar(this._accessibility && shouldScanTest);
|
|
117
123
|
if (!isPageOpened) {
|
|
118
124
|
return;
|
|
119
125
|
}
|
|
@@ -141,19 +147,12 @@ class _AccessibilityHandler {
|
|
|
141
147
|
}
|
|
142
148
|
if (shouldScanTestForAccessibility) {
|
|
143
149
|
BStackLogger.info('Automate test case execution has ended. Processing for accessibility testing is underway. ');
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
'filePath': this._suiteFile,
|
|
151
|
-
'scopeList': [suiteTitle, test.title]
|
|
152
|
-
},
|
|
153
|
-
platform: this._platformA11yMeta
|
|
154
|
-
};
|
|
155
|
-
await this.sendTestStopEvent(this._browser, dataForExtension);
|
|
156
|
-
if (shouldScanTestForAccessibility) {
|
|
150
|
+
const dataForExtension = {
|
|
151
|
+
'thTestRunUuid': process.env.TEST_ANALYTICS_ID,
|
|
152
|
+
'thBuildUuid': process.env.BROWSERSTACK_TESTHUB_UUID,
|
|
153
|
+
'thJwtToken': process.env.BROWSERSTACK_TESTHUB_JWT
|
|
154
|
+
};
|
|
155
|
+
await this.sendTestStopEvent(this._browser, dataForExtension);
|
|
157
156
|
BStackLogger.info('Accessibility testing for this test case has ended.');
|
|
158
157
|
}
|
|
159
158
|
}
|
|
@@ -170,6 +169,8 @@ class _AccessibilityHandler {
|
|
|
170
169
|
const featureData = gherkinDocument.feature;
|
|
171
170
|
const uniqueId = getUniqueIdentifierForCucumber(world);
|
|
172
171
|
if (!this.shouldRunTestHooks(this._browser, this._accessibility)) {
|
|
172
|
+
/* This is to be used when test events are sent */
|
|
173
|
+
Listener.setTestRunAccessibilityVar(false);
|
|
173
174
|
return;
|
|
174
175
|
}
|
|
175
176
|
try {
|
|
@@ -179,6 +180,8 @@ class _AccessibilityHandler {
|
|
|
179
180
|
/* For case with multiple tests under one browser, before hook of 2nd test should change this map value */
|
|
180
181
|
AccessibilityHandler._a11yScanSessionMap[this._sessionId] = shouldScanScenario;
|
|
181
182
|
}
|
|
183
|
+
/* This is to be used when test events are sent */
|
|
184
|
+
Listener.setTestRunAccessibilityVar(this._accessibility && shouldScanScenario);
|
|
182
185
|
if (!isPageOpened) {
|
|
183
186
|
return;
|
|
184
187
|
}
|
|
@@ -198,8 +201,6 @@ class _AccessibilityHandler {
|
|
|
198
201
|
}
|
|
199
202
|
const pickleData = world.pickle;
|
|
200
203
|
try {
|
|
201
|
-
const gherkinDocument = world.gherkinDocument;
|
|
202
|
-
const featureData = gherkinDocument.feature;
|
|
203
204
|
const uniqueId = getUniqueIdentifierForCucumber(world);
|
|
204
205
|
const accessibilityScanStarted = this._testMetadata[uniqueId]?.accessibilityScanStarted;
|
|
205
206
|
const shouldScanTestForAccessibility = this._testMetadata[uniqueId]?.scanTestForAccessibility;
|
|
@@ -208,19 +209,12 @@ class _AccessibilityHandler {
|
|
|
208
209
|
}
|
|
209
210
|
if (shouldScanTestForAccessibility) {
|
|
210
211
|
BStackLogger.info('Automate test case execution has ended. Processing for accessibility testing is underway. ');
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
'filePath': gherkinDocument.uri,
|
|
218
|
-
'scopeList': [featureData?.name, pickleData.name]
|
|
219
|
-
},
|
|
220
|
-
platform: this._platformA11yMeta
|
|
221
|
-
};
|
|
222
|
-
await this.sendTestStopEvent(this._browser, dataForExtension);
|
|
223
|
-
if (shouldScanTestForAccessibility) {
|
|
212
|
+
const dataForExtension = {
|
|
213
|
+
'thTestRunUuid': process.env.TEST_ANALYTICS_ID,
|
|
214
|
+
'thBuildUuid': process.env.BROWSERSTACK_TESTHUB_UUID,
|
|
215
|
+
'thJwtToken': process.env.BROWSERSTACK_TESTHUB_JWT
|
|
216
|
+
};
|
|
217
|
+
await this.sendTestStopEvent(this._browser, dataForExtension);
|
|
224
218
|
BStackLogger.info('Accessibility testing for this test case has ended.');
|
|
225
219
|
}
|
|
226
220
|
}
|
package/build/cleanup.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getErrorString, stopBuildUpstream } from './util.js';
|
|
|
2
2
|
import { BStackLogger } from './bstackLogger.js';
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import { fireFunnelRequest } from './instrumentation/funnelInstrumentation.js';
|
|
5
|
-
import {
|
|
5
|
+
import { BROWSERSTACK_TESTHUB_UUID, BROWSERSTACK_TESTHUB_JWT, BROWSERSTACK_OBSERVABILITY } from './constants.js';
|
|
6
6
|
export default class BStackCleanup {
|
|
7
7
|
static async startCleanup() {
|
|
8
8
|
try {
|
|
@@ -27,15 +27,15 @@ export default class BStackCleanup {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
static async executeObservabilityCleanup(funnelData) {
|
|
30
|
-
if (!process.env[
|
|
30
|
+
if (!process.env[BROWSERSTACK_TESTHUB_JWT]) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
BStackLogger.debug('Executing observability cleanup');
|
|
34
34
|
try {
|
|
35
35
|
const killSignal = funnelData?.event_properties?.finishedMetadata?.signal;
|
|
36
36
|
const result = await stopBuildUpstream(killSignal);
|
|
37
|
-
if (process.env[
|
|
38
|
-
BStackLogger.info(`\nVisit https://observability.browserstack.com/builds/${process.env[
|
|
37
|
+
if (process.env[BROWSERSTACK_OBSERVABILITY] && process.env[BROWSERSTACK_TESTHUB_UUID]) {
|
|
38
|
+
BStackLogger.info(`\nVisit https://observability.browserstack.com/builds/${process.env[BROWSERSTACK_TESTHUB_UUID]} to view build report, insights, and many more debugging information all at one place!\n`);
|
|
39
39
|
}
|
|
40
40
|
const status = (result && result.status) || 'failed';
|
|
41
41
|
const message = (result && result.message);
|
package/build/constants.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export declare const BATCH_EVENT_TYPES: string[];
|
|
|
13
13
|
export declare const DEFAULT_WAIT_TIMEOUT_FOR_PENDING_UPLOADS = 5000;
|
|
14
14
|
export declare const DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS = 100;
|
|
15
15
|
export declare const BSTACK_SERVICE_VERSION: any;
|
|
16
|
-
export declare const ACCESSIBILITY_API_URL = "https://accessibility.browserstack.com/api";
|
|
17
16
|
export declare const NOT_ALLOWED_KEYS_IN_CAPS: string[];
|
|
18
17
|
export declare const LOGS_FILE = "logs/bstack-wdio-service.log";
|
|
19
18
|
export declare const UPLOAD_LOGS_ADDRESS = "https://upload-observability.browserstack.com";
|
|
@@ -34,14 +33,18 @@ export declare const TCG_INFO: {
|
|
|
34
33
|
tcgRegion: string;
|
|
35
34
|
tcgUrl: string;
|
|
36
35
|
};
|
|
37
|
-
export declare const
|
|
36
|
+
export declare const BROWSERSTACK_TESTHUB_JWT = "BROWSERSTACK_TESTHUB_JWT";
|
|
38
37
|
export declare const BSTACK_TCG_AUTH_RESULT = "BSTACK_TCG_AUTH_RESULT";
|
|
39
38
|
export declare const TESTOPS_SCREENSHOT_ENV = "BS_TESTOPS_ALLOW_SCREENSHOTS";
|
|
40
|
-
export declare const
|
|
39
|
+
export declare const BROWSERSTACK_TESTHUB_UUID = "BROWSERSTACK_TESTHUB_UUID";
|
|
40
|
+
export declare const TEST_ANALYTICS_ID = "TEST_ANALYTICS_ID";
|
|
41
41
|
export declare const PERF_MEASUREMENT_ENV = "BROWSERSTACK_O11Y_PERF_MEASUREMENT";
|
|
42
42
|
export declare const RERUN_TESTS_ENV = "BROWSERSTACK_RERUN_TESTS";
|
|
43
43
|
export declare const RERUN_ENV = "BROWSERSTACK_RERUN";
|
|
44
44
|
export declare const TESTOPS_BUILD_COMPLETED_ENV = "BS_TESTOPS_BUILD_COMPLETED";
|
|
45
|
+
export declare const BROWSERSTACK_PERCY = "BROWSERSTACK_PERCY";
|
|
46
|
+
export declare const BROWSERSTACK_ACCESSIBILITY = "BROWSERSTACK_ACCESSIBILITY";
|
|
47
|
+
export declare const BROWSERSTACK_OBSERVABILITY = "BROWSERSTACK_OBSERVABILITY";
|
|
45
48
|
export declare const MAX_GIT_META_DATA_SIZE_IN_BYTES: number;
|
|
46
49
|
export declare const GIT_META_DATA_TRUNCATED = "...[TRUNCATED]";
|
|
47
50
|
//# sourceMappingURL=constants.d.ts.map
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAKpD,eAAO,MAAM,mBAAmB,qHAStB,CAAA;AAEV,eAAO,MAAM,mBAAmB,UAI/B,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,kBAAkB,CAKvD,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,OAAO,OAAoC,CAAA;AAEvE,eAAO,MAAM,aAAa,qDAAqD,CAAA;AAC/E,eAAO,MAAM,mBAAmB,iBAAiB,CAAA;AACjD,eAAO,MAAM,mBAAmB,iBAAiB,CAAA;AACjD,eAAO,MAAM,wBAAwB,uBAAuB,CAAA;AAC5D,eAAO,MAAM,eAAe,OAAO,CAAA;AACnC,eAAO,MAAM,mBAAmB,OAAO,CAAA;AACvC,eAAO,MAAM,iBAAiB,UAAgH,CAAA;AAC9I,eAAO,MAAM,wCAAwC,OAAO,CAAA;AAC5D,eAAO,MAAM,yCAAyC,MAAM,CAAA;AAC5D,eAAO,MAAM,sBAAsB,KAAuB,CAAA;AAE1D,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":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sBAAsB,iCAAiC,CAAA;AAGpE,eAAO,MAAM,yBAAyB,8BAA8B,CAAA;AAGpE,eAAO,MAAM,iBAAiB,sBAAsB,CAAA;AAGpD,eAAO,MAAM,oBAAoB,uCAAuC,CAAA;AAGxE,eAAO,MAAM,eAAe,6BAA6B,CAAA;AAGzD,eAAO,MAAM,SAAS,uBAAuB,CAAA;AAG7C,eAAO,MAAM,2BAA2B,+BAA+B,CAAA;AAGvE,eAAO,MAAM,kBAAkB,uBAAuB,CAAA;AAGtD,eAAO,MAAM,0BAA0B,+BAA+B,CAAA;AAGtE,eAAO,MAAM,0BAA0B,+BAA+B,CAAA;AAGtE,eAAO,MAAM,+BAA+B,QAAY,CAAA;AAKxD,eAAO,MAAM,uBAAuB,mBAAmB,CAAA"}
|
package/build/constants.js
CHANGED
|
@@ -33,7 +33,6 @@ export const BATCH_EVENT_TYPES = ['LogCreated', 'TestRunStarted', 'TestRunFinish
|
|
|
33
33
|
export const DEFAULT_WAIT_TIMEOUT_FOR_PENDING_UPLOADS = 5000; // 5s
|
|
34
34
|
export const DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS = 100; // 100ms
|
|
35
35
|
export const BSTACK_SERVICE_VERSION = bstackServiceVersion;
|
|
36
|
-
export const ACCESSIBILITY_API_URL = 'https://accessibility.browserstack.com/api';
|
|
37
36
|
export const NOT_ALLOWED_KEYS_IN_CAPS = ['includeTagsInTestingScope', 'excludeTagsInTestingScope'];
|
|
38
37
|
export const LOGS_FILE = 'logs/bstack-wdio-service.log';
|
|
39
38
|
export const UPLOAD_LOGS_ADDRESS = 'https://upload-observability.browserstack.com';
|
|
@@ -64,13 +63,15 @@ export const TCG_INFO = {
|
|
|
64
63
|
};
|
|
65
64
|
// Env variables - Define all the env variable constants over here
|
|
66
65
|
// To store the JWT token returned the session launch
|
|
67
|
-
export const
|
|
66
|
+
export const BROWSERSTACK_TESTHUB_JWT = 'BROWSERSTACK_TESTHUB_JWT';
|
|
68
67
|
// To store tcg auth result for selfHealing feature:
|
|
69
68
|
export const BSTACK_TCG_AUTH_RESULT = 'BSTACK_TCG_AUTH_RESULT';
|
|
70
69
|
// To store the setting of whether to send screenshots or not
|
|
71
70
|
export const TESTOPS_SCREENSHOT_ENV = 'BS_TESTOPS_ALLOW_SCREENSHOTS';
|
|
72
71
|
// To store build hashed id
|
|
73
|
-
export const
|
|
72
|
+
export const BROWSERSTACK_TESTHUB_UUID = 'BROWSERSTACK_TESTHUB_UUID';
|
|
73
|
+
// To store test run uuid
|
|
74
|
+
export const TEST_ANALYTICS_ID = 'TEST_ANALYTICS_ID';
|
|
74
75
|
// Whether to collect performance instrumentation or not
|
|
75
76
|
export const PERF_MEASUREMENT_ENV = 'BROWSERSTACK_O11Y_PERF_MEASUREMENT';
|
|
76
77
|
// Whether the current run is rerun or not
|
|
@@ -79,6 +80,12 @@ export const RERUN_TESTS_ENV = 'BROWSERSTACK_RERUN_TESTS';
|
|
|
79
80
|
export const RERUN_ENV = 'BROWSERSTACK_RERUN';
|
|
80
81
|
// To store whether the build launch has completed or not
|
|
81
82
|
export const TESTOPS_BUILD_COMPLETED_ENV = 'BS_TESTOPS_BUILD_COMPLETED';
|
|
83
|
+
// Whether percy has started successfully or not
|
|
84
|
+
export const BROWSERSTACK_PERCY = 'BROWSERSTACK_PERCY';
|
|
85
|
+
// Whether session is a accessibility session
|
|
86
|
+
export const BROWSERSTACK_ACCESSIBILITY = 'BROWSERSTACK_ACCESSIBILITY';
|
|
87
|
+
// Whether session is a observability session
|
|
88
|
+
export const BROWSERSTACK_OBSERVABILITY = 'BROWSERSTACK_OBSERVABILITY';
|
|
82
89
|
// Maximum size of VCS info which is allowed
|
|
83
90
|
export const MAX_GIT_META_DATA_SIZE_IN_BYTES = 64 * 1024;
|
|
84
91
|
/* The value to be appended at the end if git metadata is larger than
|
package/build/crash-reporter.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import got from 'got';
|
|
2
|
-
import { BSTACK_SERVICE_VERSION, DATA_ENDPOINT,
|
|
2
|
+
import { BSTACK_SERVICE_VERSION, DATA_ENDPOINT, BROWSERSTACK_TESTHUB_UUID } from './constants.js';
|
|
3
3
|
import { DEFAULT_REQUEST_CONFIG, getObservabilityKey, getObservabilityUser } from './util.js';
|
|
4
4
|
import { BStackLogger } from './bstackLogger.js';
|
|
5
5
|
export default class CrashReporter {
|
|
@@ -52,7 +52,7 @@ export default class CrashReporter {
|
|
|
52
52
|
this.userConfigForReporting = {};
|
|
53
53
|
}
|
|
54
54
|
const data = {
|
|
55
|
-
hashed_id: process.env[
|
|
55
|
+
hashed_id: process.env[BROWSERSTACK_TESTHUB_UUID],
|
|
56
56
|
observability_version: {
|
|
57
57
|
frameworkName: 'WebdriverIO-' + (this.userConfigForReporting.framework || 'null'),
|
|
58
58
|
sdkVersion: BSTACK_SERVICE_VERSION
|
package/build/exitHandler.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import BrowserStackConfig from './config.js';
|
|
4
4
|
import { saveFunnelData } from './instrumentation/funnelInstrumentation.js';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import {
|
|
6
|
+
import { BROWSERSTACK_TESTHUB_JWT } from './constants.js';
|
|
7
7
|
import { BStackLogger } from './bstackLogger.js';
|
|
8
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
9
|
const __dirname = path.dirname(__filename);
|
|
@@ -42,7 +42,7 @@ export function setupExitHandlers() {
|
|
|
42
42
|
}
|
|
43
43
|
export function shouldCallCleanup(config) {
|
|
44
44
|
const args = [];
|
|
45
|
-
if (!!process.env[
|
|
45
|
+
if (!!process.env[BROWSERSTACK_TESTHUB_JWT] && !config.testObservability.buildStopped) {
|
|
46
46
|
args.push('--observability');
|
|
47
47
|
}
|
|
48
48
|
if (config.userName && config.accessKey && !config.funnelDataSent) {
|
|
@@ -2,7 +2,7 @@ import type { Frameworks, Options } from '@wdio/types';
|
|
|
2
2
|
import type { BeforeCommandArgs, AfterCommandArgs } from '@wdio/reporter';
|
|
3
3
|
import type { Feature, Scenario, CucumberHook, CucumberHookParams, Pickle, ITestCaseHookParameter } from './cucumber-types.js';
|
|
4
4
|
import type { BrowserstackConfig } from './types.js';
|
|
5
|
-
import type { TestData, TestMeta, CurrentRunInfo, StdLog } from './types.js';
|
|
5
|
+
import type { TestData, TestMeta, CurrentRunInfo, StdLog, CBTData } from './types.js';
|
|
6
6
|
import type { Capabilities } from '@wdio/types';
|
|
7
7
|
declare class _InsightsHandler {
|
|
8
8
|
private _browser;
|
|
@@ -13,13 +13,13 @@ declare class _InsightsHandler {
|
|
|
13
13
|
private _commands;
|
|
14
14
|
private _gitConfigPath?;
|
|
15
15
|
private _suiteFile?;
|
|
16
|
-
|
|
16
|
+
static currentTest: CurrentRunInfo;
|
|
17
17
|
private _currentHook;
|
|
18
18
|
private _cucumberData;
|
|
19
19
|
private _userCaps?;
|
|
20
20
|
private listener;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
currentTestId: string | undefined;
|
|
22
|
+
cbtQueue: Array<CBTData>;
|
|
23
23
|
constructor(_browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser, _framework?: string | undefined, _userCaps?: Capabilities.RemoteCapability, _options?: BrowserstackConfig & Options.Testrunner);
|
|
24
24
|
_isAppAutomate(): boolean;
|
|
25
25
|
registerListeners(): void;
|
|
@@ -57,7 +57,7 @@ declare class _InsightsHandler {
|
|
|
57
57
|
private getTestRunId;
|
|
58
58
|
private getTestRunIdFromSuite;
|
|
59
59
|
private getTestRunDataForCucumber;
|
|
60
|
-
|
|
60
|
+
flushCBTDataQueue(): Promise<void>;
|
|
61
61
|
sendCBTInfo(): Promise<void>;
|
|
62
62
|
private getIntegrationsObject;
|
|
63
63
|
private getIdentifier;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insights-handler.d.ts","sourceRoot":"","sources":["../src/insights-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE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
15
|
_gitConfigPath;
|
|
16
16
|
_suiteFile;
|
|
17
|
-
|
|
17
|
+
static currentTest = {};
|
|
18
18
|
_currentHook = {};
|
|
19
19
|
_cucumberData = {
|
|
20
20
|
stepsStarted: false,
|
|
@@ -23,8 +23,8 @@ class _InsightsHandler {
|
|
|
23
23
|
};
|
|
24
24
|
_userCaps = {};
|
|
25
25
|
listener = Listener.getInstance();
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
currentTestId;
|
|
27
|
+
cbtQueue = [];
|
|
28
28
|
constructor(_browser, _framework, _userCaps, _options) {
|
|
29
29
|
this._browser = _browser;
|
|
30
30
|
this._framework = _framework;
|
|
@@ -165,7 +165,7 @@ class _InsightsHandler {
|
|
|
165
165
|
const hookMetaData = {
|
|
166
166
|
uuid: hookUUID,
|
|
167
167
|
startedAt: (new Date()).toISOString(),
|
|
168
|
-
testRunId:
|
|
168
|
+
testRunId: InsightsHandler.currentTest.uuid,
|
|
169
169
|
hookType: hookType
|
|
170
170
|
};
|
|
171
171
|
this._tests[hookId] = hookMetaData;
|
|
@@ -309,7 +309,7 @@ class _InsightsHandler {
|
|
|
309
309
|
}
|
|
310
310
|
async beforeTest(test) {
|
|
311
311
|
const uuid = uuidv4();
|
|
312
|
-
|
|
312
|
+
InsightsHandler.currentTest = {
|
|
313
313
|
test, uuid
|
|
314
314
|
};
|
|
315
315
|
if (this._framework !== 'mocha') {
|
|
@@ -345,7 +345,7 @@ class _InsightsHandler {
|
|
|
345
345
|
}
|
|
346
346
|
async beforeScenario(world) {
|
|
347
347
|
const uuid = uuidv4();
|
|
348
|
-
|
|
348
|
+
InsightsHandler.currentTest = {
|
|
349
349
|
uuid
|
|
350
350
|
};
|
|
351
351
|
this._cucumberData.scenario = world.pickle;
|
|
@@ -427,8 +427,8 @@ class _InsightsHandler {
|
|
|
427
427
|
if (this._currentHook.uuid && !this._currentHook.finished && (this._framework === 'mocha' || this._framework === 'cucumber')) {
|
|
428
428
|
stdLog.hook_run_uuid = this._currentHook.uuid;
|
|
429
429
|
}
|
|
430
|
-
else if (
|
|
431
|
-
stdLog.test_run_uuid =
|
|
430
|
+
else if (InsightsHandler.currentTest.uuid && (this._framework === 'mocha' || this._framework === 'cucumber')) {
|
|
431
|
+
stdLog.test_run_uuid = InsightsHandler.currentTest.uuid;
|
|
432
432
|
}
|
|
433
433
|
if (stdLog.hook_run_uuid || stdLog.test_run_uuid) {
|
|
434
434
|
this.listener.logCreated([stdLog]);
|
|
@@ -540,7 +540,10 @@ class _InsightsHandler {
|
|
|
540
540
|
const fullTitle = getUniqueIdentifier(test, this._framework);
|
|
541
541
|
const testMetaData = this._tests[fullTitle];
|
|
542
542
|
const filename = test.file || this._suiteFile;
|
|
543
|
-
this.
|
|
543
|
+
this.currentTestId = testMetaData.uuid;
|
|
544
|
+
if (eventType === 'TestRunStarted') {
|
|
545
|
+
InsightsHandler.currentTest.name = test.title || test.description;
|
|
546
|
+
}
|
|
544
547
|
const testData = {
|
|
545
548
|
uuid: testMetaData.uuid,
|
|
546
549
|
type: test.type || 'test',
|
|
@@ -565,7 +568,7 @@ class _InsightsHandler {
|
|
|
565
568
|
if (!passed) {
|
|
566
569
|
testData.result = (error && error.message && error.message.includes('sync skip; aborting execution')) ? 'ignore' : 'failed';
|
|
567
570
|
if (error && testData.result !== 'skipped') {
|
|
568
|
-
testData.failure = [{ backtrace: [removeAnsiColors(error.message)] }]; // add all errors here
|
|
571
|
+
testData.failure = [{ backtrace: [removeAnsiColors(error.message), removeAnsiColors(error.stack || '')] }]; // add all errors here
|
|
569
572
|
testData.failure_reason = removeAnsiColors(error.message);
|
|
570
573
|
testData.failure_type = isUndefined(error.message) ? null : error.message.toString().match(/AssertionError/) ? 'AssertionError' : 'UnhandledError'; //verify if this is working
|
|
571
574
|
}
|
|
@@ -642,7 +645,10 @@ class _InsightsHandler {
|
|
|
642
645
|
else {
|
|
643
646
|
fullNameWithExamples = scenario?.name || '';
|
|
644
647
|
}
|
|
645
|
-
this.
|
|
648
|
+
this.currentTestId = uuid;
|
|
649
|
+
if (eventType === 'TestRunStarted') {
|
|
650
|
+
InsightsHandler.currentTest.name = fullNameWithExamples;
|
|
651
|
+
}
|
|
646
652
|
const testData = {
|
|
647
653
|
uuid: uuid,
|
|
648
654
|
started_at: startedAt,
|
|
@@ -708,14 +714,14 @@ class _InsightsHandler {
|
|
|
708
714
|
return testData;
|
|
709
715
|
}
|
|
710
716
|
async flushCBTDataQueue() {
|
|
711
|
-
if (isUndefined(this.
|
|
717
|
+
if (isUndefined(this.currentTestId)) {
|
|
712
718
|
return;
|
|
713
719
|
}
|
|
714
|
-
this.
|
|
715
|
-
cbtData.uuid = this.
|
|
720
|
+
this.cbtQueue.forEach(cbtData => {
|
|
721
|
+
cbtData.uuid = this.currentTestId;
|
|
716
722
|
this.listener.cbtSessionCreated(cbtData);
|
|
717
723
|
});
|
|
718
|
-
this.
|
|
724
|
+
this.currentTestId = undefined; // set undefined for next test
|
|
719
725
|
}
|
|
720
726
|
async sendCBTInfo() {
|
|
721
727
|
const integrationsData = {};
|
|
@@ -727,12 +733,12 @@ class _InsightsHandler {
|
|
|
727
733
|
uuid: '',
|
|
728
734
|
integrations: integrationsData
|
|
729
735
|
};
|
|
730
|
-
if (this.
|
|
731
|
-
cbtData.uuid = this.
|
|
736
|
+
if (this.currentTestId !== undefined) {
|
|
737
|
+
cbtData.uuid = this.currentTestId;
|
|
732
738
|
this.listener.cbtSessionCreated(cbtData);
|
|
733
739
|
}
|
|
734
740
|
else {
|
|
735
|
-
this.
|
|
741
|
+
this.cbtQueue.push(cbtData);
|
|
736
742
|
}
|
|
737
743
|
}
|
|
738
744
|
getIntegrationsObject() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"funnelInstrumentation.d.ts","sourceRoot":"","sources":["../../src/instrumentation/funnelInstrumentation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,kBAAkB,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"funnelInstrumentation.d.ts","sourceRoot":"","sources":["../../src/instrumentation/funnelInstrumentation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,kBAAkB,MAAM,cAAc,CAAA;AAIlD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAoBpE,wBAAsB,SAAS,CAAC,MAAM,EAAE,kBAAkB,iBAIzD;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,kBAAkB,iBAE1D;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAOpF;AAeD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAShE;AA8ID,wBAAgB,4BAA4B,CACxC,UAAU,EAAE,mBAAmB,CAAC,iBAAiB,GAAG,mBAAmB,CAAC,mBAAmB,EAC3F,MAAM,EAAE,kBAAkB,EAC1B,iBAAiB,EAAE,OAAO,GAAG,SAAS,QA6BzC"}
|
|
@@ -8,6 +8,7 @@ import TestOpsConfig from '../testOps/testOpsConfig.js';
|
|
|
8
8
|
import { BStackLogger } from '../bstackLogger.js';
|
|
9
9
|
import { BSTACK_SERVICE_VERSION, FUNNEL_INSTRUMENTATION_URL } from '../constants.js';
|
|
10
10
|
import { getDataFromWorkers, removeWorkersDataDir } from '../data-store.js';
|
|
11
|
+
import { getProductMap } from '../testHub/utils.js';
|
|
11
12
|
async function fireFunnelTestEvent(eventType, config) {
|
|
12
13
|
if (!config.userName || !config.accessKey) {
|
|
13
14
|
BStackLogger.debug('username/accesskey not passed');
|
|
@@ -40,13 +41,26 @@ export function saveFunnelData(eventType, config) {
|
|
|
40
41
|
fs.writeFileSync(filePath, JSON.stringify(data));
|
|
41
42
|
return filePath;
|
|
42
43
|
}
|
|
44
|
+
function redactCredentialsFromFunnelData(data) {
|
|
45
|
+
if (data) {
|
|
46
|
+
if (data.userName) {
|
|
47
|
+
data.userName = '[REDACTED]';
|
|
48
|
+
}
|
|
49
|
+
if (data.accessKey) {
|
|
50
|
+
data.accessKey = '[REDACTED]';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
43
55
|
// Called from two different process
|
|
44
56
|
export async function fireFunnelRequest(data) {
|
|
57
|
+
const { userName, accessKey } = data;
|
|
58
|
+
redactCredentialsFromFunnelData(data);
|
|
45
59
|
BStackLogger.debug('Sending SDK event with data ' + util.inspect(data, { depth: 6 }));
|
|
46
60
|
await got.post(FUNNEL_INSTRUMENTATION_URL, {
|
|
47
61
|
headers: {
|
|
48
62
|
'content-type': 'application/json'
|
|
49
|
-
}, username:
|
|
63
|
+
}, username: userName, password: accessKey, json: data
|
|
50
64
|
});
|
|
51
65
|
}
|
|
52
66
|
function getProductList(config) {
|
|
@@ -68,15 +82,6 @@ function getProductList(config) {
|
|
|
68
82
|
}
|
|
69
83
|
return products;
|
|
70
84
|
}
|
|
71
|
-
function getProductMap(config) {
|
|
72
|
-
return {
|
|
73
|
-
'observability': config.testObservability.enabled,
|
|
74
|
-
'accessibility': config.accessibility,
|
|
75
|
-
'percy': config.percy,
|
|
76
|
-
'automate': config.automate,
|
|
77
|
-
'app_automate': config.appAutomate
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
85
|
function buildEventData(eventType, config) {
|
|
81
86
|
const eventProperties = {
|
|
82
87
|
// Framework Details
|
|
@@ -101,6 +106,8 @@ function buildEventData(eventType, config) {
|
|
|
101
106
|
if (eventType === 'SDKTestSuccessful') {
|
|
102
107
|
const workerData = getDataFromWorkers();
|
|
103
108
|
eventProperties.productUsage = getProductUsage(workerData);
|
|
109
|
+
eventProperties.isPercyAutoEnabled = config.isPercyAutoEnabled;
|
|
110
|
+
eventProperties.percyBuildId = config.percyBuildId;
|
|
104
111
|
if (config.killSignal) {
|
|
105
112
|
eventProperties.finishedMetadata = {
|
|
106
113
|
reason: 'user_killed',
|
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAKlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,GAAG,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAKlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,GAAG,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAoCxH,KAAK,iBAAiB,GAAG,yBAAyB,CAAC,KAAK,GAAG;IACvD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAA;CAC9C,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,2BAA4B,YAAW,QAAQ,CAAC,eAAe;IAY5E,OAAO,CAAC,QAAQ;IAEhB,OAAO,CAAC,OAAO;IAbnB,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,YAAY,CAAC,CAAQ;IAC7B,OAAO,CAAC,SAAS,CAAC,CAAQ;IAC1B,OAAO,CAAC,gBAAgB,CAAC,CAAQ;IACjC,OAAO,CAAC,wBAAwB,CAAC,CAAS;IAC1C,OAAO,CAAC,MAAM,CAAC,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