ui5-test-runner 2.0.0 → 2.0.1
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 +2 -2
- package/src/report.js +6 -1
- package/src/reserve.js +1 -1
- package/src/simulate.spec.js +29 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui5-test-runner",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Standalone test runner for UI5",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"reserve": "^1.15.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"jest": "^29.
|
|
55
|
+
"jest": "^29.5.0",
|
|
56
56
|
"nock": "^13.3.0",
|
|
57
57
|
"nyc": "^15.1.0",
|
|
58
58
|
"standard": "^17.0.0"
|
package/src/report.js
CHANGED
|
@@ -8,7 +8,12 @@ const { fork } = require('child_process')
|
|
|
8
8
|
const { getOutput } = require('./output')
|
|
9
9
|
|
|
10
10
|
async function serialize (job, filename, json) {
|
|
11
|
-
await writeFile(join(job.reportDir, `${filename}.js`), `module.exports = ${JSON.stringify(json,
|
|
11
|
+
await writeFile(join(job.reportDir, `${filename}.js`), `module.exports = ${JSON.stringify(json, (key, value) => {
|
|
12
|
+
if (value && value instanceof RegExp) {
|
|
13
|
+
return value.toString()
|
|
14
|
+
}
|
|
15
|
+
return value
|
|
16
|
+
}, 2)}`)
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
async function save (job) {
|
package/src/reserve.js
CHANGED
|
@@ -10,6 +10,7 @@ module.exports = job => check({
|
|
|
10
10
|
port: job.port,
|
|
11
11
|
mappings: [
|
|
12
12
|
cors,
|
|
13
|
+
...job.mappings ?? [],
|
|
13
14
|
...job.serveOnly ? [] : endpoints(job),
|
|
14
15
|
...ui5(job),
|
|
15
16
|
...job.serveOnly ? [] : coverage(job), {
|
|
@@ -19,7 +20,6 @@ module.exports = job => check({
|
|
|
19
20
|
strict: true,
|
|
20
21
|
'ignore-if-not-found': true
|
|
21
22
|
},
|
|
22
|
-
...job.mappings ?? [],
|
|
23
23
|
...unhandled(job)
|
|
24
24
|
]
|
|
25
25
|
})
|
package/src/simulate.spec.js
CHANGED
|
@@ -120,6 +120,35 @@ describe('simulate', () => {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
describe('mappings', () => {
|
|
124
|
+
beforeAll(async () => {
|
|
125
|
+
await setup('mappings', {
|
|
126
|
+
mappings: [
|
|
127
|
+
'/overridden/resources/(.*)=file(./LICENSE)'
|
|
128
|
+
]
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
const urls = [
|
|
133
|
+
'/webapp/resources/sap-ui-core.js',
|
|
134
|
+
'/resources/sap-ui-core.js',
|
|
135
|
+
'/custom/resources/sap-ui-core.js'
|
|
136
|
+
]
|
|
137
|
+
urls.forEach(url => {
|
|
138
|
+
it(`fetches UI5 resources whichever path is used (${url})`, async () => {
|
|
139
|
+
const response = await get(url, 'test.html')
|
|
140
|
+
expect(response.statusCode).toStrictEqual(200)
|
|
141
|
+
expect(response.toString().includes('/sap-ui-core.js */')).toStrictEqual(true)
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
it('enables overridding through mappings', async () => {
|
|
146
|
+
const response = await get('/overridden/resources/sap-ui-core.js', 'test.html')
|
|
147
|
+
expect(response.statusCode).toStrictEqual(200)
|
|
148
|
+
expect(response.toString().startsWith('MIT License')).toStrictEqual(true)
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
|
|
123
152
|
describe('legacy (local project)', () => {
|
|
124
153
|
describe('simple test execution', () => {
|
|
125
154
|
beforeAll(async () => {
|