ui5-test-runner 1.1.2 → 1.1.3
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/README.md +1 -0
- package/index.js +1 -1
- package/package.json +8 -5
- package/src/coverage.js +9 -0
- package/src/endpoints.js +1 -1
- package/src/job.js +16 -0
- package/src/output.js +1 -1
- package/src/tests.js +1 -1
package/README.md
CHANGED
|
@@ -129,6 +129,7 @@ You may also use :
|
|
|
129
129
|
| libs | | Folder(s) containing dependent libraries *(relative to `cwd`)*.<br/>Might be used multiple times, two syntaxes are supported :<ul><li>`-libs:path` adds `path` to the list of libraries, mapped directly under `/resources/`</li><li>`-libs:rel/=path` adds the `path` to the list of libraries, mapped under `/resources/rel/`</li></ul> |
|
|
130
130
|
| cache | `''` | Cache UI5 resources locally in the given folder *(empty to disable)* |
|
|
131
131
|
| webapp | `'webapp'` | base folder of the web application *(relative to `cwd`)* |
|
|
132
|
+
| testsuite | `'test/testsuite.qunit.html'` | path / URL to the testsuite file *(relative to `webapp`)* |
|
|
132
133
|
| pageFilter | `''` | [regexp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) to select which pages to execute |
|
|
133
134
|
| pageParams | `''` | Parameters added to each page URL.<br/>For instance : `'sap-ui-theme=sap_belize&sap-ui-debug=true'` |
|
|
134
135
|
| pageTimeout | `0` | Limit the page execution time (ms), fails the page if it takes longer than the timeout (`0` to disable the timeout) |
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui5-test-runner",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Standalone test runner for UI5",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://github.com/ArnaudBuchholz/ui5-test-runner#readme",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"mime": "^
|
|
42
|
+
"mime": "^3.0.0",
|
|
43
43
|
"nyc": "^15.1.0",
|
|
44
|
-
"puppeteer": "^
|
|
45
|
-
"reserve": "^1.
|
|
44
|
+
"puppeteer": "^11.0.0",
|
|
45
|
+
"reserve": "^1.12.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"jest": "^27.3.1",
|
|
49
|
-
"nock": "^13.1
|
|
49
|
+
"nock": "^13.2.1",
|
|
50
50
|
"standard": "^16.0.4"
|
|
51
51
|
},
|
|
52
52
|
"standard": {
|
|
@@ -58,6 +58,9 @@
|
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
60
|
"jest": {
|
|
61
|
+
"setupFilesAfterEnv": [
|
|
62
|
+
"./__mocks__/setup.js"
|
|
63
|
+
],
|
|
61
64
|
"collectCoverage": true,
|
|
62
65
|
"collectCoverageFrom": [
|
|
63
66
|
"src/*.js"
|
package/src/coverage.js
CHANGED
|
@@ -44,6 +44,15 @@ async function instrument (job) {
|
|
|
44
44
|
await createDir(join(job.covTempDir, 'settings'))
|
|
45
45
|
const settings = JSON.parse((await readFile(job.covSettings)).toString())
|
|
46
46
|
settings.cwd = job.cwd
|
|
47
|
+
if (!settings.exclude) {
|
|
48
|
+
settings.exclude = []
|
|
49
|
+
}
|
|
50
|
+
settings.exclude.push(join(job.covTempDir, '**'))
|
|
51
|
+
if (job.cache) {
|
|
52
|
+
settings.exclude.push(join(job.cache, '**'))
|
|
53
|
+
}
|
|
54
|
+
settings.exclude.push(join(job.tstReportDir, '**'))
|
|
55
|
+
settings.exclude.push(join(job.covReportDir, '**'))
|
|
47
56
|
await writeFile(job.nycSettingsPath, JSON.stringify(settings))
|
|
48
57
|
await nyc('instrument', job.webapp, join(job.covTempDir, 'instrumented'), '--nycrc-path', job.nycSettingsPath)
|
|
49
58
|
}
|
package/src/endpoints.js
CHANGED
|
@@ -130,7 +130,7 @@ module.exports = job => {
|
|
|
130
130
|
job.testPages[url] = page
|
|
131
131
|
})
|
|
132
132
|
}, {
|
|
133
|
-
// Endpoint to receive QUnit.
|
|
133
|
+
// Endpoint to receive QUnit.log
|
|
134
134
|
match: '^/_/QUnit/log',
|
|
135
135
|
custom: synchronousEndpoint(async (url, report) => {
|
|
136
136
|
const page = job.testPages[url]
|
package/src/job.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { accessSync } = require('fs')
|
|
3
4
|
const { join, isAbsolute } = require('path')
|
|
4
5
|
const output = require('./output')
|
|
5
6
|
|
|
@@ -12,6 +13,7 @@ function allocate (cwd) {
|
|
|
12
13
|
libs: [],
|
|
13
14
|
cache: '',
|
|
14
15
|
webapp: 'webapp',
|
|
16
|
+
testsuite: 'test/testsuite.qunit.html',
|
|
15
17
|
pageFilter: '',
|
|
16
18
|
pageParams: '',
|
|
17
19
|
pageTimeout: 0,
|
|
@@ -37,6 +39,14 @@ function allocate (cwd) {
|
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
function checkAccess (path, label) {
|
|
43
|
+
try {
|
|
44
|
+
accessSync(path)
|
|
45
|
+
} catch (error) {
|
|
46
|
+
throw new Error(`Unable to access ${label}, check your settings`)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
40
50
|
function finalize (job) {
|
|
41
51
|
Object.keys(job)
|
|
42
52
|
.filter(name => name.startsWith('!'))
|
|
@@ -57,9 +67,15 @@ function finalize (job) {
|
|
|
57
67
|
'webapp,browser,tstReportDir,covSettings,covTempDir,covReportDir'
|
|
58
68
|
.split(',')
|
|
59
69
|
.forEach(setting => updateToAbsolute(setting))
|
|
70
|
+
checkAccess(job.webapp, 'webapp folder')
|
|
71
|
+
checkAccess(job.browser, 'browser command')
|
|
72
|
+
|
|
73
|
+
const testsuitePath = toAbsolute(job.testsuite, job.webapp)
|
|
74
|
+
checkAccess(testsuitePath, 'testsuite')
|
|
60
75
|
|
|
61
76
|
job.libs.forEach(libMapping => {
|
|
62
77
|
libMapping.source = toAbsolute(libMapping.source)
|
|
78
|
+
checkAccess(libMapping.source, `lib mapping of ${libMapping.relative}`)
|
|
63
79
|
})
|
|
64
80
|
|
|
65
81
|
if (job.parallel <= 0) {
|
package/src/output.js
CHANGED
|
@@ -188,7 +188,7 @@ module.exports = {
|
|
|
188
188
|
console.error(`Unable to cache '${path}' (status ${statusCode})`)
|
|
189
189
|
},
|
|
190
190
|
genericError (error) {
|
|
191
|
-
console.error('An unexpected error occurred', error)
|
|
191
|
+
console.error('An unexpected error occurred :', error.message || error)
|
|
192
192
|
},
|
|
193
193
|
unhandled () {
|
|
194
194
|
console.warn('Some requests are not handled properly, check the unhandled.txt report for more info')
|
package/src/tests.js
CHANGED
|
@@ -26,7 +26,7 @@ async function extractTestPages (job) {
|
|
|
26
26
|
await saveJob(job)
|
|
27
27
|
job.status = 'Extracting test pages'
|
|
28
28
|
job.testPageUrls = []
|
|
29
|
-
await start(job, '/
|
|
29
|
+
await start(job, '/' + job.testsuite)
|
|
30
30
|
if (job.testPageUrls.length === 0) {
|
|
31
31
|
output.noTestPageFound()
|
|
32
32
|
job.failed = true
|