@testim/testim-cli 3.198.0 → 3.199.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.
@@ -2033,9 +2033,9 @@
2033
2033
  "dev": true
2034
2034
  },
2035
2035
  "caniuse-lite": {
2036
- "version": "1.0.30001278",
2037
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001278.tgz",
2038
- "integrity": "sha512-mpF9KeH8u5cMoEmIic/cr7PNS+F5LWBk0t2ekGT60lFf0Wq+n9LspAj0g3P+o7DQhD3sUdlMln4YFAWhFYn9jg==",
2036
+ "version": "1.0.30001279",
2037
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001279.tgz",
2038
+ "integrity": "sha512-VfEHpzHEXj6/CxggTwSFoZBBYGQfQv9Cf42KPlO79sWXCD1QNKWKsKzFeWL7QpZHJQYAvocqV6Rty1yJMkqWLQ==",
2039
2039
  "dev": true
2040
2040
  },
2041
2041
  "caseless": {
@@ -2200,9 +2200,9 @@
2200
2200
  },
2201
2201
  "dependencies": {
2202
2202
  "@types/node": {
2203
- "version": "16.11.6",
2204
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz",
2205
- "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w=="
2203
+ "version": "16.11.7",
2204
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.7.tgz",
2205
+ "integrity": "sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw=="
2206
2206
  },
2207
2207
  "mkdirp": {
2208
2208
  "version": "0.5.5",
@@ -3172,9 +3172,9 @@
3172
3172
  "integrity": "sha512-GJCAeDBKfREgkBtgrYSf9hQy9kTb3helv0zGdzqhM7iAkW8FA/ZF97VQDbwFiwIT8MQLLOe5VlPZOEvZAqtUAQ=="
3173
3173
  },
3174
3174
  "electron-to-chromium": {
3175
- "version": "1.3.890",
3176
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.890.tgz",
3177
- "integrity": "sha512-VWlVXSkv0cA/OOehrEyqjUTHwV8YXCPTfPvbtoeU2aHR21vI4Ejh5aC4AxUwOmbLbBgb6Gd3URZahoCxtBqCYQ==",
3175
+ "version": "1.3.892",
3176
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.892.tgz",
3177
+ "integrity": "sha512-YDW4yIjdfMnbRoBjRZ/aNQYmT6JgQFLwmTSDRJMQdrY4MByEzppdXp3rnJ0g4LBWcsYTUvwKKClYN1ofZ0COOQ==",
3178
3178
  "dev": true
3179
3179
  },
3180
3180
  "emoji-regex": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testim/testim-cli",
3
- "version": "3.198.0",
3
+ "version": "3.199.0",
4
4
  "description": "Command line interface for running Testing on your CI",
5
5
  "author": "Oren Rubin",
6
6
  "contributors": [{
@@ -7,6 +7,8 @@ const constants = require('../commons/constants');
7
7
  const featureAvailabilityService = require('../commons/featureAvailabilityService');
8
8
  const { getAbortedTests, getFailedTests, getPassedTests, getFailureEvaluatingCount, getSkippedCount } = require('./reporterUtils');
9
9
 
10
+ const colorize = { success: chalk.green, warn: chalk.yellow, error: chalk.red };
11
+
10
12
  class ConsoleReporter {
11
13
  constructor(options, branchToUse) {
12
14
  this.options = options;
@@ -16,12 +18,8 @@ class ConsoleReporter {
16
18
  this.branchToUse = branchToUse;
17
19
  }
18
20
 
19
- printWorkerMessage(workerId, message) {
20
- if (this.config.showWorkerNames) {
21
- console.log(`W:${workerId} ${message}`);
22
- } else {
23
- console.log(message);
24
- }
21
+ toWorkerIdPrefix(workerId) {
22
+ return this.config.showWorkerNames ? `W:${workerId}` : '';
25
23
  }
26
24
 
27
25
  printWorkerDivider() {
@@ -32,7 +30,7 @@ class ConsoleReporter {
32
30
  const type = isCodeMode ? 'File' : 'Test';
33
31
  const testIdLabel = test.isTestsContainer ? '' : `(${test.testId})`;
34
32
  const testUrlLabel = test.isTestsContainer ? '' : `url: ${chalk.underline(utils.getTestUrl(this.options.editorUrl, this.options.project, test.testId, test.resultId, this.branchToUse))}`;
35
- this.printWorkerMessage(workerId, `${type} "${test.name}" started ${testIdLabel} ${testUrlLabel}`.trim());
33
+ console.log(this.toWorkerIdPrefix(workerId), `${type} "${test.name}" started ${testIdLabel} ${testUrlLabel}`.trim());
36
34
  }
37
35
 
38
36
  onTestFinished(test, workerId, isRerun, isCodeMode) {
@@ -42,7 +40,9 @@ class ConsoleReporter {
42
40
  }
43
41
  const testStatus = test.success ? constants.runnerTestStatus.PASSED : constants.runnerTestStatus.FAILED;
44
42
  const testIdLabel = test.isTestsContainer ? ' ' : `(${test.testId})`;
45
- this.printWorkerMessage(workerId, `Test "${test.name}" finished status: ${testStatus} ${testIdLabel} duration: ${utils.getDuration(test.duration)}`);
43
+ const color = colorize[test.success ? 'success' : 'error'];
44
+
45
+ console.log(color(this.toWorkerIdPrefix(workerId), `Test "${test.name}" finished status: ${testStatus} ${testIdLabel} duration: ${utils.getDuration(test.duration)}`));
46
46
  }
47
47
 
48
48
  printAllFailedTests(failedTests) {
@@ -54,8 +54,8 @@ class ConsoleReporter {
54
54
  }
55
55
  return `${failedTest.name} : ${testUrl}`;
56
56
  });
57
- console.log('Failed runs are:');
58
- console.log(failedTestStrings.join('\n\r'));
57
+ console.log(colorize.error('Failed runs are:'));
58
+ console.log(colorize.error(failedTestStrings.join('\n\r')));
59
59
  }
60
60
  }
61
61
 
@@ -79,15 +79,20 @@ class ConsoleReporter {
79
79
  }
80
80
 
81
81
  const planName = this.buildTestPlanName(isAnonymous, testPlanName, isCodeMode);
82
+
83
+ let message;
84
+ const color = colorize[failed ? 'error' : 'success'];
85
+
82
86
  if (isCodeMode || planName.trim() === '' || planName.trim() === 'Anonymous') {
83
- this.printWorkerDivider();
84
- console.log(`Tests completed. PASSED: ${passed} FAILED: ${failed}${failedEvaluatingString} ABORTED: ${aborted}${skippedString} Duration: ${utils.getDuration(duration)} (Execution ID: ${executionId})`);
85
- this.printWorkerDivider();
87
+ message = `Tests completed. PASSED: ${passed} FAILED: ${failed}${failedEvaluatingString} ABORTED: ${aborted}${skippedString} Duration: ${utils.getDuration(duration)} (Execution ID: ${executionId})`;
86
88
  } else {
87
- this.printWorkerDivider();
88
- console.log(`Test plan${planName} completed PASSED: ${passed} FAILED: ${failed}${failedEvaluatingString} ABORTED: ${aborted}${skippedString} Duration: ${utils.getDuration(duration)} (${executionId})`);
89
- this.printWorkerDivider();
89
+ message = `Test plan${planName} completed PASSED: ${passed} FAILED: ${failed}${failedEvaluatingString} ABORTED: ${aborted}${skippedString} Duration: ${utils.getDuration(duration)} (${executionId})`;
90
90
  }
91
+
92
+ this.printWorkerDivider();
93
+ console.log(color(message));
94
+ this.printWorkerDivider();
95
+
91
96
  this.printAllFailedTests(failedTests);
92
97
  }
93
98
 
@@ -138,24 +143,24 @@ class ConsoleReporter {
138
143
  onGetSlot(workerId, browser) {
139
144
  const gridNameOrId = this.options.grid || this.options.gridId;
140
145
  if (gridNameOrId) {
141
- this.printWorkerMessage(workerId, `Get ${chalk.underline(browser)} slot from ${chalk.underline(gridNameOrId)}`);
146
+ console.log(this.toWorkerIdPrefix(workerId), `Get ${chalk.underline(browser)} slot from ${chalk.underline(gridNameOrId)}`);
142
147
  }
143
148
  }
144
149
 
145
150
  onGetSession(workerId, testName, mode) {
146
- this.printWorkerMessage(workerId, `Get browser to run ${chalk.underline(testName)}`);
151
+ console.log(this.toWorkerIdPrefix(workerId), `Get browser to run ${chalk.underline(testName)}`);
147
152
  }
148
153
 
149
154
  onWaitToTestStart(workerId) {
150
- this.printWorkerMessage(workerId, 'Wait for test start');
155
+ console.log(this.toWorkerIdPrefix(workerId), 'Wait for test start');
151
156
  }
152
157
 
153
158
  onWaitToTestComplete(workerId, isCodeMode, debuggerAddress) {
154
159
  const type = isCodeMode ? 'file' : 'test';
155
- this.printWorkerMessage(workerId, `Wait for ${type} complete`);
160
+ console.log(this.toWorkerIdPrefix(workerId), `Wait for ${type} complete`);
156
161
  if (debuggerAddress && isCodeMode) {
157
162
  // TODO(Benji) decide with Amitai what we want to do with this
158
- this.printWorkerMessage(workerId, `Chrome Debugger available at ${debuggerAddress}`);
163
+ console.log(this.toWorkerIdPrefix(workerId), `Chrome Debugger available at ${debuggerAddress}`);
159
164
  }
160
165
  }
161
166
 
@@ -166,11 +171,11 @@ class ConsoleReporter {
166
171
  // heuristic, show the message on the same attempt
167
172
  const gridNameOrId = this.options.grid || this.options.gridId;
168
173
  if (gridNameOrId) { // if the user passes a grid or a gridId - show those
169
- this.printWorkerMessage(workerId, `It is taking us some time to get a browser from the grid ${gridNameOrId}`);
174
+ console.log(colorize.warn(this.toWorkerIdPrefix(workerId), `It is taking us some time to get a browser from the grid ${gridNameOrId}`));
170
175
  } else if (this.options.usingLocalChromeDriver) {
171
- this.printWorkerMessage(workerId, 'We are having issues starting ChromeDriver for you locally');
176
+ console.log(colorize.warn(this.toWorkerIdPrefix(workerId), 'We are having issues starting ChromeDriver for you locally'));
172
177
  } else if (this.options.host) {
173
- this.printWorkerMessage(workerId, `We are having issues reaching your Selenium grid at ${this.options.host}:${this.options.port || 4444}`);
178
+ console.log(colorize.warn(this.toWorkerIdPrefix(workerId), `We are having issues reaching your Selenium grid at ${this.options.host}:${this.options.port || 4444}`));
174
179
  } else {
175
180
  // in other cases - print nothing
176
181
  }
@@ -69,7 +69,13 @@ class TestPlanRunner {
69
69
  .log('right after runTestPlanTests')
70
70
  .then(() => runAfterTests(afterTests, testStatus, executionId, tpOptions, branchToUse, authData))
71
71
  .then(() => executionResults)
72
- .catch(StopRunOnError, () => catchBeforeTestsFailed(executionId));
72
+ .catch(err => {
73
+ logger.error('error running test plan', { err });
74
+ if (err instanceof StopRunOnError) {
75
+ return catchBeforeTestsFailed(executionId);
76
+ }
77
+ throw err;
78
+ });
73
79
  }
74
80
 
75
81
  async initRealDataService(projectId) {
package/testRunHandler.js CHANGED
@@ -321,10 +321,17 @@ TestRun.prototype.validateRunConfig = function () {
321
321
  const baseUrl = this.getBaseUrl();
322
322
  const { browserValue } = this.getRunConfig();
323
323
 
324
- if (baseUrl) {
325
- const { username, password } = new URL(baseUrl);
324
+ if (baseUrl && browserValue === 'safari') {
325
+ let parsedUrl;
326
+ try {
327
+ parsedUrl = new URL(baseUrl);
328
+ } catch (err) {
329
+ // ignore invalid URLs (missing http:// or https:// prefix)
330
+ return;
331
+ }
332
+ const { username, password } = parsedUrl;
326
333
 
327
- if (browserValue === 'safari' && (username || password)) {
334
+ if (username || password) {
328
335
  throw new Error('Basic authentication in URL is not supported in Safari');
329
336
  }
330
337
  }