ui5-test-runner 6.0.5 → 6.0.7

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.
@@ -1,7 +1,7 @@
1
1
  import { OptionValidationError } from '../OptionValidationError.js';
2
2
  export const percent = (option, value) => {
3
3
  if (typeof value === 'string') {
4
- const match = /^(\d{0,3}(:?\.\d{0,3})?)%$/.exec(value);
4
+ const match = /^(\d{0,3}(:?\.\d{0,3})?)%?$/.exec(value);
5
5
  if (match) {
6
6
  const [, digits = '0'] = match;
7
7
  const float = Number(digits);
@@ -7,10 +7,24 @@ const isCoverageData = (value) => {
7
7
  return (entries.length > 0 &&
8
8
  entries.every((entry) => entry !== null && typeof entry === 'object' && 'path' in entry && typeof entry['path'] === 'string'));
9
9
  };
10
- const remapPaths = (coverageData, sourceDirectory) => Object.fromEntries(Object.entries(coverageData).map(([key, entry]) => {
11
- const absoluteKey = Path.join(sourceDirectory, key);
12
- return [absoluteKey, { ...entry, path: absoluteKey }];
13
- }));
10
+ const remapPaths = async (coverageData, sourceDirectory) => {
11
+ const entries = Object.entries(coverageData);
12
+ const mappedEntries = [];
13
+ for (const [key, entry] of entries) {
14
+ let isAbsoluteAndExists = Path.isAbsolute(key);
15
+ try {
16
+ if (isAbsoluteAndExists) {
17
+ await FileSystem.access(key, FileSystem.constants.R_OK);
18
+ }
19
+ }
20
+ catch {
21
+ isAbsoluteAndExists = false;
22
+ }
23
+ const absoluteKey = isAbsoluteAndExists ? key : Path.join(sourceDirectory, key);
24
+ mappedEntries.push([absoluteKey, { ...entry, path: absoluteKey }]);
25
+ }
26
+ return Object.fromEntries(mappedEntries);
27
+ };
14
28
  export const collect = async (configuration, pageContext) => {
15
29
  const { page, pageId, url, isSuite } = pageContext;
16
30
  if (isSuite || !configuration.coverage) {
@@ -29,7 +43,7 @@ export const collect = async (configuration, pageContext) => {
29
43
  }
30
44
  catch {
31
45
  logger.debug({ source: 'coverage', pageId, message: 'coverage data requires mapping' });
32
- data = remapPaths(coverageData, configuration.coverageSourceDir ?? configuration.webapp);
46
+ data = await remapPaths(coverageData, configuration.coverageSourceDir ?? configuration.webapp);
33
47
  }
34
48
  const fileName = `${pageId}.json`;
35
49
  const filePath = Path.join(configuration.coverageTempDir, fileName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui5-test-runner",
3
- "version": "6.0.5",
3
+ "version": "6.0.7",
4
4
  "description": "Standalone test runner for UI5",
5
5
  "main": "dist/cli.js",
6
6
  "type": "module",