ui5-test-runner 5.11.1 → 5.11.2

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.
Files changed (3) hide show
  1. package/.releaserc +5 -0
  2. package/package.json +5 -4
  3. package/src/ui5.js +29 -12
package/.releaserc ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "branches": [
3
+ { "name": "5.x.y", "channel": "latest" }
4
+ ]
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui5-test-runner",
3
- "version": "5.11.1",
3
+ "version": "5.11.2",
4
4
  "description": "Standalone test runner for UI5",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -57,16 +57,17 @@
57
57
  "reserve": "2.3.4"
58
58
  },
59
59
  "devDependencies": {
60
- "@openui5/types": "^1.142.0",
60
+ "@openui5/types": "^1.143.0",
61
61
  "@semantic-release/npm": "^13.1.2",
62
- "@ui5/cli": "^4.0.35",
62
+ "@ui5/cli": "^4.0.37",
63
63
  "@ui5/middleware-code-coverage": "^2.0.2",
64
+ "baseline-browser-mapping": "^2.8.32",
64
65
  "dotenv": "^16.5.0",
65
66
  "jest": "^29.7.0",
66
67
  "nock": "^14.0.10",
67
68
  "npm-check-updates": "^18.3.0",
68
69
  "nyc": "^17.1.0",
69
- "rimraf": "^6.1.0",
70
+ "rimraf": "^6.1.2",
70
71
  "semantic-release": "^25.0.2",
71
72
  "standard": "^17.1.2",
72
73
  "typescript": "^5.9.3",
package/src/ui5.js CHANGED
@@ -16,18 +16,38 @@ const buildCacheBase = job => {
16
16
  return join(job.cache || '', hostName.replace(':', '_'), version || '')
17
17
  }
18
18
 
19
- const ui5mappings = job => {
19
+ const ui5mappings = async job => {
20
20
  const cacheBase = buildCacheBase(job)
21
21
  const match = /\/((?:test-)?resources\/.*)/ // Captured value never starts with /
22
- const ifCacheEnabled = (request, url, match) => job.cache
22
+ const ifCacheEnabled = () => job.cache
23
23
  const uncachable = {}
24
24
  const cachingInProgress = {}
25
25
 
26
+ let { ui5 } = job
27
+ if (!ui5.endsWith('/')) {
28
+ ui5 += '/'
29
+ }
30
+ const mappingUrl = new URL('$1', ui5).toString()
31
+
32
+ const inJest = typeof jest !== 'undefined'
33
+ /* istanbul ignore next */
34
+ if (!inJest) {
35
+ const versionUrl = mappingUrl.replace('$1', 'resources/sap-ui-version.json')
36
+ const versionResponse = await fetch(versionUrl)
37
+ if (versionResponse.status !== 200) {
38
+ getOutput(job).log('Unable to fetch UI5 version: ' + versionResponse.status + ' ' + versionResponse.statusText)
39
+ throw new Error('Unable to fetch UI5 version')
40
+ }
41
+ const version = await versionResponse.json()
42
+ const { version: coreVersion } = version.libraries.find(({ name }) => name === 'sap.ui.core')
43
+ getOutput(job).log('UI5 version used by the local server: ' + coreVersion)
44
+ }
45
+
26
46
  const mappings = [{
27
47
  /* Prevent caching issues :
28
- * - Caching was not possible (99% URL does not exist)
29
- * - Caching is in progress (must wait for the end of the writing stream)
30
- */
48
+ * - Caching was not possible (99% URL does not exist)
49
+ * - Caching is in progress (must wait for the end of the writing stream)
50
+ */
31
51
  match,
32
52
  'if-match': ifCacheEnabled,
33
53
  custom: async (request, response, path) => {
@@ -42,15 +62,13 @@ const ui5mappings = job => {
42
62
  await cachingPromise
43
63
  }
44
64
  }
45
- }, {
46
- // UI5 from cache
65
+ }, { // UI5 from cache
47
66
  match,
48
67
  'if-match': ifCacheEnabled,
49
68
  cwd: cacheBase,
50
69
  file: '$1',
51
70
  static: !job.debugDevMode
52
- }, {
53
- // UI5 caching
71
+ }, { // UI5 caching
54
72
  method: 'GET',
55
73
  match,
56
74
  'if-match': ifCacheEnabled,
@@ -76,11 +94,10 @@ const ui5mappings = job => {
76
94
  delete cachingInProgress[path]
77
95
  })
78
96
  }
79
- }, {
80
- // UI5 from url
97
+ }, { // UI5 from url
81
98
  method: ['GET', 'HEAD'],
82
99
  match,
83
- url: new URL('$1', job.ui5).toString(),
100
+ url: mappingUrl,
84
101
  'ignore-unverifiable-certificate': true
85
102
  }]
86
103