@jsenv/core 23.2.2 → 23.4.2
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/{license → LICENSE} +0 -0
- package/package.json +13 -14
- package/readme.md +4 -4
- package/src/buildProject.js +12 -13
- package/src/execute.js +92 -93
- package/src/executeTestPlan.js +9 -8
- package/src/internal/browser-launcher/executeHtmlFile.js +26 -23
- package/src/internal/building/buildUsingRollup.js +3 -4
- package/src/internal/building/build_logs.js +7 -6
- package/src/internal/building/createJsenvRollupPlugin.js +9 -14
- package/src/internal/building/url_trace.js +3 -4
- package/src/internal/compiling/createCompiledFileService.js +21 -6
- package/src/internal/compiling/startCompileServer.js +55 -46
- package/src/internal/executing/coverage/babel_plugin_instrument.js +1 -0
- package/src/internal/executing/coverage/reportToCoverage.js +147 -120
- package/src/internal/executing/{coverage → coverage_empty}/createEmptyCoverage.js +0 -0
- package/src/internal/executing/coverage_empty/list_files_not_covered.js +20 -0
- package/src/internal/executing/{coverage → coverage_empty}/relativeUrlToEmptyCoverage.js +3 -4
- package/src/internal/executing/{coverage/generateCoverageHtmlDirectory.js → coverage_reporter/coverage_reporter_html_directory.js} +11 -4
- package/src/internal/executing/{coverage/generateCoverageJsonFile.js → coverage_reporter/coverage_reporter_json_file.js} +0 -0
- package/src/internal/executing/{coverage/generateCoverageTextLog.js → coverage_reporter/coverage_reporter_text_log.js} +4 -2
- package/src/internal/executing/{coverage → coverage_reporter}/istanbulCoverageMapFromCoverage.js +0 -0
- package/src/internal/executing/{coverage/normalizeIstanbulCoverage.js → coverage_utils/file_by_file_coverage.js} +9 -7
- package/src/internal/executing/coverage_utils/istanbul_coverage_composition.js +28 -0
- package/src/internal/executing/coverage_utils/v8_and_istanbul.js +38 -0
- package/src/internal/executing/coverage_utils/v8_coverage_composition.js +23 -0
- package/src/internal/executing/coverage_utils/v8_coverage_from_directory.js +65 -0
- package/src/internal/executing/coverage_utils/v8_coverage_to_istanbul.js +90 -0
- package/src/internal/executing/createSummaryLog.js +15 -15
- package/src/internal/executing/executeConcurrently.js +92 -32
- package/src/internal/executing/executePlan.js +84 -81
- package/src/internal/executing/executionLogs.js +14 -18
- package/src/internal/executing/execution_colors.js +6 -12
- package/src/internal/executing/launchAndExecute.js +172 -169
- package/src/internal/node-launcher/createControllableNodeProcess.js +26 -23
- package/src/launchBrowser.js +72 -69
- package/src/launchNode.js +11 -99
- package/src/startExploring.js +2 -17
- package/src/abort/abortable.js +0 -172
- package/src/abort/callback_list.js +0 -64
- package/src/abort/callback_race.js +0 -34
- package/src/abort/cleaner.js +0 -22
- package/src/abort/main.js +0 -32
- package/src/abort/process_teardown_events.js +0 -59
- package/src/internal/createCallbackList.js +0 -21
- package/src/internal/executing/coverage/composeIstanbulCoverages.js +0 -108
- package/src/internal/executing/coverage/composeV8Coverages.js +0 -20
- package/src/internal/executing/coverage/istanbulCoverageFromCoverages.js +0 -43
- package/src/internal/executing/coverage/istanbulCoverageFromV8Coverage.js +0 -79
- package/src/internal/executing/coverage/v8CoverageFromAllV8Coverages.js +0 -40
- package/src/internal/executing/coverage/v8CoverageFromNodeV8Directory.js +0 -67
- package/src/internal/executing/logUtils.js +0 -30
- package/src/internal/executing/writeLog.js +0 -106
- package/src/internal/executing/writeLog.test-manual.js +0 -62
- package/src/internal/logs/log_style.js +0 -40
- package/src/signal/signal.js +0 -65
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { urlToFileSystemPath } from "@jsenv/filesystem"
|
|
2
|
+
|
|
3
|
+
import { require } from "@jsenv/core/src/internal/require.js"
|
|
4
|
+
|
|
5
|
+
import { composeTwoFileByFileIstanbulCoverages } from "./istanbul_coverage_composition.js"
|
|
6
|
+
|
|
7
|
+
export const v8CoverageToIstanbul = async (v8Coverage) => {
|
|
8
|
+
const v8ToIstanbul = require("v8-to-istanbul")
|
|
9
|
+
const sourcemapCache = v8Coverage["source-map-cache"]
|
|
10
|
+
let istanbulCoverageComposed = null
|
|
11
|
+
await v8Coverage.result.reduce(async (previous, fileV8Coverage) => {
|
|
12
|
+
await previous
|
|
13
|
+
|
|
14
|
+
const { source } = fileV8Coverage
|
|
15
|
+
let sources
|
|
16
|
+
// when v8 coverage comes from playwright (chromium) v8Coverage.source is set
|
|
17
|
+
if (typeof source === "string") {
|
|
18
|
+
sources = { source }
|
|
19
|
+
}
|
|
20
|
+
// when v8 coverage comes from Node.js, the source can be read from sourcemapCache
|
|
21
|
+
else if (sourcemapCache) {
|
|
22
|
+
sources = sourcesFromSourceMapCache(fileV8Coverage.url, sourcemapCache)
|
|
23
|
+
}
|
|
24
|
+
const path = urlToFileSystemPath(fileV8Coverage.url)
|
|
25
|
+
|
|
26
|
+
const converter = v8ToIstanbul(
|
|
27
|
+
path,
|
|
28
|
+
// wrapperLength is undefined we don't need it
|
|
29
|
+
// https://github.com/istanbuljs/v8-to-istanbul/blob/2b54bc97c5edf8a37b39a171ec29134ba9bfd532/lib/v8-to-istanbul.js#L27
|
|
30
|
+
undefined,
|
|
31
|
+
sources,
|
|
32
|
+
)
|
|
33
|
+
await converter.load()
|
|
34
|
+
|
|
35
|
+
converter.applyCoverage(fileV8Coverage.functions)
|
|
36
|
+
const istanbulCoverage = converter.toIstanbul()
|
|
37
|
+
|
|
38
|
+
istanbulCoverageComposed = istanbulCoverageComposed
|
|
39
|
+
? composeTwoFileByFileIstanbulCoverages(
|
|
40
|
+
istanbulCoverageComposed,
|
|
41
|
+
istanbulCoverage,
|
|
42
|
+
)
|
|
43
|
+
: istanbulCoverage
|
|
44
|
+
}, Promise.resolve())
|
|
45
|
+
|
|
46
|
+
if (!istanbulCoverageComposed) {
|
|
47
|
+
return {}
|
|
48
|
+
}
|
|
49
|
+
istanbulCoverageComposed = markAsConvertedFromV8(istanbulCoverageComposed)
|
|
50
|
+
return istanbulCoverageComposed
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const markAsConvertedFromV8 = (fileByFileCoverage) => {
|
|
54
|
+
const fileByFileMarked = {}
|
|
55
|
+
Object.keys(fileByFileCoverage).forEach((key) => {
|
|
56
|
+
const fileCoverage = fileByFileCoverage[key]
|
|
57
|
+
fileByFileMarked[key] = {
|
|
58
|
+
...fileCoverage,
|
|
59
|
+
fromV8: true,
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
return fileByFileMarked
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const sourcesFromSourceMapCache = (url, sourceMapCache) => {
|
|
66
|
+
const sourceMapAndLineLengths = sourceMapCache[url]
|
|
67
|
+
if (!sourceMapAndLineLengths) {
|
|
68
|
+
return {}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const { data, lineLengths } = sourceMapAndLineLengths
|
|
72
|
+
// See: https://github.com/nodejs/node/pull/34305
|
|
73
|
+
if (!data) {
|
|
74
|
+
return undefined
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const sources = {
|
|
78
|
+
sourcemap: data,
|
|
79
|
+
...(lineLengths ? { source: sourcesFromLineLengths(lineLengths) } : {}),
|
|
80
|
+
}
|
|
81
|
+
return sources
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const sourcesFromLineLengths = (lineLengths) => {
|
|
85
|
+
let source = ""
|
|
86
|
+
lineLengths.forEach((length) => {
|
|
87
|
+
source += `${"".padEnd(length, ".")}\n`
|
|
88
|
+
})
|
|
89
|
+
return source
|
|
90
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ANSI } from "@jsenv/log"
|
|
2
|
+
|
|
2
3
|
import { msAsDuration } from "../logs/msAsDuration.js"
|
|
3
4
|
import { EXECUTION_COLORS } from "./execution_colors.js"
|
|
4
5
|
|
|
@@ -20,7 +21,9 @@ const createSummaryMessage = ({
|
|
|
20
21
|
return `no execution`
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
const executionLabel =
|
|
25
|
+
executionCount === 1 ? `1 execution` : `${executionCount} executions`
|
|
26
|
+
return `${executionLabel}: ${createSummaryDetails({
|
|
24
27
|
executionCount,
|
|
25
28
|
abortedCount,
|
|
26
29
|
timedoutCount,
|
|
@@ -39,19 +42,19 @@ export const createSummaryDetails = ({
|
|
|
39
42
|
cancelledCount,
|
|
40
43
|
}) => {
|
|
41
44
|
if (abortedCount === executionCount) {
|
|
42
|
-
return `all ${
|
|
45
|
+
return `all ${ANSI.color(`aborted`, EXECUTION_COLORS.aborted)}`
|
|
43
46
|
}
|
|
44
47
|
if (timedoutCount === executionCount) {
|
|
45
|
-
return `all ${
|
|
48
|
+
return `all ${ANSI.color(`timed out`, EXECUTION_COLORS.timedout)}`
|
|
46
49
|
}
|
|
47
50
|
if (erroredCount === executionCount) {
|
|
48
|
-
return `all ${
|
|
51
|
+
return `all ${ANSI.color(`errored`, EXECUTION_COLORS.errored)}`
|
|
49
52
|
}
|
|
50
53
|
if (completedCount === executionCount) {
|
|
51
|
-
return `all ${
|
|
54
|
+
return `all ${ANSI.color(`completed`, EXECUTION_COLORS.completed)}`
|
|
52
55
|
}
|
|
53
56
|
if (cancelledCount === executionCount) {
|
|
54
|
-
return `all ${
|
|
57
|
+
return `all ${ANSI.color(`cancelled`, EXECUTION_COLORS.cancelled)}`
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
return createMixedDetails({
|
|
@@ -75,22 +78,19 @@ const createMixedDetails = ({
|
|
|
75
78
|
|
|
76
79
|
if (timedoutCount) {
|
|
77
80
|
parts.push(
|
|
78
|
-
`${timedoutCount} ${
|
|
79
|
-
`timed out`,
|
|
80
|
-
EXECUTION_COLORS.timedout,
|
|
81
|
-
)}`,
|
|
81
|
+
`${timedoutCount} ${ANSI.color(`timed out`, EXECUTION_COLORS.timedout)}`,
|
|
82
82
|
)
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
if (erroredCount) {
|
|
86
86
|
parts.push(
|
|
87
|
-
`${erroredCount} ${
|
|
87
|
+
`${erroredCount} ${ANSI.color(`errored`, EXECUTION_COLORS.errored)}`,
|
|
88
88
|
)
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
if (completedCount) {
|
|
92
92
|
parts.push(
|
|
93
|
-
`${completedCount} ${
|
|
93
|
+
`${completedCount} ${ANSI.color(
|
|
94
94
|
`completed`,
|
|
95
95
|
EXECUTION_COLORS.completed,
|
|
96
96
|
)}`,
|
|
@@ -99,13 +99,13 @@ const createMixedDetails = ({
|
|
|
99
99
|
|
|
100
100
|
if (abortedCount) {
|
|
101
101
|
parts.push(
|
|
102
|
-
`${abortedCount} ${
|
|
102
|
+
`${abortedCount} ${ANSI.color(`aborted`, EXECUTION_COLORS.aborted)}`,
|
|
103
103
|
)
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
if (cancelledCount) {
|
|
107
107
|
parts.push(
|
|
108
|
-
`${cancelledCount} ${
|
|
108
|
+
`${cancelledCount} ${ANSI.color(
|
|
109
109
|
`cancelled`,
|
|
110
110
|
EXECUTION_COLORS.cancelled,
|
|
111
111
|
)}`,
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { stat } from "node:fs"
|
|
2
2
|
import wrapAnsi from "wrap-ansi"
|
|
3
|
+
import cuid from "cuid"
|
|
3
4
|
import { loggerToLevels, createDetailedMessage } from "@jsenv/logger"
|
|
4
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
urlToFileSystemPath,
|
|
7
|
+
resolveUrl,
|
|
8
|
+
writeDirectory,
|
|
9
|
+
ensureEmptyDirectory,
|
|
10
|
+
normalizeStructuredMetaMap,
|
|
11
|
+
urlToMeta,
|
|
12
|
+
} from "@jsenv/filesystem"
|
|
13
|
+
import { createLog } from "@jsenv/log"
|
|
14
|
+
import { Abort } from "@jsenv/abort"
|
|
5
15
|
|
|
6
16
|
import { launchAndExecute } from "../executing/launchAndExecute.js"
|
|
7
17
|
import { reportToCoverage } from "./coverage/reportToCoverage.js"
|
|
8
|
-
import { writeLog } from "./writeLog.js"
|
|
9
18
|
import { createExecutionResultLog } from "./executionLogs.js"
|
|
10
19
|
import { createSummaryLog } from "./createSummaryLog.js"
|
|
11
20
|
|
|
@@ -33,7 +42,9 @@ export const executeConcurrently = async (
|
|
|
33
42
|
coverageConfig,
|
|
34
43
|
coverageIncludeMissing,
|
|
35
44
|
coverageForceIstanbul,
|
|
36
|
-
|
|
45
|
+
coverageV8ConflictWarning,
|
|
46
|
+
coverageTempDirectoryRelativeUrl,
|
|
47
|
+
runtimeSupport,
|
|
37
48
|
|
|
38
49
|
mainFileNotFoundCallback = ({ fileRelativeUrl }) => {
|
|
39
50
|
logger.error(
|
|
@@ -55,6 +66,73 @@ export const executeConcurrently = async (
|
|
|
55
66
|
const report = {}
|
|
56
67
|
const executionCount = executionSteps.length
|
|
57
68
|
|
|
69
|
+
let transformReturnValue = (value) => value
|
|
70
|
+
|
|
71
|
+
const coverageTempDirectoryUrl = resolveUrl(
|
|
72
|
+
coverageTempDirectoryRelativeUrl,
|
|
73
|
+
projectDirectoryUrl,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
const structuredMetaMapForCover = normalizeStructuredMetaMap(
|
|
77
|
+
{
|
|
78
|
+
cover: coverageConfig,
|
|
79
|
+
},
|
|
80
|
+
projectDirectoryUrl,
|
|
81
|
+
)
|
|
82
|
+
const coverageIgnorePredicate = (url) => {
|
|
83
|
+
return !urlToMeta({
|
|
84
|
+
url: resolveUrl(url, projectDirectoryUrl),
|
|
85
|
+
structuredMetaMap: structuredMetaMapForCover,
|
|
86
|
+
}).cover
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (coverage) {
|
|
90
|
+
// in case runned multiple times, we don't want to keep writing lot of files in this directory
|
|
91
|
+
if (!process.env.NODE_V8_COVERAGE) {
|
|
92
|
+
await ensureEmptyDirectory(coverageTempDirectoryUrl)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (runtimeSupport.node) {
|
|
96
|
+
// v8 coverage is written in a directoy and auto propagate to subprocesses
|
|
97
|
+
// through process.env.NODE_V8_COVERAGE.
|
|
98
|
+
if (!coverageForceIstanbul && !process.env.NODE_V8_COVERAGE) {
|
|
99
|
+
const v8CoverageDirectory = resolveUrl(
|
|
100
|
+
`./node_v8/${cuid()}`,
|
|
101
|
+
coverageTempDirectoryUrl,
|
|
102
|
+
)
|
|
103
|
+
await writeDirectory(v8CoverageDirectory, { allowUseless: true })
|
|
104
|
+
process.env.NODE_V8_COVERAGE = urlToFileSystemPath(v8CoverageDirectory)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
transformReturnValue = async (value) => {
|
|
109
|
+
if (multipleExecutionsOperation.signal.aborted) {
|
|
110
|
+
// don't try to do the coverage stuff
|
|
111
|
+
return value
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
try {
|
|
115
|
+
value.coverage = await reportToCoverage(value.report, {
|
|
116
|
+
multipleExecutionsOperation,
|
|
117
|
+
logger,
|
|
118
|
+
projectDirectoryUrl,
|
|
119
|
+
babelPluginMap,
|
|
120
|
+
coverageConfig,
|
|
121
|
+
coverageIncludeMissing,
|
|
122
|
+
coverageForceIstanbul,
|
|
123
|
+
coverageIgnorePredicate,
|
|
124
|
+
coverageV8ConflictWarning,
|
|
125
|
+
})
|
|
126
|
+
} catch (e) {
|
|
127
|
+
if (Abort.isAbortError(e)) {
|
|
128
|
+
return value
|
|
129
|
+
}
|
|
130
|
+
throw e
|
|
131
|
+
}
|
|
132
|
+
return value
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
58
136
|
let previousExecutionResult
|
|
59
137
|
let previousExecutionLog
|
|
60
138
|
let abortedCount = 0
|
|
@@ -116,12 +194,13 @@ export const executeConcurrently = async (
|
|
|
116
194
|
|
|
117
195
|
...executionParams,
|
|
118
196
|
collectCoverage: coverage,
|
|
197
|
+
coverageTempDirectoryUrl,
|
|
119
198
|
runtimeParams: {
|
|
120
199
|
projectDirectoryUrl,
|
|
121
200
|
compileServerOrigin,
|
|
122
201
|
outDirectoryRelativeUrl,
|
|
123
202
|
collectCoverage: coverage,
|
|
124
|
-
|
|
203
|
+
coverageIgnorePredicate,
|
|
125
204
|
coverageForceIstanbul,
|
|
126
205
|
...executionParams.runtimeParams,
|
|
127
206
|
},
|
|
@@ -129,7 +208,7 @@ export const executeConcurrently = async (
|
|
|
129
208
|
fileRelativeUrl,
|
|
130
209
|
...executionParams.executeParams,
|
|
131
210
|
},
|
|
132
|
-
|
|
211
|
+
coverageV8ConflictWarning,
|
|
133
212
|
})
|
|
134
213
|
const afterExecutionInfo = {
|
|
135
214
|
...beforeExecutionInfo,
|
|
@@ -173,11 +252,13 @@ export const executeConcurrently = async (
|
|
|
173
252
|
: true) &&
|
|
174
253
|
executionResult.status === "completed"
|
|
175
254
|
) {
|
|
176
|
-
previousExecutionLog
|
|
255
|
+
previousExecutionLog.write(log)
|
|
177
256
|
} else {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
257
|
+
if (previousExecutionLog) {
|
|
258
|
+
previousExecutionLog.destroy()
|
|
259
|
+
}
|
|
260
|
+
previousExecutionLog = createLog()
|
|
261
|
+
previousExecutionLog.write(log)
|
|
181
262
|
}
|
|
182
263
|
}
|
|
183
264
|
|
|
@@ -206,31 +287,10 @@ export const executeConcurrently = async (
|
|
|
206
287
|
logger.info(createSummaryLog(summary))
|
|
207
288
|
}
|
|
208
289
|
|
|
209
|
-
|
|
210
|
-
// don't try to do the coverage stuff
|
|
211
|
-
return {
|
|
212
|
-
summary,
|
|
213
|
-
report,
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
return {
|
|
290
|
+
return transformReturnValue({
|
|
218
291
|
summary,
|
|
219
292
|
report,
|
|
220
|
-
|
|
221
|
-
? {
|
|
222
|
-
coverage: await reportToCoverage(report, {
|
|
223
|
-
multipleExecutionsOperation,
|
|
224
|
-
logger,
|
|
225
|
-
projectDirectoryUrl,
|
|
226
|
-
babelPluginMap,
|
|
227
|
-
coverageConfig,
|
|
228
|
-
coverageIncludeMissing,
|
|
229
|
-
coverageV8MergeConflictIsExpected,
|
|
230
|
-
}),
|
|
231
|
-
}
|
|
232
|
-
: {}),
|
|
233
|
-
}
|
|
293
|
+
})
|
|
234
294
|
}
|
|
235
295
|
|
|
236
296
|
const executeInParallel = async ({
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
raceProcessTeardownEvents,
|
|
4
|
-
} from "@jsenv/core/src/abort/main.js"
|
|
1
|
+
import { Abort, raceProcessTeardownEvents } from "@jsenv/abort"
|
|
2
|
+
|
|
5
3
|
import { mergeRuntimeSupport } from "@jsenv/core/src/internal/generateGroupMap/runtime_support.js"
|
|
6
4
|
import { startCompileServer } from "../compiling/startCompileServer.js"
|
|
7
5
|
import { babelPluginInstrument } from "./coverage/babel_plugin_instrument.js"
|
|
@@ -36,7 +34,8 @@ export const executePlan = async (
|
|
|
36
34
|
coverageConfig,
|
|
37
35
|
coverageIncludeMissing,
|
|
38
36
|
coverageForceIstanbul,
|
|
39
|
-
|
|
37
|
+
coverageV8ConflictWarning,
|
|
38
|
+
coverageTempDirectoryRelativeUrl,
|
|
40
39
|
|
|
41
40
|
compileServerProtocol,
|
|
42
41
|
compileServerPrivateKey,
|
|
@@ -74,97 +73,101 @@ export const executePlan = async (
|
|
|
74
73
|
})
|
|
75
74
|
})
|
|
76
75
|
|
|
77
|
-
const multipleExecutionsOperation =
|
|
76
|
+
const multipleExecutionsOperation = Abort.startOperation()
|
|
77
|
+
multipleExecutionsOperation.addAbortSignal(signal)
|
|
78
78
|
if (handleSIGINT) {
|
|
79
|
-
|
|
80
|
-
raceProcessTeardownEvents(
|
|
79
|
+
multipleExecutionsOperation.addAbortSource((abort) => {
|
|
80
|
+
return raceProcessTeardownEvents(
|
|
81
81
|
{
|
|
82
82
|
SIGINT: true,
|
|
83
83
|
},
|
|
84
84
|
() => {
|
|
85
85
|
logger.info("Aborting execution (SIGINT)")
|
|
86
|
-
|
|
86
|
+
abort()
|
|
87
87
|
},
|
|
88
|
-
)
|
|
89
|
-
)
|
|
88
|
+
)
|
|
89
|
+
})
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
compileServerLogLevel,
|
|
95
|
-
|
|
96
|
-
projectDirectoryUrl,
|
|
97
|
-
jsenvDirectoryRelativeUrl,
|
|
98
|
-
jsenvDirectoryClean,
|
|
99
|
-
outDirectoryName: "out-dev",
|
|
100
|
-
|
|
101
|
-
importResolutionMethod,
|
|
102
|
-
importDefaultExtension,
|
|
103
|
-
|
|
104
|
-
compileServerProtocol,
|
|
105
|
-
compileServerPrivateKey,
|
|
106
|
-
compileServerCertificate,
|
|
107
|
-
compileServerIp,
|
|
108
|
-
compileServerPort,
|
|
109
|
-
compileServerCanReadFromFilesystem,
|
|
110
|
-
compileServerCanWriteOnFilesystem,
|
|
111
|
-
keepProcessAlive: true, // to be sure it stays alive
|
|
112
|
-
babelPluginMap,
|
|
113
|
-
babelConfigFileUrl,
|
|
114
|
-
customCompilers,
|
|
115
|
-
runtimeSupport,
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
multipleExecutionsOperation.cleaner.addCallback(async () => {
|
|
119
|
-
await compileServer.stop()
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
const executionSteps = await generateExecutionSteps(
|
|
123
|
-
{
|
|
124
|
-
...plan,
|
|
125
|
-
[compileServer.outDirectoryRelativeUrl]: null,
|
|
126
|
-
},
|
|
127
|
-
{
|
|
92
|
+
try {
|
|
93
|
+
const compileServer = await startCompileServer({
|
|
128
94
|
signal: multipleExecutionsOperation.signal,
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
const result = await executeConcurrently(executionSteps, {
|
|
134
|
-
multipleExecutionsOperation,
|
|
135
|
-
logger,
|
|
136
|
-
launchAndExecuteLogLevel,
|
|
95
|
+
compileServerLogLevel,
|
|
137
96
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
97
|
+
projectDirectoryUrl,
|
|
98
|
+
jsenvDirectoryRelativeUrl,
|
|
99
|
+
jsenvDirectoryClean,
|
|
100
|
+
outDirectoryName: "out-dev",
|
|
101
|
+
|
|
102
|
+
importResolutionMethod,
|
|
103
|
+
importDefaultExtension,
|
|
104
|
+
|
|
105
|
+
compileServerProtocol,
|
|
106
|
+
compileServerPrivateKey,
|
|
107
|
+
compileServerCertificate,
|
|
108
|
+
compileServerIp,
|
|
109
|
+
compileServerPort,
|
|
110
|
+
compileServerCanReadFromFilesystem,
|
|
111
|
+
compileServerCanWriteOnFilesystem,
|
|
112
|
+
keepProcessAlive: true, // to be sure it stays alive
|
|
113
|
+
babelPluginMap,
|
|
114
|
+
babelConfigFileUrl,
|
|
115
|
+
customCompilers,
|
|
116
|
+
runtimeSupport,
|
|
117
|
+
})
|
|
145
118
|
|
|
146
|
-
|
|
119
|
+
multipleExecutionsOperation.addEndCallback(async () => {
|
|
120
|
+
await compileServer.stop()
|
|
121
|
+
})
|
|
147
122
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
123
|
+
const executionSteps = await generateExecutionSteps(
|
|
124
|
+
{
|
|
125
|
+
...plan,
|
|
126
|
+
[compileServer.outDirectoryRelativeUrl]: null,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
signal: multipleExecutionsOperation.signal,
|
|
130
|
+
projectDirectoryUrl,
|
|
131
|
+
},
|
|
132
|
+
)
|
|
154
133
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
coverageV8MergeConflictIsExpected,
|
|
160
|
-
})
|
|
134
|
+
const result = await executeConcurrently(executionSteps, {
|
|
135
|
+
multipleExecutionsOperation,
|
|
136
|
+
logger,
|
|
137
|
+
launchAndExecuteLogLevel,
|
|
161
138
|
|
|
162
|
-
|
|
163
|
-
|
|
139
|
+
projectDirectoryUrl,
|
|
140
|
+
compileServerOrigin: compileServer.origin,
|
|
141
|
+
outDirectoryRelativeUrl: compileServer.outDirectoryRelativeUrl,
|
|
142
|
+
|
|
143
|
+
// not sure we actually have to pass import params to executeConcurrently
|
|
144
|
+
importResolutionMethod,
|
|
145
|
+
importDefaultExtension,
|
|
146
|
+
|
|
147
|
+
babelPluginMap: compileServer.babelPluginMap,
|
|
148
|
+
|
|
149
|
+
defaultMsAllocatedPerExecution,
|
|
150
|
+
maxExecutionsInParallel,
|
|
151
|
+
completedExecutionLogMerging,
|
|
152
|
+
completedExecutionLogAbbreviation,
|
|
153
|
+
logSummary,
|
|
154
|
+
measureGlobalDuration,
|
|
155
|
+
|
|
156
|
+
coverage,
|
|
157
|
+
coverageConfig,
|
|
158
|
+
coverageIncludeMissing,
|
|
159
|
+
coverageForceIstanbul,
|
|
160
|
+
coverageV8ConflictWarning,
|
|
161
|
+
coverageTempDirectoryRelativeUrl,
|
|
162
|
+
runtimeSupport,
|
|
163
|
+
})
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
return {
|
|
166
|
+
planSummary: result.summary,
|
|
167
|
+
planReport: result.report,
|
|
168
|
+
planCoverage: result.coverage,
|
|
169
|
+
}
|
|
170
|
+
} finally {
|
|
171
|
+
await multipleExecutionsOperation.end()
|
|
169
172
|
}
|
|
170
173
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
okSignColorLess,
|
|
4
|
-
setANSIColor,
|
|
5
|
-
ANSI_GREY,
|
|
6
|
-
} from "../logs/log_style.js"
|
|
1
|
+
import { ANSI, UNICODE } from "@jsenv/log"
|
|
2
|
+
|
|
7
3
|
import { msAsDuration } from "../logs/msAsDuration.js"
|
|
8
4
|
import { EXECUTION_COLORS } from "./execution_colors.js"
|
|
9
5
|
import { createSummaryDetails } from "./createSummaryLog.js"
|
|
@@ -56,32 +52,32 @@ runtime: ${runtime}${appendDuration({
|
|
|
56
52
|
|
|
57
53
|
const descriptionFormatters = {
|
|
58
54
|
aborted: ({ executionNumber, executionCount }) => {
|
|
59
|
-
return
|
|
60
|
-
`${
|
|
55
|
+
return ANSI.color(
|
|
56
|
+
`${UNICODE.FAILURE_RAW} execution ${executionNumber} of ${executionCount} aborted`,
|
|
61
57
|
EXECUTION_COLORS.aborted,
|
|
62
58
|
)
|
|
63
59
|
},
|
|
64
60
|
timedout: ({ executionNumber, allocatedMs, executionCount }) => {
|
|
65
|
-
return
|
|
66
|
-
`${
|
|
61
|
+
return ANSI.color(
|
|
62
|
+
`${UNICODE.FAILURE_RAW} execution ${executionNumber} of ${executionCount} timeout after ${allocatedMs}ms`,
|
|
67
63
|
EXECUTION_COLORS.timedout,
|
|
68
64
|
)
|
|
69
65
|
},
|
|
70
66
|
errored: ({ executionNumber, executionCount }) => {
|
|
71
|
-
return
|
|
72
|
-
`${
|
|
67
|
+
return ANSI.color(
|
|
68
|
+
`${UNICODE.FAILURE_RAW} execution ${executionNumber} of ${executionCount} error`,
|
|
73
69
|
EXECUTION_COLORS.errored,
|
|
74
70
|
)
|
|
75
71
|
},
|
|
76
72
|
completed: ({ executionNumber, executionCount }) => {
|
|
77
|
-
return
|
|
78
|
-
`${
|
|
73
|
+
return ANSI.color(
|
|
74
|
+
`${UNICODE.OK_RAW} execution ${executionNumber} of ${executionCount} completed`,
|
|
79
75
|
EXECUTION_COLORS.completed,
|
|
80
76
|
)
|
|
81
77
|
},
|
|
82
78
|
cancelled: ({ executionNumber, executionCount }) => {
|
|
83
|
-
return
|
|
84
|
-
`${
|
|
79
|
+
return ANSI.color(
|
|
80
|
+
`${UNICODE.FAILURE_RAW} execution ${executionNumber} of ${executionCount} cancelled`,
|
|
85
81
|
EXECUTION_COLORS.cancelled,
|
|
86
82
|
)
|
|
87
83
|
},
|
|
@@ -105,9 +101,9 @@ const appendConsole = (consoleCalls) => {
|
|
|
105
101
|
if (consoleOutputTrimmed === "") return ""
|
|
106
102
|
|
|
107
103
|
return `
|
|
108
|
-
${
|
|
104
|
+
${ANSI.color(`-------- console --------`, ANSI.GREY)}
|
|
109
105
|
${consoleOutputTrimmed}
|
|
110
|
-
${
|
|
106
|
+
${ANSI.color(`-------------------------`, ANSI.GREY)}`
|
|
111
107
|
}
|
|
112
108
|
|
|
113
109
|
const appendError = (error) => {
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ANSI_GREY,
|
|
3
|
-
ANSI_YELLOW,
|
|
4
|
-
ANSI_RED,
|
|
5
|
-
ANSI_GREEN,
|
|
6
|
-
ANSI_MAGENTA,
|
|
7
|
-
} from "../logs/log_style.js"
|
|
1
|
+
import { ANSI } from "@jsenv/log"
|
|
8
2
|
|
|
9
3
|
export const EXECUTION_COLORS = {
|
|
10
|
-
aborted:
|
|
11
|
-
timedout:
|
|
12
|
-
errored:
|
|
13
|
-
completed:
|
|
14
|
-
cancelled:
|
|
4
|
+
aborted: ANSI.MAGENTA,
|
|
5
|
+
timedout: ANSI.YELLOW,
|
|
6
|
+
errored: ANSI.RED,
|
|
7
|
+
completed: ANSI.GREEN,
|
|
8
|
+
cancelled: ANSI.GREY,
|
|
15
9
|
}
|