ui5-test-runner 2.0.2 → 2.0.4
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 +1 -1
- package/src/browser.spec.js +1 -1
- package/src/defaults/junit-xml-report.js +12 -5
- package/src/npm.js +29 -22
- package/src/npm.spec.js +1 -1
package/package.json
CHANGED
package/src/browser.spec.js
CHANGED
|
@@ -142,7 +142,7 @@ describe('src/browser', () => {
|
|
|
142
142
|
})
|
|
143
143
|
await probe(job)
|
|
144
144
|
expect(job.browserCapabilities.modules).toStrictEqual(['reserve', 'dependentModule'])
|
|
145
|
-
expect(job.browserModules.reserve).toStrictEqual(
|
|
145
|
+
expect(job.browserModules.reserve).toStrictEqual('reserve')
|
|
146
146
|
expect(job.browserModules.dependentModule).toStrictEqual(join(npmGlobal, 'dependentModule'))
|
|
147
147
|
})
|
|
148
148
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
// Based on specification from llg[.]cubic[.]org/docs/junit/
|
|
4
|
+
|
|
3
5
|
const { join } = require('path')
|
|
4
6
|
const { writeFile } = require('fs').promises
|
|
5
|
-
const [
|
|
7
|
+
const [, , reportDir] = process.argv
|
|
6
8
|
|
|
7
9
|
const output = []
|
|
8
10
|
function o (text) {
|
|
@@ -38,12 +40,17 @@ async function main () {
|
|
|
38
40
|
if (test.skip) {
|
|
39
41
|
o(' <skipped></skipped>')
|
|
40
42
|
} else if (test.report.failed) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
test.logs
|
|
44
|
+
.filter(({ result }) => !result)
|
|
45
|
+
.forEach(log => {
|
|
46
|
+
o(` <failure
|
|
43
47
|
message="${xmlEscape(log.message)}"
|
|
44
48
|
>`)
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
if (log.source) {
|
|
50
|
+
o(xmlEscape(log.source))
|
|
51
|
+
}
|
|
52
|
+
o(' </failure>')
|
|
53
|
+
})
|
|
47
54
|
}
|
|
48
55
|
o(' </testcase>')
|
|
49
56
|
}
|
package/src/npm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { exec } = require('child_process')
|
|
2
2
|
const { join } = require('path')
|
|
3
|
-
const { stat
|
|
3
|
+
const { stat } = require('fs/promises')
|
|
4
4
|
const { UTRError } = require('./error')
|
|
5
5
|
const { getOutput } = require('./output')
|
|
6
6
|
|
|
@@ -38,33 +38,40 @@ module.exports = {
|
|
|
38
38
|
},
|
|
39
39
|
|
|
40
40
|
async resolvePackage (job, name) {
|
|
41
|
-
if (!localRoot) {
|
|
42
|
-
[localRoot, globalRoot] = await Promise.all([
|
|
43
|
-
npm(job, 'root'),
|
|
44
|
-
npm(job, 'root', '--global')
|
|
45
|
-
])
|
|
46
|
-
}
|
|
47
41
|
let modulePath
|
|
48
42
|
let justInstalled = false
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
modulePath =
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
try {
|
|
44
|
+
require(name)
|
|
45
|
+
modulePath = name
|
|
46
|
+
} catch (e) {
|
|
47
|
+
}
|
|
48
|
+
if (!modulePath) {
|
|
49
|
+
if (!localRoot) {
|
|
50
|
+
[localRoot, globalRoot] = await Promise.all([
|
|
51
|
+
npm(job, 'root'),
|
|
52
|
+
npm(job, 'root', '--global')
|
|
53
|
+
])
|
|
54
|
+
}
|
|
55
|
+
const localPath = join(localRoot, name)
|
|
56
|
+
if (await folderExists(localPath)) {
|
|
57
|
+
modulePath = localPath
|
|
58
|
+
} else {
|
|
59
|
+
const globalPath = join(globalRoot, name)
|
|
60
|
+
if (!await folderExists(globalPath)) {
|
|
61
|
+
if (!job.npmInstall) {
|
|
62
|
+
throw UTRError.NPM_DEPENDENCY_NOT_FOUND(name)
|
|
63
|
+
}
|
|
64
|
+
const previousStatus = job.status
|
|
65
|
+
job.status = `Installing ${name}...`
|
|
66
|
+
await npm(job, 'install', name, '-g')
|
|
67
|
+
justInstalled = true
|
|
68
|
+
job.status = previousStatus
|
|
57
69
|
}
|
|
58
|
-
|
|
59
|
-
job.status = `Installing ${name}...`
|
|
60
|
-
await npm(job, 'install', name, '-g')
|
|
61
|
-
justInstalled = true
|
|
62
|
-
job.status = previousStatus
|
|
70
|
+
modulePath = globalPath
|
|
63
71
|
}
|
|
64
|
-
modulePath = globalPath
|
|
65
72
|
}
|
|
66
73
|
const output = getOutput(job)
|
|
67
|
-
const installedPackage =
|
|
74
|
+
const installedPackage = require(join(modulePath, 'package.json'))
|
|
68
75
|
const { version: installedVersion } = installedPackage
|
|
69
76
|
output.resolvedPackage(name, modulePath, installedVersion)
|
|
70
77
|
if (!justInstalled) {
|
package/src/npm.spec.js
CHANGED
|
@@ -40,7 +40,7 @@ describe('src/npm', () => {
|
|
|
40
40
|
|
|
41
41
|
it('detects already installed local package', async () => {
|
|
42
42
|
const path = await resolvePackage(job, 'reserve')
|
|
43
|
-
expect(path).toStrictEqual(
|
|
43
|
+
expect(path).toStrictEqual('reserve')
|
|
44
44
|
expect(output.resolvedPackage).toHaveBeenCalledTimes(1)
|
|
45
45
|
expect(output.packageNotLatest).not.toHaveBeenCalled()
|
|
46
46
|
})
|