@testim/testim-cli 3.211.0 → 3.212.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.
@@ -36,30 +36,45 @@ async function getLocalLocators() {
36
36
 
37
37
  async function findTests(folder = process.cwd()) {
38
38
  const testFolder = await findTestFolder(folder);
39
- // note - withFileTypes requires Node 10.x so we make this in two calls.
40
- const filesWithoutStat = await fs.readdirAsync(testFolder);
41
- const filesWithStat = await Promise.all(filesWithoutStat.map(name => Promise.props({ stat: fs.statAsync(name).catch(e => {}), name })));
39
+ const filesWithStat = await fs.promises.readdir(testFolder, { withFileTypes: true });
42
40
 
43
41
  // things we know are not tests but end in js
44
42
  const excluded = ['webpack.config.js', 'tsconfig.js', '.DS_Store', 'functions.js'];
45
43
  const excludedFileTypes = ['.html', '.json'];
46
- return filesWithStat.filter(x => !excluded.includes(x.name))
47
- .filter(x => !excludedFileTypes.some(type => x.name.endsWith(type)))
48
- .filter(x => x.stat && x.stat.isFile())
49
- .filter(x => !x.name.startsWith('.'))
44
+ return filesWithStat
45
+ .filter(x =>
46
+ !excluded.includes(x.name) &&
47
+ !excludedFileTypes.some(type => x.name.endsWith(type)) &&
48
+ x.isFile() &&
49
+ !x.name.startsWith('.'),
50
+ )
50
51
  .map(x => x.name);
51
52
  }
52
53
 
54
+ /**
55
+ * @param {Record<string, object | Promise<object>>} propsObject
56
+ * @returns {Promise<Record<string, object>>}
57
+ * */
58
+ async function promiseFromProps(propsObject) {
59
+ const entries = Object.entries(propsObject);
60
+ const values = entries.map(([, value]) => value);
61
+ const resolvedValues = await Promise.all(values);
62
+ for (let i = 0; i < resolvedValues.length; i++) {
63
+ entries[i][1] = resolvedValues[i];
64
+ }
65
+ return Object.fromEntries(entries);
66
+ }
67
+
53
68
  async function getLocalLocatorContents(locators, full = false, originFolder = process.cwd()) {
54
69
  const props = {};
55
70
  if (full) {
56
71
  const folder = await findTestFolder(originFolder);
57
72
  for (const key of Object.values(locators)) {
58
- props[key] = fs.readFileAsync(path.join(folder, 'locators', `locator.${key}.json`)).then(JSON.parse);
73
+ props[key] = fs.promises.readFile(path.join(folder, 'locators', `locator.${key}.json`)).then(JSON.parse);
59
74
  }
60
75
  }
61
76
  try {
62
- const contents = await Promise.props(props);
77
+ const contents = await promiseFromProps(props);
63
78
  return contents;
64
79
  } catch (e) {
65
80
  console.error(e);
@@ -2337,9 +2337,9 @@
2337
2337
  "dev": true
2338
2338
  },
2339
2339
  "caniuse-lite": {
2340
- "version": "1.0.30001291",
2341
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001291.tgz",
2342
- "integrity": "sha512-roMV5V0HNGgJ88s42eE70sstqGW/gwFndosYrikHthw98N5tLnOTxFqMLQjZVRxTWFlJ4rn+MsgXrR7MDPY4jA==",
2340
+ "version": "1.0.30001292",
2341
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001292.tgz",
2342
+ "integrity": "sha512-jnT4Tq0Q4ma+6nncYQVe7d73kmDmE9C3OGTx3MvW7lBM/eY1S1DZTMBON7dqV481RhNiS5OxD7k9JQvmDOTirw==",
2343
2343
  "dev": true
2344
2344
  },
2345
2345
  "caseless": {
@@ -3501,9 +3501,9 @@
3501
3501
  "integrity": "sha512-GJCAeDBKfREgkBtgrYSf9hQy9kTb3helv0zGdzqhM7iAkW8FA/ZF97VQDbwFiwIT8MQLLOe5VlPZOEvZAqtUAQ=="
3502
3502
  },
3503
3503
  "electron-to-chromium": {
3504
- "version": "1.4.25",
3505
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.25.tgz",
3506
- "integrity": "sha512-bTwub9Y/76EiNmfaiJih+hAy6xn7Ns95S4KvI2NuKNOz8TEEKKQUu44xuy0PYMudjM9zdjKRS1bitsUvHTfuUg==",
3504
+ "version": "1.4.26",
3505
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.26.tgz",
3506
+ "integrity": "sha512-cA1YwlRzO6TGp7yd3+KAqh9Tt6Z4CuuKqsAJP6uF/H5MQryjAGDhMhnY5cEXo8MaRCczpzSBhMPdqRIodkbZYw==",
3507
3507
  "dev": true
3508
3508
  },
3509
3509
  "emoji-regex": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testim/testim-cli",
3
- "version": "3.211.0",
3
+ "version": "3.212.0",
4
4
  "description": "Command line interface for running Testing on your CI",
5
5
  "author": "Oren Rubin",
6
6
  "contributors": [{
@@ -115,7 +115,6 @@
115
115
  "testim": "cli.js"
116
116
  },
117
117
  "scripts": {
118
- "postpublish": "scripts/publish-docker.js",
119
118
  "test": "IS_UNIT_TEST=1 ./node_modules/mocha/bin/_mocha --timeout 2000 --reporter spec --exit --recursive \"./src/**/*.test.js\" --exclude ./src/codim/template.js/tests/examples/**/*.test.js",
120
119
  "test:watch": "IS_UNIT_TEST=1 ./node_modules/mocha/bin/_mocha --timeout 2000 --exit --recursive \"./src/**/*.test.js\" --exclude ./src/codim/template.js/tests/examples/**/*.test.js --watch",
121
120
  "test:cov": "nyc --reporter=lcov --reporter=text yarn test",
@@ -350,14 +350,16 @@ class TabService {
350
350
  mainTabPromise = this.driver.executeJS('return window.__isMainTestimTab').get('value');
351
351
  }
352
352
 
353
- return Promise.props({ title: this.driver.getTitle(), url: this.driver.getUrl(), isMainTab: mainTabPromise })
354
- .catch(err => {
353
+ return Promise.all([this.driver.getTitle(), this.driver.getUrl(), mainTabPromise]).then(
354
+ ([title, url, isMainTab]) => ({ title, url, isMainTab }),
355
+ err => {
355
356
  logger.error('failed to get url or title', { err });
356
357
  return {
357
358
  title: '',
358
359
  url: '',
359
360
  };
360
- });
361
+ },
362
+ );
361
363
  })
362
364
  .catch(err => {
363
365
  logger.error('failed to switch to tab', { tabId, err });
@@ -63,6 +63,7 @@ class ParallelWorkerManager {
63
63
  const source = options.source || 'cli';
64
64
  const user = options.user;
65
65
  const companyPlan = options.company && options.company.planType;
66
+ const isStartUp = options.company && options.company.isStartUp;
66
67
  const projectName = options.projectData && options.projectData.name;
67
68
  const lightweightMode = options.lightweightMode;
68
69
  const sessionType = utils.getSessionType(options);
@@ -82,6 +83,7 @@ class ParallelWorkerManager {
82
83
  source,
83
84
  user,
84
85
  lightweightMode,
86
+ isStartUp,
85
87
  });
86
88
  return testStatus.testStartAndReport(wid, executionId, resultId, isRerun, testRetryKey);
87
89
  };
@@ -146,6 +148,7 @@ class ParallelWorkerManager {
146
148
  user,
147
149
  lightweightMode,
148
150
  logger,
151
+ isStartUp,
149
152
  });
150
153
  if (stopOnError && !testResult.success) {
151
154
  reject(new StopRunOnError());
@@ -31,7 +31,7 @@ function setLightweightAnalytics(properties, lightweightMode) {
31
31
  }
32
32
 
33
33
  function analyticsTestStart({
34
- executionId, projectId, testId, resultId, companyId, companyName, projectName, companyPlan, sessionType, source, user, lightweightMode,
34
+ executionId, projectId, testId, resultId, companyId, companyName, projectName, companyPlan, sessionType, source, user, lightweightMode, isStartUp,
35
35
  }) {
36
36
  const properties = setLightweightAnalytics({
37
37
  executionId,
@@ -44,13 +44,14 @@ function analyticsTestStart({
44
44
  companyPlan,
45
45
  sessionType,
46
46
  source: calcSource(source, user),
47
+ isStartUp,
47
48
  }, lightweightMode);
48
49
  analytics.trackWithCIUser('test-run-ci', properties);
49
50
  }
50
51
 
51
52
  function analyticsTestEnd({
52
53
  executionId, projectId, testId, resultId, result, companyId, companyName, projectName, companyPlan, sessionType, source, user, lightweightMode,
53
- logger,
54
+ logger, isStartUp,
54
55
  }) {
55
56
  try {
56
57
  const properties = setLightweightAnalytics({
@@ -65,6 +66,7 @@ function analyticsTestEnd({
65
66
  sessionType,
66
67
  mockNetworkEnabled: result.wasMockNetworkActivated,
67
68
  source: calcSource(source, user),
69
+ isStartUp,
68
70
  }, lightweightMode);
69
71
 
70
72
  if (result.success) {