ui5-test-runner 5.7.3 โ†’ 5.8.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.7.3",
3
+ "version": "5.8.0",
4
4
  "description": "Standalone test runner for UI5",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/batch.js CHANGED
@@ -2,7 +2,7 @@ const { open, readdir, stat, unlink } = require('fs/promises')
2
2
  const { extname, isAbsolute, join } = require('path')
3
3
  const { allocPromise, filename } = require('./tools')
4
4
  const { fork } = require('child_process')
5
- const { interactive, getOutput, newProgress } = require('./output')
5
+ const { getOutput, newProgress } = require('./output')
6
6
  const { parallelize } = require('./parallelize')
7
7
  const { $statusProgressCount } = require('./symbols')
8
8
  const { $valueSources } = require('./symbols')
@@ -56,9 +56,7 @@ const task = async function (batchItem) {
56
56
  const reportDir = join(job.reportDir, id)
57
57
  progress.label = `${label} (${id})`
58
58
  progress.count = 1
59
- if (!interactive) {
60
- output.log(`${label}...`)
61
- }
59
+ output.batchStartingTask(label)
62
60
  const { promise, resolve, reject } = allocPromise()
63
61
  const parameters = [
64
62
  ...args,
@@ -24,9 +24,9 @@ async function main () {
24
24
  const job = require(join(reportDir, 'job.js'))
25
25
  o('<?xml version="1.0" encoding="UTF-8"?>')
26
26
  o('<testsuites>')
27
- const urls = Object.keys(job.qunitPages)
27
+ const urls = Object.keys(job.qunitPages || {})
28
28
  for (const url of urls) {
29
- const qunitPage = job.qunitPages[url]
29
+ const qunitPage = job.qunitPages[url] || { modules: [] }
30
30
  for (const module of qunitPage.modules) {
31
31
  o(` <testsuite
32
32
  name="${xmlEscape(url)}"
package/src/job-mode.js CHANGED
@@ -40,7 +40,8 @@ function buildAndCheckMode (job) {
40
40
  'config',
41
41
  'batchMode',
42
42
  'batchId',
43
- 'batchLabel'
43
+ 'batchLabel',
44
+ 'ci'
44
45
  ])
45
46
  return 'capabilities'
46
47
  }
package/src/job.js CHANGED
@@ -113,6 +113,7 @@ function getCommand (cwd) {
113
113
  .option('--offline [flag]', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช๐Ÿ“ก] Limit network usage (implies --no-npm-install)', boolean, false)
114
114
  .option('--env <name=value...>', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช๐Ÿ“ก] Set environment variable', arrayOf(string))
115
115
  .option('--localhost <host>', `[๐Ÿ’ป๐Ÿ”—๐Ÿงช๐Ÿ“ก] ${DANGEROUS_OPTION} Hostname for legacy URLs and callbacks`, string, 'localhost')
116
+ .option('--ci [flag]', '[๐Ÿ’ป๐Ÿ”—๐Ÿงช๐Ÿ“ก] CI mode (no interactive output)', boolean, false)
116
117
 
117
118
  // Common to legacy and url
118
119
  .option('--webapp <path>', '[๐Ÿ’ป๐Ÿ”—] Base folder of the web application (relative to cwd)', 'webapp')
package/src/output.js CHANGED
@@ -10,8 +10,6 @@ const {
10
10
  } = require('./symbols')
11
11
  const { filename, noop, pad } = require('./tools')
12
12
 
13
- const inJest = typeof jest !== 'undefined'
14
- const interactive = process.stdout.columns !== undefined && !inJest
15
13
  const $output = Symbol('output')
16
14
  const $outputStart = Symbol('output-start')
17
15
  const $outputProgress = Symbol('output-progress')
@@ -19,22 +17,9 @@ const $logServerIncomingCount = Symbol('log-server-incoming')
19
17
  const $logServerRedirectedCount = Symbol('log-server-redirected')
20
18
  const $logServerClosedCount = Symbol('log-server-closed')
21
19
  const $logServerRequests = Symbol('log-server-requests')
20
+ const $interactive = Symbol('interactive')
22
21
 
23
- if (!interactive) {
24
- const UTF8_BOM_CODE = '\ufeff'
25
- process.stdout.write(UTF8_BOM_CODE)
26
- }
27
-
28
- let cons
29
- if (inJest) {
30
- cons = {
31
- log: noop,
32
- warn: noop,
33
- error: noop
34
- }
35
- } else {
36
- cons = console
37
- }
22
+ let cons = console
38
23
 
39
24
  const formatTime = duration => {
40
25
  duration = Math.ceil(duration / 1000)
@@ -129,7 +114,7 @@ function progress (job, cleanFirst = true) {
129
114
  })
130
115
  }
131
116
  const sequence = []
132
- if (interactive) {
117
+ if (job[$interactive]) {
133
118
  if (cleanFirst) {
134
119
  sequence.push(...buildCleanSequence(job))
135
120
  }
@@ -248,8 +233,21 @@ function browserIssue (job, { type, url, code, dir }) {
248
233
  }
249
234
 
250
235
  function build (job) {
236
+ let interactive = !job.ci
237
+ const inJest = typeof jest !== 'undefined'
238
+ if (inJest) {
239
+ cons = { log: noop, warn: noop, error: noop }
240
+ interactive = false
241
+ } else if (process.stdout.columns === undefined || !process.stdout.isTTY) {
242
+ interactive = false
243
+ }
244
+ if (!interactive) {
245
+ const UTF8_BOM_CODE = '\ufeff'
246
+ process.stdout.write(UTF8_BOM_CODE)
247
+ }
251
248
  let wrap
252
249
  if (interactive) {
250
+ job[$interactive] = true
253
251
  wrap = method => function () {
254
252
  clean(job)
255
253
  try {
@@ -476,6 +474,12 @@ function build (job) {
476
474
  log(job, p80()`โš ๏ธ [SKIPIF] Skipping execution (--if)`)
477
475
  }),
478
476
 
477
+ batchStartingTask: wrap((label) => {
478
+ if (!interactive) {
479
+ log(job, p80()`${label}...`)
480
+ }
481
+ }),
482
+
479
483
  batchFailed: wrap((batch, reason) => {
480
484
  log(job, p80()`โš ๏ธ [BATCHF] Failed to resolve batch ${batch}: ${reason}`)
481
485
  }),
@@ -662,8 +666,6 @@ function build (job) {
662
666
  }
663
667
 
664
668
  module.exports = {
665
- interactive,
666
-
667
669
  getOutput (job) {
668
670
  if (!job[$output]) {
669
671
  job[$output] = build(job)