@wdio/browserstack-service 8.16.17 → 8.16.19

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.
@@ -1,14 +1,18 @@
1
1
  import type { Capabilities, Options } from '@wdio/types';
2
2
  import type { BrowserstackConfig, UserConfigforReporting } from './types.js';
3
+ type Dict = Record<string, any>;
3
4
  export default class CrashReporter {
4
5
  static userConfigForReporting: UserConfigforReporting;
5
6
  private static credentialsForCrashReportUpload;
6
7
  static setCredentialsForCrashReportUpload(options: BrowserstackConfig & Options.Testrunner, config: Options.Testrunner): void;
7
8
  static setConfigDetails(userConfig: Options.Testrunner, capabilities: Capabilities.RemoteCapability, options: BrowserstackConfig & Options.Testrunner): void;
8
9
  static uploadCrashReport(exception: any, stackTrace: string): Promise<void>;
10
+ static recursivelyRedactKeysFromObject(obj: Dict | Array<Dict>, keys: string[]): void;
9
11
  static deletePIIKeysFromObject(obj: {
10
12
  [key: string]: any;
11
13
  }): void;
14
+ static filterCapabilities(capabilities: Capabilities.RemoteCapability): any;
12
15
  static filterPII(userConfig: Options.Testrunner): any;
13
16
  }
17
+ export {};
14
18
  //# sourceMappingURL=crash-reporter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"crash-reporter.d.ts","sourceRoot":"","sources":["../src/crash-reporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAIxD,OAAO,KAAK,EAAE,kBAAkB,EAAmC,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAK7G,MAAM,CAAC,OAAO,OAAO,aAAa;IAE9B,OAAc,sBAAsB,EAAE,sBAAsB,CAAK;IAEjE,OAAO,CAAC,MAAM,CAAC,+BAA+B,CAAsC;IAEpF,MAAM,CAAC,kCAAkC,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU;IAQtH,MAAM,CA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iB9E,MAAM,CAAC,uBAAuB,CAAC,GAAG,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC;IAOxD,MAAM,CAAC,kBAAkB,CAAC,YAAY,EAAE,YAAY,CAAC,gBAAgB;IAMrE,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU;CAyBlD"}
@@ -17,10 +17,11 @@ export default class CrashReporter {
17
17
  }
18
18
  static setConfigDetails(userConfig, capabilities, options) {
19
19
  const configWithoutPII = this.filterPII(userConfig);
20
+ const filteredCapabilities = this.filterCapabilities(capabilities);
20
21
  this.userConfigForReporting = {
21
22
  framework: userConfig.framework,
22
23
  services: configWithoutPII.services,
23
- capabilities: capabilities,
24
+ capabilities: filteredCapabilities,
24
25
  env: {
25
26
  'BROWSERSTACK_BUILD': process.env.BROWSERSTACK_BUILD,
26
27
  'BROWSERSTACK_BUILD_NAME': process.env.BROWSERSTACK_BUILD_NAME,
@@ -74,12 +75,35 @@ export default class CrashReporter {
74
75
  log.error(`[Crash_Report_Upload] Failed due to ${error}`);
75
76
  });
76
77
  }
78
+ static recursivelyRedactKeysFromObject(obj, keys) {
79
+ if (!obj) {
80
+ return;
81
+ }
82
+ if (Array.isArray(obj)) {
83
+ obj.map(ele => this.recursivelyRedactKeysFromObject(ele, keys));
84
+ }
85
+ else {
86
+ for (const prop in obj) {
87
+ if (keys.includes(prop.toLowerCase())) {
88
+ obj[prop] = '[REDACTED]';
89
+ }
90
+ else if (typeof obj[prop] === 'object') {
91
+ this.recursivelyRedactKeysFromObject(obj[prop], keys);
92
+ }
93
+ }
94
+ }
95
+ }
77
96
  static deletePIIKeysFromObject(obj) {
78
97
  if (!obj) {
79
98
  return;
80
99
  }
81
100
  ['user', 'username', 'key', 'accessKey'].forEach(key => delete obj[key]);
82
101
  }
102
+ static filterCapabilities(capabilities) {
103
+ const capsCopy = JSON.parse(JSON.stringify(capabilities));
104
+ this.recursivelyRedactKeysFromObject(capsCopy, ['extensions']);
105
+ return capsCopy;
106
+ }
83
107
  static filterPII(userConfig) {
84
108
  const configWithoutPII = JSON.parse(JSON.stringify(userConfig));
85
109
  this.deletePIIKeysFromObject(configWithoutPII);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/browserstack-service",
3
- "version": "8.16.17",
3
+ "version": "8.16.19",
4
4
  "description": "WebdriverIO service for better Browserstack integration",
5
5
  "author": "Adam Bjerstedt <abjerstedt@gmail.com>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browserstack-service",
@@ -41,7 +41,7 @@
41
41
  "gitconfiglocal": "^2.1.0",
42
42
  "got": "^ 12.6.1",
43
43
  "uuid": "^9.0.0",
44
- "webdriverio": "8.16.17",
44
+ "webdriverio": "8.16.19",
45
45
  "winston-transport": "^4.5.0"
46
46
  },
47
47
  "peerDependencies": {
@@ -49,10 +49,10 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^20.1.0",
52
- "@wdio/globals": "8.16.17"
52
+ "@wdio/globals": "8.16.19"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "5bb4539c96e11a7ece83630b30c0a54903b55c0e"
57
+ "gitHead": "d05091c0a00cbe739f68ad8fd1fdcf577855002a"
58
58
  }