@testim/testim-cli 3.287.0 → 3.288.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/cli.js CHANGED
@@ -70,6 +70,11 @@ async function main() {
70
70
  require('./commons/logger').setProjectId(processedOptions.project);
71
71
  require('./commons/runnerFileCache').setEncryptKey(typeof processedOptions.token === 'string' ? processedOptions.token : 'anonymous_encrypt_key');
72
72
 
73
+ if (utils.isInstallLazyDepsMode(processedOptions)) {
74
+ console.log('Lazy dependency installation started');
75
+ const { installAllLazyDependencies } = require('./commons/lazyRequire');
76
+ return await installAllLazyDependencies();
77
+ }
73
78
  if (utils.isInitCodimMode(processedOptions)) {
74
79
  const codimCli = require('./codim/codim-cli');
75
80
  return codimCli.init(processedOptions.initTestProject);
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
- const npmWrapper = require('./npmWrapper');
4
3
  const ora = require('ora');
5
4
  const path = require('path');
6
- const logger = require('./logger').getLogger('lazy-require');
5
+ const npmWrapper = require('./npmWrapper');
6
+ const { getLogger } = require('./logger');
7
7
  const { getCliLocation } = require('../utils');
8
8
  const { requireWithFallback } = require('./requireWithFallback');
9
9
 
10
+ const logger = getLogger('lazy-require');
10
11
  // eslint-disable-next-line import/no-dynamic-require
11
12
  const packageJson = require(path.resolve(getCliLocation(), 'package.json'));
12
13
  const ongoingCalls = new Map();
@@ -75,16 +76,17 @@ async function lazyRequireImpl(dependency) {
75
76
  return requireWithFallback(dependency);
76
77
  }
77
78
 
78
- async function installAllLazyDependencies() {
79
+ module.exports.installAllLazyDependencies = async function installAllLazyDependencies() {
79
80
  const allLazyDependencies = Object.keys(packageJson.lazyDependencies);
80
81
 
81
82
  for (const dep of allLazyDependencies) {
82
83
  await lazyRequireImpl(dep);
83
84
  }
84
- }
85
+ };
85
86
 
87
+ // TODO: remove this once docker-build-tool is not using it
86
88
  if (require.main === module) {
87
- installAllLazyDependencies();
89
+ module.exports.installAllLazyDependencies();
88
90
  }
89
91
 
90
92
  /**
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@testim/testim-cli",
3
- "version": "3.287.0",
3
+ "version": "3.288.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@testim/testim-cli",
9
- "version": "3.287.0",
9
+ "version": "3.288.0",
10
10
  "license": "Proprietary",
11
11
  "dependencies": {
12
12
  "@applitools/eyes-sdk-core": "13.11.29",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testim/testim-cli",
3
- "version": "3.287.0",
3
+ "version": "3.288.0",
4
4
  "description": "Command line interface for running Testing on your CI",
5
5
  "author": "Oren Rubin",
6
6
  "contributors": [{
package/runOptions.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ interface InstallLazyDepsOptions {
2
+ installLazyDepsMode: true;
3
+ }
4
+
1
5
  interface LoginModeOptions {
2
6
  loginMode: true;
3
7
  }
@@ -291,6 +295,7 @@ interface RunnerOptions extends Partial<Omit<TunnelOptions, 'tunnelOnlyMode' | '
291
295
  }
292
296
 
293
297
  type Options = |
298
+ InstallLazyDepsOptions |
294
299
  LoginModeOptions |
295
300
  InitModeOptions |
296
301
  AgentModeOptions |
package/runOptions.js CHANGED
@@ -120,6 +120,10 @@ const printUsage = () => {
120
120
  return line.includes('--test-start-timeout');
121
121
  }
122
122
 
123
+ function isInstallLazyDeps(line) {
124
+ return line.includes('--install-lazy-deps');
125
+ }
126
+
123
127
  program.help((txt) => {
124
128
  const lines = txt.split('\n');
125
129
  return lines
@@ -137,7 +141,8 @@ const printUsage = () => {
137
141
  !isExitCodeIgnoreFailingTests(ln) &&
138
142
  !isDeprecatedHighSpeed(ln) &&
139
143
  !isUrls(ln) &&
140
- !isTestStartTimeout(ln),
144
+ !isTestStartTimeout(ln) &&
145
+ !isInstallLazyDeps(ln),
141
146
  )
142
147
  .join('\n');
143
148
  });
@@ -370,6 +375,8 @@ program
370
375
  .option('--intersect-with-label [label]', 'Out of the execution\'s test list, run only those tests that have the specified label', collect, [])
371
376
  .option('--intersect-with-suite [suiteName]', 'Out of the execution\'s test list, run only those tests that are included in the specified suite (by suite name)', collect, [])
372
377
  .option('--intersect-with-suite-id [suiteId]', 'Out of the execution\'s test list, run only those tests that are included in the specified suite (by suite ID)', collect, [])
378
+
379
+ .option('--install-lazy-deps [install-lazy-deps]', 'Install all lazy dependencies from package.json', false)
373
380
  .parse(process.argv);
374
381
 
375
382
 
@@ -439,6 +446,10 @@ module.exports = {
439
446
  process.exit(0);
440
447
  }
441
448
 
449
+ if (program.installLazyDeps) {
450
+ return { installLazyDepsMode: true };
451
+ }
452
+
442
453
  if (program.disableFileCache) {
443
454
  localRunnerCache.disable();
444
455
  }
@@ -13,6 +13,7 @@ const { sessionType, testStatus: testStatusConst } = require('../commons/constan
13
13
  * @typedef {import('../runOptions').NgrokTunnelOptions} NgrokTunnelOptions
14
14
  * @typedef {import('../runOptions').TunnelDaemonOptions} TunnelDaemonOptions
15
15
  * @typedef {import('../runOptions').RunnerOptions} RunnerOptions
16
+ * @typedef {import('../runOptions').InstallLazyDepsOptions} InstallLazyDepsOptions
16
17
  */
17
18
 
18
19
  /** @param {RunnerOptions} options */
@@ -71,6 +72,9 @@ const isTunnelOnlyMode = (options) => Boolean(options.tunnelOnlyMode);
71
72
  /** @type {(options: Options) => options is RunnerOptions & { createPrefechedData: true; }} options */
72
73
  // @ts-ignore should be `as any` etc
73
74
  const isCreatePrefetchedDataMode = (options) => Boolean(options.createPrefechedData);
75
+ /** @type {(options: Options) => options is InstallLazyDepsOptions} options */
76
+ // @ts-ignore should be `as any` etc
77
+ const isInstallLazyDepsMode = (options) => Boolean(options.installLazyDepsMode);
74
78
 
75
79
  module.exports = {
76
80
  getSessionType,
@@ -83,4 +87,5 @@ module.exports = {
83
87
  isLoginMode,
84
88
  isTunnelOnlyMode,
85
89
  isCreatePrefetchedDataMode,
90
+ isInstallLazyDepsMode,
86
91
  };