@jsenv/core 23.2.1 → 23.4.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/{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 +8 -5
- 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 +64 -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 +179 -176
- 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
|
@@ -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
|
}
|