@jsenv/core 23.1.3 → 23.2.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/dist/jsenv_browser_system.js +36 -99
- package/dist/jsenv_browser_system.js.map +12 -21
- package/dist/jsenv_compile_proxy.js +18 -82
- package/dist/jsenv_compile_proxy.js.map +11 -21
- package/dist/jsenv_exploring_index.js +127 -274
- package/dist/jsenv_exploring_index.js.map +76 -90
- package/dist/jsenv_exploring_redirector.js +21 -89
- package/dist/jsenv_exploring_redirector.js.map +13 -25
- package/dist/jsenv_toolbar.js +81 -149
- package/dist/jsenv_toolbar.js.map +50 -61
- package/dist/jsenv_toolbar_injector.js +185 -231
- package/dist/jsenv_toolbar_injector.js.map +30 -42
- package/package.json +8 -9
- package/src/abort/abortable.js +172 -0
- package/src/abort/callback_list.js +64 -0
- package/src/abort/callback_race.js +34 -0
- package/src/abort/cleaner.js +22 -0
- package/src/abort/main.js +32 -0
- package/src/abort/process_teardown_events.js +59 -0
- package/src/buildProject.js +132 -123
- package/src/execute.js +108 -107
- package/src/executeTestPlan.js +107 -125
- package/src/importUsingChildProcess.js +2 -1
- package/src/internal/browser-launcher/executeHtmlFile.js +33 -12
- package/src/internal/browser-utils/fetch-browser.js +4 -29
- package/src/internal/browser-utils/fetchUsingXHR.js +5 -7
- package/src/internal/building/buildUsingRollup.js +60 -24
- package/src/internal/building/createJsenvRollupPlugin.js +13 -31
- package/src/internal/building/ressource_builder.js +3 -6
- package/src/internal/building/sourcemap_loader.js +4 -5
- package/src/internal/building/url_fetcher.js +2 -5
- package/src/internal/building/url_loader.js +3 -6
- package/src/internal/compiling/compileFile.js +1 -2
- package/src/internal/compiling/createCompiledFileService.js +8 -9
- package/src/internal/compiling/startCompileServer.js +74 -135
- package/src/internal/executing/coverage/generateCoverageJsonFile.js +20 -3
- package/src/internal/executing/coverage/relativeUrlToEmptyCoverage.js +19 -30
- package/src/internal/executing/coverage/reportToCoverage.js +44 -24
- package/src/internal/executing/coverage/v8CoverageFromNodeV8Directory.js +2 -15
- package/src/internal/executing/createSummaryLog.js +50 -37
- package/src/internal/executing/executeConcurrently.js +89 -47
- package/src/internal/executing/executePlan.js +33 -7
- package/src/internal/executing/executionLogs.js +25 -28
- package/src/internal/executing/execution_colors.js +15 -0
- package/src/internal/executing/generateExecutionSteps.js +3 -2
- package/src/internal/executing/launchAndExecute.js +217 -261
- package/src/internal/exploring/fetchExploringJson.js +3 -4
- package/src/internal/fetchUrl.js +6 -2
- package/src/internal/logs/log_style.js +16 -28
- package/src/internal/logs/msAsDuration.js +1 -1
- package/src/internal/node-launcher/createChildProcessOptions.js +4 -5
- package/src/internal/node-launcher/createControllableNodeProcess.js +117 -229
- package/src/internal/node-launcher/kill_process_tree.js +76 -0
- package/src/internal/node-launcher/nodeControllableFile.mjs +16 -10
- package/src/internal/{promise_track_race.js → promise_race.js} +2 -2
- package/src/internal/runtime/s.js +25 -24
- package/src/internal/toolbar/toolbar.html +157 -61
- package/src/internal/toolbar/toolbar.injector.js +8 -0
- package/src/internal/toolbar/util/animation.js +3 -7
- package/src/internal/toolbar/util/fetching.js +1 -30
- package/src/jsenvServiceWorkerFinalizer.js +1 -2
- package/src/launchBrowser.js +131 -127
- package/src/launchNode.js +29 -17
- package/src/playwright_browser_versions.js +3 -3
- package/src/requireUsingChildProcess.js +2 -1
- package/src/signal/signal.js +65 -0
- package/src/startExploring.js +70 -72
- package/src/internal/executeJsenvAsyncFunction.js +0 -34
- package/src/internal/toolbar/animation/toolbar-movie-icon.svg +0 -15
- package/src/internal/toolbar/compilation/flask.svg +0 -7
- package/src/internal/toolbar/compilation/info.svg +0 -9
- package/src/internal/toolbar/compilation/loupe.svg +0 -11
- package/src/internal/toolbar/compilation/toolbar_compilation.svg +0 -11
- package/src/internal/toolbar/eventsource/toolbar-power-icon.svg +0 -10
- package/src/internal/toolbar/eventsource/toolbar-power-off-icon.svg +0 -10
- package/src/internal/toolbar/responsive/toolbar-dots-icon.svg +0 -10
- package/src/internal/toolbar/settings/toolbar-settings-icon.svg +0 -9
- package/src/internal/toolbar/theme/toolbar-palette-icon.svg +0 -10
- package/src/internal/toolbar/toolbar-cross-icon.svg +0 -10
- package/src/internal/toolbar/toolbar-loading-icon.svg +0 -102
- package/src/internal/toolbar/toolbar-notif-icon.svg +0 -9
- package/src/internal/trackRessources.js +0 -23
package/src/execute.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "@jsenv/
|
|
5
|
-
|
|
2
|
+
Abortable,
|
|
3
|
+
raceProcessTeardownEvents,
|
|
4
|
+
} from "@jsenv/core/src/abort/main.js"
|
|
6
5
|
import { normalizeRuntimeSupport } from "@jsenv/core/src/internal/generateGroupMap/runtime_support.js"
|
|
7
|
-
import { executeJsenvAsyncFunction } from "./internal/executeJsenvAsyncFunction.js"
|
|
8
6
|
import {
|
|
9
7
|
assertProjectDirectoryUrl,
|
|
10
8
|
assertProjectDirectoryExists,
|
|
@@ -13,11 +11,12 @@ import { startCompileServer } from "./internal/compiling/startCompileServer.js"
|
|
|
13
11
|
import { launchAndExecute } from "./internal/executing/launchAndExecute.js"
|
|
14
12
|
|
|
15
13
|
export const execute = async ({
|
|
14
|
+
signal = new AbortController().signal,
|
|
15
|
+
handleSIGINT = true,
|
|
16
|
+
|
|
16
17
|
logLevel = "warn",
|
|
17
18
|
compileServerLogLevel = logLevel,
|
|
18
19
|
launchAndExecuteLogLevel = logLevel,
|
|
19
|
-
cancellationToken = createCancellationToken(),
|
|
20
|
-
cancelOnSIGINT = true,
|
|
21
20
|
|
|
22
21
|
projectDirectoryUrl,
|
|
23
22
|
jsenvDirectoryRelativeUrl,
|
|
@@ -59,119 +58,121 @@ export const execute = async ({
|
|
|
59
58
|
runtimeStartedCallback,
|
|
60
59
|
runtimeStoppedCallback,
|
|
61
60
|
runtimeErrorAfterExecutionCallback,
|
|
62
|
-
runtimeDisconnectCallback,
|
|
61
|
+
runtimeDisconnectCallback = () => {},
|
|
63
62
|
}) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
projectDirectoryUrl = assertProjectDirectoryUrl({ projectDirectoryUrl })
|
|
64
|
+
await assertProjectDirectoryExists({ projectDirectoryUrl })
|
|
65
|
+
|
|
66
|
+
if (typeof fileRelativeUrl !== "string") {
|
|
67
|
+
throw new TypeError(
|
|
68
|
+
`fileRelativeUrl must be a string, got ${fileRelativeUrl}`,
|
|
68
69
|
)
|
|
70
|
+
}
|
|
71
|
+
fileRelativeUrl = fileRelativeUrl.replace(/\\/g, "/")
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
if (typeof runtime !== "object") {
|
|
74
|
+
throw new TypeError(`runtime must be an object, got ${runtime}`)
|
|
75
|
+
}
|
|
76
|
+
if (typeof runtime.launch !== "function") {
|
|
77
|
+
throw new TypeError(
|
|
78
|
+
`runtime.launch must be a function, got ${runtime.launch}`,
|
|
79
|
+
)
|
|
80
|
+
}
|
|
72
81
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
const executeOperation = Abortable.fromSignal(signal)
|
|
83
|
+
if (handleSIGINT) {
|
|
84
|
+
Abortable.effect(executeOperation, (cb) =>
|
|
85
|
+
raceProcessTeardownEvents(
|
|
86
|
+
{
|
|
87
|
+
SIGINT: true,
|
|
88
|
+
},
|
|
89
|
+
cb,
|
|
90
|
+
),
|
|
91
|
+
)
|
|
92
|
+
}
|
|
79
93
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
const {
|
|
95
|
+
outDirectoryRelativeUrl,
|
|
96
|
+
origin: compileServerOrigin,
|
|
97
|
+
stop,
|
|
98
|
+
} = await startCompileServer({
|
|
99
|
+
signal: executeOperation.signal,
|
|
100
|
+
compileServerLogLevel,
|
|
101
|
+
|
|
102
|
+
projectDirectoryUrl,
|
|
103
|
+
jsenvDirectoryRelativeUrl,
|
|
104
|
+
jsenvDirectoryClean,
|
|
105
|
+
outDirectoryName: "out-dev",
|
|
106
|
+
|
|
107
|
+
importDefaultExtension,
|
|
108
|
+
|
|
109
|
+
compileServerProtocol,
|
|
110
|
+
compileServerPrivateKey,
|
|
111
|
+
compileServerCertificate,
|
|
112
|
+
compileServerIp,
|
|
113
|
+
compileServerPort,
|
|
114
|
+
babelPluginMap,
|
|
115
|
+
customCompilers,
|
|
116
|
+
runtimeSupport: normalizeRuntimeSupport({
|
|
117
|
+
[runtime.name]: runtime.version,
|
|
118
|
+
}),
|
|
119
|
+
compileServerCanReadFromFilesystem,
|
|
120
|
+
compileServerCanWriteOnFilesystem,
|
|
121
|
+
})
|
|
122
|
+
executeOperation.cleaner.addCallback(() => {
|
|
123
|
+
return stop()
|
|
124
|
+
})
|
|
88
125
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
stop,
|
|
93
|
-
} = await startCompileServer({
|
|
94
|
-
cancellationToken,
|
|
95
|
-
compileServerLogLevel,
|
|
126
|
+
const result = await launchAndExecute({
|
|
127
|
+
signal: executeOperation.signal,
|
|
128
|
+
launchAndExecuteLogLevel,
|
|
96
129
|
|
|
130
|
+
runtime,
|
|
131
|
+
runtimeParams: {
|
|
97
132
|
projectDirectoryUrl,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
fileRelativeUrl,
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
allocatedMs,
|
|
134
|
-
measureDuration,
|
|
135
|
-
mirrorConsole,
|
|
136
|
-
captureConsole,
|
|
137
|
-
collectRuntimeName,
|
|
138
|
-
collectRuntimeVersion,
|
|
139
|
-
inheritCoverage,
|
|
140
|
-
collectCoverage,
|
|
141
|
-
measurePerformance,
|
|
142
|
-
collectPerformance,
|
|
143
|
-
|
|
144
|
-
stopAfterExecute,
|
|
145
|
-
stopAfterExecuteReason,
|
|
146
|
-
gracefulStopAllocatedMs,
|
|
147
|
-
|
|
148
|
-
runtimeConsoleCallback,
|
|
149
|
-
runtimeStartedCallback,
|
|
150
|
-
runtimeStoppedCallback,
|
|
151
|
-
runtimeErrorAfterExecutionCallback,
|
|
152
|
-
runtimeDisconnectCallback,
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
stop("single-execution-done")
|
|
156
|
-
|
|
157
|
-
if (collectCompileServerInfo) {
|
|
158
|
-
result.outDirectoryRelativeUrl = outDirectoryRelativeUrl
|
|
159
|
-
result.compileServerOrigin = compileServerOrigin
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return result
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const executionPromise = executeJsenvAsyncFunction(jsenvExecutionFunction, {
|
|
166
|
-
cancelOnSIGINT,
|
|
133
|
+
compileServerOrigin,
|
|
134
|
+
outDirectoryRelativeUrl,
|
|
135
|
+
...runtimeParams,
|
|
136
|
+
},
|
|
137
|
+
executeParams: {
|
|
138
|
+
fileRelativeUrl,
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
allocatedMs,
|
|
142
|
+
measureDuration,
|
|
143
|
+
mirrorConsole,
|
|
144
|
+
captureConsole,
|
|
145
|
+
collectRuntimeName,
|
|
146
|
+
collectRuntimeVersion,
|
|
147
|
+
inheritCoverage,
|
|
148
|
+
collectCoverage,
|
|
149
|
+
measurePerformance,
|
|
150
|
+
collectPerformance,
|
|
151
|
+
|
|
152
|
+
stopAfterExecute,
|
|
153
|
+
stopAfterExecuteReason,
|
|
154
|
+
gracefulStopAllocatedMs,
|
|
155
|
+
|
|
156
|
+
runtimeConsoleCallback,
|
|
157
|
+
runtimeStartedCallback,
|
|
158
|
+
runtimeStoppedCallback,
|
|
159
|
+
runtimeErrorAfterExecutionCallback,
|
|
160
|
+
runtimeDisconnectCallback: () => {
|
|
161
|
+
// stop server when runtime disconnects
|
|
162
|
+
executeOperation.cleaner.clean("runtime-stopped")
|
|
163
|
+
runtimeDisconnectCallback()
|
|
164
|
+
},
|
|
167
165
|
})
|
|
168
166
|
|
|
169
|
-
if (
|
|
170
|
-
|
|
167
|
+
if (collectCompileServerInfo) {
|
|
168
|
+
result.outDirectoryRelativeUrl = outDirectoryRelativeUrl
|
|
169
|
+
result.compileServerOrigin = compileServerOrigin
|
|
171
170
|
}
|
|
172
171
|
|
|
173
|
-
const result = await executionPromise
|
|
174
172
|
if (result.status === "errored") {
|
|
173
|
+
if (ignoreError) {
|
|
174
|
+
return result
|
|
175
|
+
}
|
|
175
176
|
/*
|
|
176
177
|
Warning: when node launched with --unhandled-rejections=strict, despites
|
|
177
178
|
this promise being rejected by throw result.error node will compltely ignore it.
|
package/src/executeTestPlan.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/* eslint-disable import/max-dependencies */
|
|
2
|
-
import {
|
|
3
|
-
createCancellationToken,
|
|
4
|
-
composeCancellationToken,
|
|
5
|
-
} from "@jsenv/cancellation"
|
|
6
1
|
import {
|
|
7
2
|
normalizeStructuredMetaMap,
|
|
8
3
|
urlToFileSystemPath,
|
|
@@ -13,7 +8,6 @@ import {
|
|
|
13
8
|
} from "@jsenv/filesystem"
|
|
14
9
|
import { createLogger, createDetailedMessage } from "@jsenv/logger"
|
|
15
10
|
|
|
16
|
-
import { executeJsenvAsyncFunction } from "./internal/executeJsenvAsyncFunction.js"
|
|
17
11
|
import {
|
|
18
12
|
assertProjectDirectoryUrl,
|
|
19
13
|
assertProjectDirectoryExists,
|
|
@@ -26,11 +20,11 @@ import { generateCoverageTextLog } from "./internal/executing/coverage/generateC
|
|
|
26
20
|
import { jsenvCoverageConfig } from "./jsenvCoverageConfig.js"
|
|
27
21
|
|
|
28
22
|
export const executeTestPlan = async ({
|
|
23
|
+
signal = new AbortController().signal,
|
|
24
|
+
handleSIGINT = true,
|
|
29
25
|
logLevel = "info",
|
|
30
26
|
compileServerLogLevel = "warn",
|
|
31
27
|
launchAndExecuteLogLevel = "warn",
|
|
32
|
-
cancellationToken = createCancellationToken(),
|
|
33
|
-
cancelOnSIGINT = false,
|
|
34
28
|
|
|
35
29
|
projectDirectoryUrl,
|
|
36
30
|
jsenvDirectoryRelativeUrl,
|
|
@@ -40,7 +34,7 @@ export const executeTestPlan = async ({
|
|
|
40
34
|
testPlan,
|
|
41
35
|
defaultMsAllocatedPerExecution,
|
|
42
36
|
|
|
43
|
-
|
|
37
|
+
maxExecutionsInParallel,
|
|
44
38
|
|
|
45
39
|
completedExecutionLogAbbreviation = false,
|
|
46
40
|
completedExecutionLogMerging = false,
|
|
@@ -80,117 +74,107 @@ export const executeTestPlan = async ({
|
|
|
80
74
|
customCompilers,
|
|
81
75
|
jsenvDirectoryClean,
|
|
82
76
|
}) => {
|
|
83
|
-
const
|
|
84
|
-
cancellationToken = composeCancellationToken(
|
|
85
|
-
cancellationToken,
|
|
86
|
-
jsenvCancellationToken,
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
const logger = createLogger({ logLevel })
|
|
77
|
+
const logger = createLogger({ logLevel })
|
|
90
78
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
logger.info(`process SIGINT -> cancelling test execution`)
|
|
94
|
-
}
|
|
95
|
-
})
|
|
79
|
+
projectDirectoryUrl = assertProjectDirectoryUrl({ projectDirectoryUrl })
|
|
80
|
+
await assertProjectDirectoryExists({ projectDirectoryUrl })
|
|
96
81
|
|
|
97
|
-
|
|
98
|
-
|
|
82
|
+
if (typeof testPlan !== "object") {
|
|
83
|
+
throw new Error(`testPlan must be an object, got ${testPlan}`)
|
|
84
|
+
}
|
|
99
85
|
|
|
100
|
-
|
|
101
|
-
|
|
86
|
+
if (coverage) {
|
|
87
|
+
if (typeof coverageConfig !== "object") {
|
|
88
|
+
throw new TypeError(
|
|
89
|
+
`coverageConfig must be an object, got ${coverageConfig}`,
|
|
90
|
+
)
|
|
102
91
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
92
|
+
if (Object.keys(coverageConfig).length === 0) {
|
|
93
|
+
logger.warn(
|
|
94
|
+
`coverageConfig is an empty object. Nothing will be instrumented for coverage so your coverage will be empty`,
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
if (!coverageAndExecutionAllowed) {
|
|
98
|
+
const structuredMetaMapForExecute = normalizeStructuredMetaMap(
|
|
99
|
+
{
|
|
100
|
+
execute: testPlan,
|
|
101
|
+
},
|
|
102
|
+
"file:///",
|
|
103
|
+
)
|
|
104
|
+
const structuredMetaMapForCover = normalizeStructuredMetaMap(
|
|
105
|
+
{
|
|
106
|
+
cover: coverageConfig,
|
|
107
|
+
},
|
|
108
|
+
"file:///",
|
|
109
|
+
)
|
|
110
|
+
const patternsMatchingCoverAndExecute = Object.keys(
|
|
111
|
+
structuredMetaMapForExecute.execute,
|
|
112
|
+
).filter((testPlanPattern) => {
|
|
113
|
+
return urlToMeta({
|
|
114
|
+
url: testPlanPattern,
|
|
115
|
+
structuredMetaMap: structuredMetaMapForCover,
|
|
116
|
+
}).cover
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
if (patternsMatchingCoverAndExecute.length) {
|
|
120
|
+
// I think it is an error, it would be strange, for a given file
|
|
121
|
+
// to be both covered and executed
|
|
122
|
+
throw new Error(
|
|
123
|
+
createDetailedMessage(`some file will be both covered and executed`, {
|
|
124
|
+
patterns: patternsMatchingCoverAndExecute,
|
|
125
|
+
}),
|
|
127
126
|
)
|
|
128
|
-
const patternsMatchingCoverAndExecute = Object.keys(
|
|
129
|
-
structuredMetaMapForExecute.execute,
|
|
130
|
-
).filter((testPlanPattern) => {
|
|
131
|
-
return urlToMeta({
|
|
132
|
-
url: testPlanPattern,
|
|
133
|
-
structuredMetaMap: structuredMetaMapForCover,
|
|
134
|
-
}).cover
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
if (patternsMatchingCoverAndExecute.length) {
|
|
138
|
-
// I think it is an error, it would be strange, for a given file
|
|
139
|
-
// to be both covered and executed
|
|
140
|
-
throw new Error(
|
|
141
|
-
createDetailedMessage(
|
|
142
|
-
`some file will be both covered and executed`,
|
|
143
|
-
{
|
|
144
|
-
patterns: patternsMatchingCoverAndExecute,
|
|
145
|
-
},
|
|
146
|
-
),
|
|
147
|
-
)
|
|
148
|
-
}
|
|
149
127
|
}
|
|
150
128
|
}
|
|
129
|
+
}
|
|
151
130
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
131
|
+
const result = await executePlan(testPlan, {
|
|
132
|
+
signal,
|
|
133
|
+
handleSIGINT,
|
|
134
|
+
|
|
135
|
+
logger,
|
|
136
|
+
compileServerLogLevel,
|
|
137
|
+
launchAndExecuteLogLevel,
|
|
138
|
+
|
|
139
|
+
projectDirectoryUrl,
|
|
140
|
+
jsenvDirectoryRelativeUrl,
|
|
141
|
+
|
|
142
|
+
importResolutionMethod,
|
|
143
|
+
importDefaultExtension,
|
|
144
|
+
|
|
145
|
+
defaultMsAllocatedPerExecution,
|
|
146
|
+
maxExecutionsInParallel,
|
|
147
|
+
completedExecutionLogMerging,
|
|
148
|
+
completedExecutionLogAbbreviation,
|
|
149
|
+
logSummary,
|
|
150
|
+
measureGlobalDuration,
|
|
151
|
+
|
|
152
|
+
coverage,
|
|
153
|
+
coverageConfig,
|
|
154
|
+
coverageIncludeMissing,
|
|
155
|
+
coverageForceIstanbul,
|
|
156
|
+
coverageV8MergeConflictIsExpected,
|
|
157
|
+
|
|
158
|
+
jsenvDirectoryClean,
|
|
159
|
+
compileServerProtocol,
|
|
160
|
+
compileServerPrivateKey,
|
|
161
|
+
compileServerCertificate,
|
|
162
|
+
compileServerIp,
|
|
163
|
+
compileServerPort,
|
|
164
|
+
compileServerCanReadFromFilesystem,
|
|
165
|
+
compileServerCanWriteOnFilesystem,
|
|
166
|
+
babelPluginMap,
|
|
167
|
+
babelConfigFileUrl,
|
|
168
|
+
customCompilers,
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
if (updateProcessExitCode && !executionIsPassed(result)) {
|
|
172
|
+
process.exitCode = 1
|
|
173
|
+
}
|
|
193
174
|
|
|
175
|
+
const planCoverage = result.planCoverage
|
|
176
|
+
// planCoverage can be null when execution is abortes
|
|
177
|
+
if (planCoverage) {
|
|
194
178
|
const promises = []
|
|
195
179
|
// keep this one first because it does ensureEmptyDirectory
|
|
196
180
|
// and in case coverage json file gets written in the same directory
|
|
@@ -208,7 +192,7 @@ export const executeTestPlan = async ({
|
|
|
208
192
|
)
|
|
209
193
|
}
|
|
210
194
|
promises.push(
|
|
211
|
-
generateCoverageHtmlDirectory(
|
|
195
|
+
generateCoverageHtmlDirectory(planCoverage, {
|
|
212
196
|
projectDirectoryUrl,
|
|
213
197
|
coverageHtmlDirectoryRelativeUrl,
|
|
214
198
|
}),
|
|
@@ -219,11 +203,13 @@ export const executeTestPlan = async ({
|
|
|
219
203
|
coverageJsonFileRelativeUrl,
|
|
220
204
|
projectDirectoryUrl,
|
|
221
205
|
)
|
|
222
|
-
if (coverageJsonFileLog) {
|
|
223
|
-
logger.info(`-> ${urlToFileSystemPath(coverageJsonFileUrl)}`)
|
|
224
|
-
}
|
|
225
206
|
promises.push(
|
|
226
|
-
generateCoverageJsonFile(
|
|
207
|
+
generateCoverageJsonFile({
|
|
208
|
+
coverage: result.planCoverage,
|
|
209
|
+
coverageJsonFileUrl,
|
|
210
|
+
coverageJsonFileLog,
|
|
211
|
+
logger,
|
|
212
|
+
}),
|
|
227
213
|
)
|
|
228
214
|
}
|
|
229
215
|
if (coverage && coverageTextLog) {
|
|
@@ -235,15 +221,11 @@ export const executeTestPlan = async ({
|
|
|
235
221
|
)
|
|
236
222
|
}
|
|
237
223
|
await Promise.all(promises)
|
|
238
|
-
|
|
239
|
-
return {
|
|
240
|
-
testPlanSummary: result.planSummary,
|
|
241
|
-
testPlanReport: result.planReport,
|
|
242
|
-
testPlanCoverage: result.planCoverage,
|
|
243
|
-
}
|
|
244
224
|
}
|
|
245
225
|
|
|
246
|
-
return
|
|
247
|
-
|
|
248
|
-
|
|
226
|
+
return {
|
|
227
|
+
testPlanSummary: result.planSummary,
|
|
228
|
+
testPlanReport: result.planReport,
|
|
229
|
+
testPlanCoverage: planCoverage,
|
|
230
|
+
}
|
|
249
231
|
}
|
|
@@ -36,10 +36,11 @@ export const importUsingChildProcess = async (
|
|
|
36
36
|
|
|
37
37
|
return {
|
|
38
38
|
...controllableNodeProcess,
|
|
39
|
-
execute: async () => {
|
|
39
|
+
execute: async ({ signal }) => {
|
|
40
40
|
try {
|
|
41
41
|
const namespace =
|
|
42
42
|
await controllableNodeProcess.requestActionOnChildProcess({
|
|
43
|
+
signal,
|
|
43
44
|
actionType: "execute-using-import",
|
|
44
45
|
actionParams: { fileUrl },
|
|
45
46
|
})
|