ui5-test-runner 5.2.0 → 5.3.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 +7 -7
- package/src/add-test-pages.js +8 -5
- package/src/browsers.js +301 -297
- package/src/coverage.js +21 -7
- package/src/inject/post.js +19 -12
- package/src/inject/qunit-intercept.js +3 -1
- package/src/inject/qunit-redirect.js +15 -12
- package/src/job.js +393 -392
- package/src/output.js +608 -604
- package/src/qunit-hooks.js +10 -4
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)
|
|
@@ -71,6 +74,8 @@
|
|
|
71
74
|
|
|
72
75
|
window['ui5-test-runner/stringify'] = stringify
|
|
73
76
|
|
|
77
|
+
const xPageUrl = top.location.toString()
|
|
78
|
+
|
|
74
79
|
window[MODULE] = function post (url, data) {
|
|
75
80
|
function request () {
|
|
76
81
|
return new Promise(function (resolve, reject) {
|
|
@@ -82,18 +87,20 @@
|
|
|
82
87
|
reject(xhr.statusText)
|
|
83
88
|
})
|
|
84
89
|
xhr.open('POST', base + '/_/' + url)
|
|
85
|
-
xhr.setRequestHeader('x-page-url',
|
|
90
|
+
xhr.setRequestHeader('x-page-url', xPageUrl)
|
|
86
91
|
xhr.setRequestHeader('content-type', 'application/json')
|
|
87
92
|
const json = stringify(data)
|
|
88
93
|
xhr.setRequestHeader('content-length', json.length)
|
|
89
94
|
xhr.send(json)
|
|
90
95
|
})
|
|
91
96
|
}
|
|
92
|
-
lastPost = lastPost
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
lastPost = lastPost.then(request)
|
|
98
|
+
if (!window.__unsafe__) {
|
|
99
|
+
lastPost = lastPost
|
|
100
|
+
.then(undefined, function (reason) {
|
|
101
|
+
console.error('Failed to POST to ' + url + '\nreason: ' + reason.toString())
|
|
102
|
+
})
|
|
103
|
+
}
|
|
97
104
|
return lastPost
|
|
98
105
|
}
|
|
99
106
|
}())
|
|
@@ -33,20 +33,23 @@
|
|
|
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 moduleIds = QUnit.config.modules.map(({ moduleId }) => moduleId).filter(moduleId => !!moduleId)
|
|
49
|
+
const moduleNames = QUnit.config.modules.map(({ name }) => name)
|
|
50
|
+
const opa = !!window?.sap?.ui?.test?.Opa5
|
|
51
|
+
post('addTestPages', { type: 'qunit', opa, module: { ids: moduleIds.length ? moduleIds : undefined, names: moduleNames }, page: location.toString() })
|
|
52
|
+
}
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
})
|