ui5-test-runner 5.2.0 → 5.3.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 +7 -7
- package/src/coverage.js +21 -7
- package/src/inject/post.js +9 -6
- package/src/inject/qunit-intercept.js +3 -1
- package/src/inject/qunit-redirect.js +14 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui5-test-runner",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Standalone test runner for UI5",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -46,21 +46,21 @@
|
|
|
46
46
|
"commander": "^12.1.0",
|
|
47
47
|
"punybind": "^1.2.1",
|
|
48
48
|
"punyexpr": "^1.0.4",
|
|
49
|
-
"reserve": "2.0.
|
|
49
|
+
"reserve": "2.0.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@openui5/types": "^1.
|
|
53
|
-
"@ui5/cli": "^3.
|
|
52
|
+
"@openui5/types": "^1.125.0",
|
|
53
|
+
"@ui5/cli": "^3.11.0",
|
|
54
54
|
"@ui5/middleware-code-coverage": "^1.1.1",
|
|
55
55
|
"dotenv": "^16.4.5",
|
|
56
56
|
"jest": "^29.7.0",
|
|
57
57
|
"nock": "^13.5.4",
|
|
58
|
-
"nyc": "^
|
|
58
|
+
"nyc": "^17.0.0",
|
|
59
59
|
"rimraf": "^5.0.7",
|
|
60
60
|
"standard": "^17.1.0",
|
|
61
61
|
"start-server-and-test": "^2.0.4",
|
|
62
|
-
"typescript": "^5.
|
|
63
|
-
"ui5-tooling-transpile": "^3.4.
|
|
62
|
+
"typescript": "^5.5.2",
|
|
63
|
+
"ui5-tooling-transpile": "^3.4.5"
|
|
64
64
|
},
|
|
65
65
|
"optionalDependencies": {
|
|
66
66
|
"fsevents": "^2.3.3"
|
package/src/coverage.js
CHANGED
|
@@ -310,13 +310,27 @@ module.exports = {
|
|
|
310
310
|
await setupNyc(job)
|
|
311
311
|
// Assuming all files are coming from the same server
|
|
312
312
|
const { origin } = new URL(job.url[0])
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
313
|
+
let instrument
|
|
314
|
+
try {
|
|
315
|
+
const { createInstrumenter } = require(join(await nycInstallationPath, 'node_modules/istanbul-lib-instrument'))
|
|
316
|
+
const instrumenter = createInstrumenter({
|
|
317
|
+
produceSourceMap: true,
|
|
318
|
+
coverageGlobalScope: 'window.top',
|
|
319
|
+
coverageGlobalScopeFunc: false
|
|
320
|
+
})
|
|
321
|
+
instrument = promisify(instrumenter.instrument.bind(instrumenter))
|
|
322
|
+
} catch (e) {
|
|
323
|
+
// Recent version of nyc offers a different interface
|
|
324
|
+
const createInstrumenter = require(join(await nycInstallationPath, 'lib/instrumenters/istanbul.js'))
|
|
325
|
+
const instrumenter = createInstrumenter({
|
|
326
|
+
produceSourceMap: true
|
|
327
|
+
})
|
|
328
|
+
instrument = async function (code, sourcePath) {
|
|
329
|
+
return instrumenter.instrumentSync(code, sourcePath, { registerMap: () => {} })
|
|
330
|
+
// TODO use regular expression !
|
|
331
|
+
.replace(globalContextSearch, globalContextReplace)
|
|
332
|
+
}
|
|
333
|
+
}
|
|
320
334
|
const sources = {}
|
|
321
335
|
return [{
|
|
322
336
|
match: /(.*\.js)(\?.*)?$/,
|
package/src/inject/post.js
CHANGED
|
@@ -9,14 +9,17 @@
|
|
|
9
9
|
const base = window['ui5-test-runner/base-host'] || ''
|
|
10
10
|
|
|
11
11
|
let lastPost = Promise.resolve()
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
function isUI5Object (obj) {
|
|
14
|
+
return typeof obj === 'object' &&
|
|
15
|
+
obj !== null &&
|
|
16
|
+
typeof obj.getId === 'function' &&
|
|
17
|
+
typeof obj.getMetadata === 'function'
|
|
18
|
+
}
|
|
13
19
|
|
|
14
20
|
function stringify (data) {
|
|
15
21
|
const objects = []
|
|
16
22
|
const referenced = []
|
|
17
|
-
if (!UI5Object && window.sap && window.sap.ui && window.sap.ui.base) {
|
|
18
|
-
UI5Object = window.sap.ui.base.Object
|
|
19
|
-
}
|
|
20
23
|
const ui5Summary = obj => {
|
|
21
24
|
const id = obj.getId && obj.getId()
|
|
22
25
|
const className = obj.getMetadata && obj.getMetadata() && obj.getMetadata().getName()
|
|
@@ -27,7 +30,7 @@
|
|
|
27
30
|
}
|
|
28
31
|
const simple = JSON.stringify(data, function (key, value) {
|
|
29
32
|
if (typeof value === 'object' && value) {
|
|
30
|
-
if (
|
|
33
|
+
if (isUI5Object(value)) {
|
|
31
34
|
return ui5Summary(value)
|
|
32
35
|
}
|
|
33
36
|
const id = objects.indexOf(value)
|
|
@@ -45,7 +48,7 @@
|
|
|
45
48
|
const stringified = []
|
|
46
49
|
return JSON.stringify(data, function (key, value) {
|
|
47
50
|
if (typeof value === 'object' && value) {
|
|
48
|
-
if (
|
|
51
|
+
if (isUI5Object(value)) {
|
|
49
52
|
return ui5Summary(value)
|
|
50
53
|
}
|
|
51
54
|
const id = objects.indexOf(value)
|
|
@@ -33,20 +33,22 @@
|
|
|
33
33
|
QUnit = value
|
|
34
34
|
|
|
35
35
|
const { test } = QUnit
|
|
36
|
-
|
|
36
|
+
if (typeof test === 'function') {
|
|
37
|
+
QUnit.test = (label) => test(label, (assert) => assert.ok(true, label))
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
let timeoutId
|
|
40
|
+
QUnit.moduleDone(function () {
|
|
41
|
+
if (timeoutId) {
|
|
42
|
+
clearTimeout(timeoutId)
|
|
43
|
+
}
|
|
44
|
+
timeoutId = setTimeout(notify, 10)
|
|
45
|
+
})
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
function notify () {
|
|
48
|
+
const modules = QUnit.config.modules.map(({ moduleId }) => moduleId)
|
|
49
|
+
const opa = !!window?.sap?.ui?.test?.Opa5
|
|
50
|
+
post('addTestPages', { type: 'qunit', opa, modules, page: location.toString() })
|
|
51
|
+
}
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
})
|