ui5-test-runner 4.1.1 โ†’ 4.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui5-test-runner",
3
- "version": "4.1.1",
3
+ "version": "4.2.0",
4
4
  "description": "Standalone test runner for UI5",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -78,7 +78,7 @@
78
78
  "standard": "^17.1.0",
79
79
  "start-server-and-test": "^2.0.3",
80
80
  "typescript": "^5.3.3",
81
- "ui5-tooling-transpile": "^3.3.4"
81
+ "ui5-tooling-transpile": "^3.3.5"
82
82
  },
83
83
  "optionalDependencies": {
84
84
  "fsevents": "^2.3.3"
package/src/job-mode.js CHANGED
@@ -29,7 +29,8 @@ function buildAndCheckMode (job) {
29
29
  'pageTimeout',
30
30
  'browserCloseTimeout',
31
31
  'failFast',
32
- 'keepAlive'
32
+ 'keepAlive',
33
+ 'alternateNpmPath'
33
34
  ])
34
35
  return 'capabilities'
35
36
  }
package/src/job.js CHANGED
@@ -102,6 +102,7 @@ function getCommand (cwd) {
102
102
  .option('-p, --parallel <count>', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช] Number of parallel tests executions', 2)
103
103
  .option('-b, --browser <command>', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช] Browser instantiation command (relative to cwd or use $/ for provided ones)', '$/puppeteer.js')
104
104
  .option('--browser-args <argument...>', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช] Browser instantiation command parameters (use -- instead)')
105
+ .option('--alternate-npm-path <path>', '[๐Ÿ’ป๐Ÿ”—] Alternate NPM path to look for packages (priority: local, alternate, global)')
105
106
  .option('--no-npm-install', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช] Prevent any NPM install (execution may fail if a dependency is missing)')
106
107
  .option('-bt, --browser-close-timeout <timeout>', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช] Maximum waiting time for browser close', timeout, 2000)
107
108
  .option('-br, --browser-retry <count>', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช] Browser instantiation retries : if the command fails unexpectedly, it is re-executed (0 means no retry)', 1)
@@ -224,6 +225,9 @@ function finalize (job) {
224
225
  if (job.cache) {
225
226
  updateToAbsolute('cache')
226
227
  }
228
+ if (job.alternateNpmPath) {
229
+ checkAccess({ path: job.alternateNpmPath, label: 'Alternate NPM path' })
230
+ }
227
231
  job.mode = buildAndCheckMode(job)
228
232
  if (job.mode === 'legacy') {
229
233
  checkAccess({ path: job.webapp, label: 'webapp folder' })
package/src/npm.js CHANGED
@@ -41,6 +41,38 @@ function resolveDependencyPath (name) {
41
41
  }
42
42
  }
43
43
 
44
+ async function findDependencyPath (job, name) {
45
+ if (!localRoot) {
46
+ [localRoot, globalRoot] = await Promise.all([
47
+ npm(job, 'root'),
48
+ npm(job, 'root', '--global')
49
+ ])
50
+ }
51
+ const localPath = join(localRoot, name)
52
+ if (await folderExists(localPath)) {
53
+ return [localPath, false]
54
+ }
55
+ if (job.alternateNpmPath) {
56
+ const alternatePath = join(job.alternateNpmPath, name)
57
+ if (await folderExists(alternatePath)) {
58
+ return [alternatePath, false]
59
+ }
60
+ }
61
+ const globalPath = join(globalRoot, name)
62
+ let justInstalled = false
63
+ if (!await folderExists(globalPath)) {
64
+ if (!job.npmInstall) {
65
+ throw UTRError.NPM_DEPENDENCY_NOT_FOUND(name)
66
+ }
67
+ const previousStatus = job.status
68
+ job.status = `Installing ${name}...`
69
+ await npm(job, 'install', name, '-g')
70
+ justInstalled = true
71
+ job.status = previousStatus
72
+ }
73
+ return [globalPath, justInstalled]
74
+ }
75
+
44
76
  module.exports = {
45
77
  resolveDependencyPath,
46
78
 
@@ -52,29 +84,7 @@ module.exports = {
52
84
  } catch (e) {
53
85
  }
54
86
  if (!modulePath) {
55
- if (!localRoot) {
56
- [localRoot, globalRoot] = await Promise.all([
57
- npm(job, 'root'),
58
- npm(job, 'root', '--global')
59
- ])
60
- }
61
- const localPath = join(localRoot, name)
62
- if (await folderExists(localPath)) {
63
- modulePath = localPath
64
- } else {
65
- const globalPath = join(globalRoot, name)
66
- if (!await folderExists(globalPath)) {
67
- if (!job.npmInstall) {
68
- throw UTRError.NPM_DEPENDENCY_NOT_FOUND(name)
69
- }
70
- const previousStatus = job.status
71
- job.status = `Installing ${name}...`
72
- await npm(job, 'install', name, '-g')
73
- justInstalled = true
74
- job.status = previousStatus
75
- }
76
- modulePath = globalPath
77
- }
87
+ [modulePath, justInstalled] = await findDependencyPath(job, name)
78
88
  }
79
89
  const output = getOutput(job)
80
90
  const installedPackage = require(join(modulePath, 'package.json'))