ui5-test-runner 5.5.2 โ†’ 5.6.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": "5.5.2",
3
+ "version": "5.6.0",
4
4
  "description": "Standalone test runner for UI5",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/batch.js CHANGED
@@ -76,7 +76,11 @@ const task = async function (batchItem) {
76
76
  if (option) {
77
77
  parameters.push(`--${longName}`)
78
78
  if (!option.optional && !option.negate) {
79
- if (option.variadic) {
79
+ if (name === 'env') {
80
+ Object.keys(job.env).forEach(key => {
81
+ parameters.push(`${key}=${job.env[key]}`)
82
+ })
83
+ } else if (option.variadic) {
80
84
  parameters.push(...job[name].map(value => value.toString()))
81
85
  } else {
82
86
  parameters.push(job[name].toString())
package/src/browsers.js CHANGED
@@ -29,7 +29,11 @@ async function instantiate (job, config) {
29
29
  const stdout = await open(stdoutFilename, 'w')
30
30
  const stderr = await open(stderrFilename, 'w')
31
31
  const childProcess = fork(job.browser, [browserConfigPath], {
32
- stdio: [0, stdout, stderr, 'ipc']
32
+ stdio: [0, stdout, stderr, 'ipc'],
33
+ env: {
34
+ ...process.env,
35
+ ...job.env
36
+ }
33
37
  })
34
38
  const { promise, resolve } = allocPromise()
35
39
  childProcess.on('close', async code => {
@@ -127,7 +131,7 @@ async function start (job, url, scripts = []) {
127
131
  }
128
132
  if (resolvedScripts.length) {
129
133
  resolvedScripts.unshift(`(function () {
130
- window['ui5-test-runner/base-host'] = 'http://localhost:${job.port}'
134
+ window['ui5-test-runner/base-host'] = 'http://${job.callbackHost}:${job.port}'
131
135
  }())`)
132
136
  }
133
137
  const progress = newProgress(job, url)
package/src/end.js CHANGED
@@ -17,7 +17,11 @@ async function end (job) {
17
17
  {
18
18
  cwd: job.cwd,
19
19
  stdio: [0, 'pipe', 'pipe', 'ipc'],
20
- windowsHide: true
20
+ windowsHide: true,
21
+ env: {
22
+ ...process.env,
23
+ ...job.env
24
+ }
21
25
  }
22
26
  )
23
27
 
package/src/job.js CHANGED
@@ -79,6 +79,7 @@ function getCommand (cwd) {
79
79
 
80
80
  const DEBUG_OPTION = '(๐Ÿž for debugging purpose)'
81
81
  const EXPERIMENTAL_OPTION = '[โš ๏ธ experimental]'
82
+ const DANGEROURS_OPTION = '[๐Ÿ’ฃ use carefully]'
82
83
 
83
84
  command
84
85
  .name(name)
@@ -110,6 +111,8 @@ function getCommand (cwd) {
110
111
  .option('-br, --browser-retry <count>', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช๐Ÿ“ก] Browser instantiation retries : if the command fails unexpectedly, it is re-executed (0 means no retry)', 1)
111
112
  .option('-oi, --output-interval <interval>', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช๐Ÿ“ก] Interval for reporting progress on non interactive output (CI/CD) (0 means no output)', timeout, 30000)
112
113
  .option('--offline [flag]', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช๐Ÿ“ก] Limit network usage (implies --no-npm-install)', boolean, false)
114
+ .option('--env <name=value...>', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช๐Ÿ“ก] Set environment variable', arrayOf(string))
115
+ .option('--callback-host <host>', `[๐Ÿ’ป๐Ÿ”—๐Ÿงช๐Ÿ“ก] ${DANGEROURS_OPTION} Hostname for callbacks`, string, 'localhost')
113
116
 
114
117
  // Common to legacy and url
115
118
  .option('--webapp <path>', '[๐Ÿ’ป๐Ÿ”—] Base folder of the web application (relative to cwd)', 'webapp')
@@ -299,6 +302,20 @@ function finalize (job) {
299
302
  })
300
303
  }
301
304
 
305
+ if (!job.env) {
306
+ job.env = {}
307
+ } else {
308
+ job.env = job.env.reduce((dictionary, env) => {
309
+ const equalPos = env.indexOf('=')
310
+ if (equalPos === -1) {
311
+ dictionary[env] = ''
312
+ } else {
313
+ dictionary[env.slice(0, equalPos)] = env.slice(equalPos + 1)
314
+ }
315
+ return dictionary
316
+ }, {})
317
+ }
318
+
302
319
  if (job.watchFolder) {
303
320
  job.watch = true
304
321
  job.watchFolder = updateToAbsolute(job.watchFolder)
package/src/report.js CHANGED
@@ -22,7 +22,17 @@ async function save (job) {
22
22
 
23
23
  function generateTextReport (job) {
24
24
  const { promise, resolve } = allocPromise()
25
- const childProcess = fork(join(__dirname, 'defaults/text-report.js'), [job.reportDir, process.stdout.columns || ''], { stdio: 'pipe' })
25
+ const childProcess = fork(
26
+ join(__dirname, 'defaults/text-report.js'),
27
+ [job.reportDir, process.stdout.columns || ''],
28
+ {
29
+ stdio: 'pipe',
30
+ env: {
31
+ ...process.env,
32
+ ...job.env
33
+ }
34
+ }
35
+ )
26
36
  getOutput(job).monitor(childProcess, true)
27
37
  childProcess.on('close', resolve)
28
38
  return promise
@@ -41,7 +51,17 @@ module.exports = {
41
51
  await generateTextReport(job)
42
52
  const promises = job.reportGenerator.map(generator => {
43
53
  const { promise, resolve } = allocPromise()
44
- const childProcess = fork(generator, [job.reportDir], { stdio: 'pipe' })
54
+ const childProcess = fork(
55
+ generator,
56
+ [job.reportDir],
57
+ {
58
+ stdio: 'pipe',
59
+ env: {
60
+ ...process.env,
61
+ ...job.env
62
+ }
63
+ }
64
+ )
45
65
  const buffers = output.monitor(childProcess, false)
46
66
  childProcess.on('close', exitCode => {
47
67
  if (exitCode !== 0) {