ui5-test-runner 3.3.2 → 3.3.4

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": "3.3.2",
3
+ "version": "3.3.4",
4
4
  "description": "Standalone test runner for UI5",
5
5
  "main": "index.js",
6
6
  "files": [
package/src/coverage.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- const { join, dirname } = require('path')
3
+ const { join, dirname, isAbsolute } = require('path')
4
4
  const { fork } = require('child_process')
5
5
  const { cleanDir, createDir, filename, download } = require('./tools')
6
6
  const { readdir, readFile, stat, writeFile, access, constants } = require('fs').promises
@@ -94,20 +94,30 @@ async function generateCoverageReport (job) {
94
94
  const coverageFilename = join(coverageMergedDir, 'coverage.json')
95
95
  await nyc(job, 'merge', job.coverageTempDir, coverageFilename)
96
96
  if (job[$coverageRemote] && !job.coverageProxy) {
97
- job.status = 'Collecting remote source files'
97
+ job.status = 'Checking remote source files'
98
98
  // Assuming all files are coming from the same server
99
99
  const { origin } = new URL(job.testPageUrls[0])
100
100
  const sourcesBasePath = join(job.coverageTempDir, 'sources')
101
101
  const coverageData = require(coverageFilename)
102
102
  const filenames = Object.keys(coverageData)
103
+ let changes = 0
103
104
  for (const filename of filenames) {
104
105
  const fileData = coverageData[filename]
105
106
  const { path } = fileData
107
+ if (isAbsolute(path)) {
108
+ try {
109
+ await access(path, constants.R_OK)
110
+ continue
111
+ } catch (e) {}
112
+ }
106
113
  const filePath = join(sourcesBasePath, path)
107
114
  fileData.path = filePath
108
115
  await download(origin + path, filePath)
116
+ ++changes
117
+ }
118
+ if (changes > 0) {
119
+ await writeFile(coverageFilename, JSON.stringify(coverageData))
109
120
  }
110
- await writeFile(coverageFilename, JSON.stringify(coverageData))
111
121
  }
112
122
  const reporters = job.coverageReporters.map(reporter => `--reporter=${reporter}`)
113
123
  if (!job.coverageReporters.includes('text')) {
@@ -169,6 +179,9 @@ module.exports = {
169
179
  match: /(.*\.js)(\?.*)?$/,
170
180
  custom: async (request, response, url) => {
171
181
  if (!url.match(job.coverageProxyInclude) || url.match(job.coverageProxyExclude)) {
182
+ if (job.debugCoverage) {
183
+ getOutput(job).wrap(() => console.log('coverage_proxy ignore', url))
184
+ }
172
185
  return // Ignore
173
186
  }
174
187
  const sourcePath = join(sourcesBasePath, url)
@@ -179,6 +192,9 @@ module.exports = {
179
192
  if (sources[url]) {
180
193
  await sources[url]
181
194
  } else {
195
+ if (job.debugCoverage) {
196
+ getOutput(job).wrap(() => console.log('coverage_proxy instrument', url))
197
+ }
182
198
  sources[url] = await download(origin + url, sourcePath)
183
199
  }
184
200
  } catch (statusCode) {
package/src/job.js CHANGED
@@ -130,7 +130,7 @@ function getCommand (cwd) {
130
130
 
131
131
  // Specific to legacy (and might be used with url if pointing to local project)
132
132
  .option('--ui5 <url>', '[💻] UI5 url', url, 'https://ui5.sap.com')
133
- .option('--no-ui5', '[💻] Disable UI5 mapping (also disable libs)')
133
+ .option('--disable-ui5', '[💻] Disable UI5 mapping (also disable libs)', boolean, false)
134
134
  .option('--libs <lib...>', '[💻] Library mapping (<relative>=<path> or <path>)', arrayOf(lib))
135
135
  .option('--mappings <mapping...>', '[💻] Custom mapping (<match>=<file|url>(<config>))', arrayOf(mapping))
136
136
  .option('--cache <path>', '[💻] Cache UI5 resources locally in the given folder (empty to disable)')
package/src/ui5.js CHANGED
@@ -7,7 +7,7 @@ const { capture } = require('reserve')
7
7
  const { getOutput } = require('./output')
8
8
 
9
9
  module.exports = job => {
10
- if (job.noUi5) {
10
+ if (job.disableUi5) {
11
11
  return []
12
12
  }
13
13