ui5-test-runner 4.1.0 โ 4.2.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 +4 -4
- package/src/inject/post.js +2 -3
- package/src/job-mode.js +2 -1
- package/src/job.js +4 -0
- package/src/npm.js +33 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui5-test-runner",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Standalone test runner for UI5",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -69,16 +69,16 @@
|
|
|
69
69
|
"reserve": "^1.15.6"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@openui5/types": "^1.
|
|
72
|
+
"@openui5/types": "^1.121.0",
|
|
73
73
|
"@ui5/cli": "^3.9.1",
|
|
74
74
|
"@ui5/middleware-code-coverage": "^1.1.1",
|
|
75
75
|
"jest": "^29.7.0",
|
|
76
|
-
"nock": "^13.5.
|
|
76
|
+
"nock": "^13.5.3",
|
|
77
77
|
"nyc": "^15.1.0",
|
|
78
78
|
"standard": "^17.1.0",
|
|
79
79
|
"start-server-and-test": "^2.0.3",
|
|
80
80
|
"typescript": "^5.3.3",
|
|
81
|
-
"ui5-tooling-transpile": "^3.3.
|
|
81
|
+
"ui5-tooling-transpile": "^3.3.5"
|
|
82
82
|
},
|
|
83
83
|
"optionalDependencies": {
|
|
84
84
|
"fsevents": "^2.3.3"
|
package/src/inject/post.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
const ui5Summary = obj => {
|
|
21
21
|
const id = obj.getId && obj.getId()
|
|
22
|
-
const className = obj.getMetadata().getName()
|
|
22
|
+
const className = obj.getMetadata && obj.getMetadata() && obj.getMetadata().getName()
|
|
23
23
|
return {
|
|
24
24
|
'ui5:class': className,
|
|
25
25
|
'ui5:id': id
|
|
@@ -87,11 +87,10 @@
|
|
|
87
87
|
})
|
|
88
88
|
}
|
|
89
89
|
lastPost = lastPost
|
|
90
|
+
.then(request)
|
|
90
91
|
.then(undefined, function (reason) {
|
|
91
92
|
console.error('Failed to POST to ' + url + '\nreason: ' + reason.toString())
|
|
92
|
-
throw new Error('failed')
|
|
93
93
|
})
|
|
94
|
-
.then(request)
|
|
95
94
|
return lastPost
|
|
96
95
|
}
|
|
97
96
|
}())
|
package/src/job-mode.js
CHANGED
package/src/job.js
CHANGED
|
@@ -102,6 +102,7 @@ function getCommand (cwd) {
|
|
|
102
102
|
.option('-p, --parallel <count>', '[๐ป๐๐งช] Number of parallel tests executions', 2)
|
|
103
103
|
.option('-b, --browser <command>', '[๐ป๐๐งช] Browser instantiation command (relative to cwd or use $/ for provided ones)', '$/puppeteer.js')
|
|
104
104
|
.option('--browser-args <argument...>', '[๐ป๐๐งช] Browser instantiation command parameters (use -- instead)')
|
|
105
|
+
.option('--alternate-npm-path <path>', '[๐ป๐] Alternate NPM path to look for packages (priority: local, alternate, global)')
|
|
105
106
|
.option('--no-npm-install', '[๐ป๐๐งช] Prevent any NPM install (execution may fail if a dependency is missing)')
|
|
106
107
|
.option('-bt, --browser-close-timeout <timeout>', '[๐ป๐๐งช] Maximum waiting time for browser close', timeout, 2000)
|
|
107
108
|
.option('-br, --browser-retry <count>', '[๐ป๐๐งช] Browser instantiation retries : if the command fails unexpectedly, it is re-executed (0 means no retry)', 1)
|
|
@@ -224,6 +225,9 @@ function finalize (job) {
|
|
|
224
225
|
if (job.cache) {
|
|
225
226
|
updateToAbsolute('cache')
|
|
226
227
|
}
|
|
228
|
+
if (job.alternateNpmPath) {
|
|
229
|
+
checkAccess({ path: job.alternateNpmPath, label: 'Alternate NPM path' })
|
|
230
|
+
}
|
|
227
231
|
job.mode = buildAndCheckMode(job)
|
|
228
232
|
if (job.mode === 'legacy') {
|
|
229
233
|
checkAccess({ path: job.webapp, label: 'webapp folder' })
|
package/src/npm.js
CHANGED
|
@@ -41,6 +41,38 @@ function resolveDependencyPath (name) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
async function findDependencyPath (job, name) {
|
|
45
|
+
if (!localRoot) {
|
|
46
|
+
[localRoot, globalRoot] = await Promise.all([
|
|
47
|
+
npm(job, 'root'),
|
|
48
|
+
npm(job, 'root', '--global')
|
|
49
|
+
])
|
|
50
|
+
}
|
|
51
|
+
const localPath = join(localRoot, name)
|
|
52
|
+
if (await folderExists(localPath)) {
|
|
53
|
+
return [localPath, false]
|
|
54
|
+
}
|
|
55
|
+
if (job.alternateNpmPath) {
|
|
56
|
+
const alternatePath = join(job.alternateNpmPath, name)
|
|
57
|
+
if (await folderExists(alternatePath)) {
|
|
58
|
+
return [alternatePath, false]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const globalPath = join(globalRoot, name)
|
|
62
|
+
let justInstalled = false
|
|
63
|
+
if (!await folderExists(globalPath)) {
|
|
64
|
+
if (!job.npmInstall) {
|
|
65
|
+
throw UTRError.NPM_DEPENDENCY_NOT_FOUND(name)
|
|
66
|
+
}
|
|
67
|
+
const previousStatus = job.status
|
|
68
|
+
job.status = `Installing ${name}...`
|
|
69
|
+
await npm(job, 'install', name, '-g')
|
|
70
|
+
justInstalled = true
|
|
71
|
+
job.status = previousStatus
|
|
72
|
+
}
|
|
73
|
+
return [globalPath, justInstalled]
|
|
74
|
+
}
|
|
75
|
+
|
|
44
76
|
module.exports = {
|
|
45
77
|
resolveDependencyPath,
|
|
46
78
|
|
|
@@ -52,29 +84,7 @@ module.exports = {
|
|
|
52
84
|
} catch (e) {
|
|
53
85
|
}
|
|
54
86
|
if (!modulePath) {
|
|
55
|
-
|
|
56
|
-
[localRoot, globalRoot] = await Promise.all([
|
|
57
|
-
npm(job, 'root'),
|
|
58
|
-
npm(job, 'root', '--global')
|
|
59
|
-
])
|
|
60
|
-
}
|
|
61
|
-
const localPath = join(localRoot, name)
|
|
62
|
-
if (await folderExists(localPath)) {
|
|
63
|
-
modulePath = localPath
|
|
64
|
-
} else {
|
|
65
|
-
const globalPath = join(globalRoot, name)
|
|
66
|
-
if (!await folderExists(globalPath)) {
|
|
67
|
-
if (!job.npmInstall) {
|
|
68
|
-
throw UTRError.NPM_DEPENDENCY_NOT_FOUND(name)
|
|
69
|
-
}
|
|
70
|
-
const previousStatus = job.status
|
|
71
|
-
job.status = `Installing ${name}...`
|
|
72
|
-
await npm(job, 'install', name, '-g')
|
|
73
|
-
justInstalled = true
|
|
74
|
-
job.status = previousStatus
|
|
75
|
-
}
|
|
76
|
-
modulePath = globalPath
|
|
77
|
-
}
|
|
87
|
+
[modulePath, justInstalled] = await findDependencyPath(job, name)
|
|
78
88
|
}
|
|
79
89
|
const output = getOutput(job)
|
|
80
90
|
const installedPackage = require(join(modulePath, 'package.json'))
|