@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.
Files changed (82) hide show
  1. package/dist/jsenv_browser_system.js +36 -99
  2. package/dist/jsenv_browser_system.js.map +12 -21
  3. package/dist/jsenv_compile_proxy.js +18 -82
  4. package/dist/jsenv_compile_proxy.js.map +11 -21
  5. package/dist/jsenv_exploring_index.js +127 -274
  6. package/dist/jsenv_exploring_index.js.map +76 -90
  7. package/dist/jsenv_exploring_redirector.js +21 -89
  8. package/dist/jsenv_exploring_redirector.js.map +13 -25
  9. package/dist/jsenv_toolbar.js +81 -149
  10. package/dist/jsenv_toolbar.js.map +50 -61
  11. package/dist/jsenv_toolbar_injector.js +185 -231
  12. package/dist/jsenv_toolbar_injector.js.map +30 -42
  13. package/package.json +8 -9
  14. package/src/abort/abortable.js +172 -0
  15. package/src/abort/callback_list.js +64 -0
  16. package/src/abort/callback_race.js +34 -0
  17. package/src/abort/cleaner.js +22 -0
  18. package/src/abort/main.js +32 -0
  19. package/src/abort/process_teardown_events.js +59 -0
  20. package/src/buildProject.js +132 -123
  21. package/src/execute.js +108 -107
  22. package/src/executeTestPlan.js +107 -125
  23. package/src/importUsingChildProcess.js +2 -1
  24. package/src/internal/browser-launcher/executeHtmlFile.js +33 -12
  25. package/src/internal/browser-utils/fetch-browser.js +4 -29
  26. package/src/internal/browser-utils/fetchUsingXHR.js +5 -7
  27. package/src/internal/building/buildUsingRollup.js +60 -24
  28. package/src/internal/building/createJsenvRollupPlugin.js +13 -31
  29. package/src/internal/building/ressource_builder.js +3 -6
  30. package/src/internal/building/sourcemap_loader.js +4 -5
  31. package/src/internal/building/url_fetcher.js +2 -5
  32. package/src/internal/building/url_loader.js +3 -6
  33. package/src/internal/compiling/compileFile.js +1 -2
  34. package/src/internal/compiling/createCompiledFileService.js +8 -9
  35. package/src/internal/compiling/startCompileServer.js +74 -135
  36. package/src/internal/executing/coverage/generateCoverageJsonFile.js +20 -3
  37. package/src/internal/executing/coverage/relativeUrlToEmptyCoverage.js +19 -30
  38. package/src/internal/executing/coverage/reportToCoverage.js +44 -24
  39. package/src/internal/executing/coverage/v8CoverageFromNodeV8Directory.js +2 -15
  40. package/src/internal/executing/createSummaryLog.js +50 -37
  41. package/src/internal/executing/executeConcurrently.js +89 -47
  42. package/src/internal/executing/executePlan.js +33 -7
  43. package/src/internal/executing/executionLogs.js +25 -28
  44. package/src/internal/executing/execution_colors.js +15 -0
  45. package/src/internal/executing/generateExecutionSteps.js +3 -2
  46. package/src/internal/executing/launchAndExecute.js +217 -261
  47. package/src/internal/exploring/fetchExploringJson.js +3 -4
  48. package/src/internal/fetchUrl.js +6 -2
  49. package/src/internal/logs/log_style.js +16 -28
  50. package/src/internal/logs/msAsDuration.js +1 -1
  51. package/src/internal/node-launcher/createChildProcessOptions.js +4 -5
  52. package/src/internal/node-launcher/createControllableNodeProcess.js +117 -229
  53. package/src/internal/node-launcher/kill_process_tree.js +76 -0
  54. package/src/internal/node-launcher/nodeControllableFile.mjs +16 -10
  55. package/src/internal/{promise_track_race.js → promise_race.js} +2 -2
  56. package/src/internal/runtime/s.js +25 -24
  57. package/src/internal/toolbar/toolbar.html +157 -61
  58. package/src/internal/toolbar/toolbar.injector.js +8 -0
  59. package/src/internal/toolbar/util/animation.js +3 -7
  60. package/src/internal/toolbar/util/fetching.js +1 -30
  61. package/src/jsenvServiceWorkerFinalizer.js +1 -2
  62. package/src/launchBrowser.js +131 -127
  63. package/src/launchNode.js +29 -17
  64. package/src/playwright_browser_versions.js +3 -3
  65. package/src/requireUsingChildProcess.js +2 -1
  66. package/src/signal/signal.js +65 -0
  67. package/src/startExploring.js +70 -72
  68. package/src/internal/executeJsenvAsyncFunction.js +0 -34
  69. package/src/internal/toolbar/animation/toolbar-movie-icon.svg +0 -15
  70. package/src/internal/toolbar/compilation/flask.svg +0 -7
  71. package/src/internal/toolbar/compilation/info.svg +0 -9
  72. package/src/internal/toolbar/compilation/loupe.svg +0 -11
  73. package/src/internal/toolbar/compilation/toolbar_compilation.svg +0 -11
  74. package/src/internal/toolbar/eventsource/toolbar-power-icon.svg +0 -10
  75. package/src/internal/toolbar/eventsource/toolbar-power-off-icon.svg +0 -10
  76. package/src/internal/toolbar/responsive/toolbar-dots-icon.svg +0 -10
  77. package/src/internal/toolbar/settings/toolbar-settings-icon.svg +0 -9
  78. package/src/internal/toolbar/theme/toolbar-palette-icon.svg +0 -10
  79. package/src/internal/toolbar/toolbar-cross-icon.svg +0 -10
  80. package/src/internal/toolbar/toolbar-loading-icon.svg +0 -102
  81. package/src/internal/toolbar/toolbar-notif-icon.svg +0 -9
  82. package/src/internal/trackRessources.js +0 -23
@@ -1,11 +1,6 @@
1
- import {
2
- setANSIColor,
3
- ANSI_MAGENTA,
4
- ANSI_YELLOW,
5
- ANSI_RED,
6
- ANSI_GREEN,
7
- } from "../logs/log_style.js"
1
+ import { setANSIColor } from "../logs/log_style.js"
8
2
  import { msAsDuration } from "../logs/msAsDuration.js"
3
+ import { EXECUTION_COLORS } from "./execution_colors.js"
9
4
 
10
5
  export const createSummaryLog = (summary) => `
11
6
  -------------- summary -----------------
@@ -15,88 +10,106 @@ ${createSummaryMessage(summary)}${createTotalDurationMessage(summary)}
15
10
 
16
11
  const createSummaryMessage = ({
17
12
  executionCount,
18
- disconnectedCount,
13
+ abortedCount,
19
14
  timedoutCount,
20
15
  erroredCount,
21
16
  completedCount,
17
+ cancelledCount,
22
18
  }) => {
23
19
  if (executionCount === 0) {
24
- return `0 execution`
20
+ return `no execution`
25
21
  }
26
22
 
27
23
  return `${executionCount} execution: ${createSummaryDetails({
28
24
  executionCount,
29
- disconnectedCount,
25
+ abortedCount,
30
26
  timedoutCount,
31
27
  erroredCount,
32
28
  completedCount,
29
+ cancelledCount,
33
30
  })}`
34
31
  }
35
32
 
36
33
  export const createSummaryDetails = ({
37
34
  executionCount,
38
- disconnectedCount,
35
+ abortedCount,
39
36
  timedoutCount,
40
37
  erroredCount,
41
38
  completedCount,
39
+ cancelledCount,
42
40
  }) => {
43
- if (disconnectedCount === executionCount) {
44
- return createAllDisconnectedDetails()
41
+ if (abortedCount === executionCount) {
42
+ return `all ${setANSIColor(`aborted`, EXECUTION_COLORS.aborted)}`
45
43
  }
46
44
  if (timedoutCount === executionCount) {
47
- return createAllTimedoutDetails()
45
+ return `all ${setANSIColor(`timed out`, EXECUTION_COLORS.timedout)}`
48
46
  }
49
47
  if (erroredCount === executionCount) {
50
- return createAllErroredDetails()
48
+ return `all ${setANSIColor(`errored`, EXECUTION_COLORS.errored)}`
51
49
  }
52
50
  if (completedCount === executionCount) {
53
- return createAllCompletedDetails()
51
+ return `all ${setANSIColor(`completed`, EXECUTION_COLORS.completed)}`
52
+ }
53
+ if (cancelledCount === executionCount) {
54
+ return `all ${setANSIColor(`cancelled`, EXECUTION_COLORS.cancelled)}`
54
55
  }
55
56
 
56
57
  return createMixedDetails({
57
58
  executionCount,
58
- disconnectedCount,
59
+ abortedCount,
59
60
  timedoutCount,
60
61
  erroredCount,
61
62
  completedCount,
63
+ cancelledCount,
62
64
  })
63
65
  }
64
66
 
65
- const createAllDisconnectedDetails = () =>
66
- `all ${setANSIColor(`disconnected`, ANSI_MAGENTA)}`
67
-
68
- const createAllTimedoutDetails = () =>
69
- `all ${setANSIColor(`timed out`, ANSI_YELLOW)}`
70
-
71
- const createAllErroredDetails = () => `all ${setANSIColor(`errored`, ANSI_RED)}`
72
-
73
- const createAllCompletedDetails = () =>
74
- `all ${setANSIColor(`completed`, ANSI_GREEN)}`
75
-
76
67
  const createMixedDetails = ({
77
- disconnectedCount,
68
+ abortedCount,
78
69
  timedoutCount,
79
70
  erroredCount,
80
71
  completedCount,
72
+ cancelledCount,
81
73
  }) => {
82
74
  const parts = []
83
75
 
84
- if (disconnectedCount) {
76
+ if (timedoutCount) {
85
77
  parts.push(
86
- `${disconnectedCount} ${setANSIColor(`disconnected`, ANSI_MAGENTA)}`,
78
+ `${timedoutCount} ${setANSIColor(
79
+ `timed out`,
80
+ EXECUTION_COLORS.timedout,
81
+ )}`,
87
82
  )
88
83
  }
89
84
 
90
- if (timedoutCount) {
91
- parts.push(`${timedoutCount} ${setANSIColor(`timed out`, ANSI_YELLOW)}`)
92
- }
93
-
94
85
  if (erroredCount) {
95
- parts.push(`${erroredCount} ${setANSIColor(`errored`, ANSI_RED)}`)
86
+ parts.push(
87
+ `${erroredCount} ${setANSIColor(`errored`, EXECUTION_COLORS.errored)}`,
88
+ )
96
89
  }
97
90
 
98
91
  if (completedCount) {
99
- parts.push(`${completedCount} ${setANSIColor(`completed`, ANSI_GREEN)}`)
92
+ parts.push(
93
+ `${completedCount} ${setANSIColor(
94
+ `completed`,
95
+ EXECUTION_COLORS.completed,
96
+ )}`,
97
+ )
98
+ }
99
+
100
+ if (abortedCount) {
101
+ parts.push(
102
+ `${abortedCount} ${setANSIColor(`aborted`, EXECUTION_COLORS.aborted)}`,
103
+ )
104
+ }
105
+
106
+ if (cancelledCount) {
107
+ parts.push(
108
+ `${cancelledCount} ${setANSIColor(
109
+ `cancelled`,
110
+ EXECUTION_COLORS.cancelled,
111
+ )}`,
112
+ )
100
113
  }
101
114
 
102
115
  return `${parts.join(", ")}`
@@ -1,13 +1,5 @@
1
- /* eslint-disable import/max-dependencies */
2
- import { cpus } from "os"
3
- import { stat } from "fs"
4
-
1
+ import { stat } from "node:fs"
5
2
  import wrapAnsi from "wrap-ansi"
6
- import {
7
- createConcurrentOperations,
8
- createCancellationSource,
9
- composeCancellationToken,
10
- } from "@jsenv/cancellation"
11
3
  import { loggerToLevels, createDetailedMessage } from "@jsenv/logger"
12
4
  import { urlToFileSystemPath } from "@jsenv/filesystem"
13
5
 
@@ -20,9 +12,10 @@ import { createSummaryLog } from "./createSummaryLog.js"
20
12
  export const executeConcurrently = async (
21
13
  executionSteps,
22
14
  {
15
+ multipleExecutionsOperation,
16
+
23
17
  logger,
24
18
  launchAndExecuteLogLevel,
25
- cancellationToken,
26
19
 
27
20
  projectDirectoryUrl,
28
21
  compileServerOrigin,
@@ -31,7 +24,7 @@ export const executeConcurrently = async (
31
24
  babelPluginMap,
32
25
 
33
26
  defaultMsAllocatedPerExecution = 30000,
34
- concurrencyLimit = Math.max(cpus.length - 1, 1),
27
+ maxExecutionsInParallel = 1,
35
28
  completedExecutionLogMerging,
36
29
  completedExecutionLogAbbreviation,
37
30
  measureGlobalDuration = true,
@@ -59,25 +52,19 @@ export const executeConcurrently = async (
59
52
  ) => {
60
53
  const startMs = Date.now()
61
54
 
62
- const allStepDoneCancellationSource = createCancellationSource()
63
- const executionCancellationToken = composeCancellationToken(
64
- cancellationToken,
65
- allStepDoneCancellationSource.token,
66
- )
67
-
68
55
  const report = {}
69
56
  const executionCount = executionSteps.length
70
57
 
71
58
  let previousExecutionResult
72
59
  let previousExecutionLog
73
- let disconnectedCount = 0
60
+ let abortedCount = 0
74
61
  let timedoutCount = 0
75
62
  let erroredCount = 0
76
63
  let completedCount = 0
77
- await createConcurrentOperations({
78
- cancellationToken,
79
- concurrencyLimit,
80
- array: executionSteps,
64
+ const executionsDone = await executeInParallel({
65
+ multipleExecutionsOperation,
66
+ maxExecutionsInParallel,
67
+ executionSteps,
81
68
  start: async (paramsFromStep) => {
82
69
  const executionIndex = executionSteps.indexOf(paramsFromStep)
83
70
  const { executionName, fileRelativeUrl } = paramsFromStep
@@ -120,9 +107,12 @@ export const executeConcurrently = async (
120
107
 
121
108
  beforeExecutionCallback(beforeExecutionInfo)
122
109
 
110
+ // launchAndExecute peut retourner un aborted
111
+ // et c'est bien, on veut le gérer, si tous les suivants sont aborted
112
+ // on le gere en dehors de cette boucle
123
113
  const executionResult = await launchAndExecute({
114
+ signal: multipleExecutionsOperation.signal,
124
115
  launchAndExecuteLogLevel,
125
- cancellationToken: executionCancellationToken,
126
116
 
127
117
  ...executionParams,
128
118
  collectCoverage: coverage,
@@ -139,7 +129,6 @@ export const executeConcurrently = async (
139
129
  fileRelativeUrl,
140
130
  ...executionParams.executeParams,
141
131
  },
142
-
143
132
  coverageV8MergeConflictIsExpected,
144
133
  })
145
134
  const afterExecutionInfo = {
@@ -148,10 +137,10 @@ export const executeConcurrently = async (
148
137
  }
149
138
  afterExecutionCallback(afterExecutionInfo)
150
139
 
151
- if (executionResult.status === "timedout") {
140
+ if (executionResult.status === "aborted") {
141
+ abortedCount++
142
+ } else if (executionResult.status === "timedout") {
152
143
  timedoutCount++
153
- } else if (executionResult.status === "disconnected") {
154
- disconnectedCount++
155
144
  } else if (executionResult.status === "errored") {
156
145
  erroredCount++
157
146
  } else if (executionResult.status === "completed") {
@@ -162,7 +151,7 @@ export const executeConcurrently = async (
162
151
  let log = createExecutionResultLog(afterExecutionInfo, {
163
152
  completedExecutionLogAbbreviation,
164
153
  executionCount,
165
- disconnectedCount,
154
+ abortedCount,
166
155
  timedoutCount,
167
156
  erroredCount,
168
157
  completedCount,
@@ -200,28 +189,39 @@ export const executeConcurrently = async (
200
189
  },
201
190
  })
202
191
 
203
- // tell everyone we are done
204
- // (used to stop potential chrome browser still opened to be reused)
205
- allStepDoneCancellationSource.cancel("all execution done")
192
+ const summaryCounts = reportToSummary(report)
206
193
 
207
- const summary = reportToSummary(report)
208
- if (measureGlobalDuration) {
209
- summary.startMs = startMs
210
- summary.endMs = Date.now()
194
+ const summary = {
195
+ executionCount,
196
+ ...summaryCounts,
197
+ // when execution is aborted, the remaining executions are "cancelled"
198
+ cancelledCount:
199
+ executionCount -
200
+ executionsDone.length -
201
+ // we substract abortedCount because they are not pushed into executionsDone
202
+ summaryCounts.abortedCount,
203
+ ...(measureGlobalDuration ? { startMs, endMs: Date.now() } : {}),
211
204
  }
212
-
213
205
  if (logSummary) {
214
206
  logger.info(createSummaryLog(summary))
215
207
  }
216
208
 
209
+ if (multipleExecutionsOperation.signal.aborted) {
210
+ // don't try to do the coverage stuff
211
+ return {
212
+ summary,
213
+ report,
214
+ }
215
+ }
216
+
217
217
  return {
218
218
  summary,
219
219
  report,
220
220
  ...(coverage
221
221
  ? {
222
222
  coverage: await reportToCoverage(report, {
223
+ multipleExecutionsOperation,
223
224
  logger,
224
- cancellationToken,
225
225
  projectDirectoryUrl,
226
226
  babelPluginMap,
227
227
  coverageConfig,
@@ -233,8 +233,55 @@ export const executeConcurrently = async (
233
233
  }
234
234
  }
235
235
 
236
- const pathLeadsToFile = (path) =>
237
- new Promise((resolve, reject) => {
236
+ const executeInParallel = async ({
237
+ multipleExecutionsOperation,
238
+ executionSteps,
239
+ start,
240
+ maxExecutionsInParallel = 1,
241
+ }) => {
242
+ const executionResults = []
243
+ let progressionIndex = 0
244
+ let remainingExecutionCount = executionSteps.length
245
+
246
+ const nextChunk = async () => {
247
+ if (multipleExecutionsOperation.signal.aborted) {
248
+ return
249
+ }
250
+
251
+ const outputPromiseArray = []
252
+ while (
253
+ remainingExecutionCount > 0 &&
254
+ outputPromiseArray.length < maxExecutionsInParallel
255
+ ) {
256
+ remainingExecutionCount--
257
+ const outputPromise = executeOne(progressionIndex)
258
+ progressionIndex++
259
+ outputPromiseArray.push(outputPromise)
260
+ }
261
+
262
+ if (outputPromiseArray.length) {
263
+ await Promise.all(outputPromiseArray)
264
+ if (remainingExecutionCount > 0) {
265
+ await nextChunk()
266
+ }
267
+ }
268
+ }
269
+
270
+ const executeOne = async (index) => {
271
+ const input = executionSteps[index]
272
+ const output = await start(input)
273
+ if (!multipleExecutionsOperation.signal.aborted) {
274
+ executionResults[index] = output
275
+ }
276
+ }
277
+
278
+ await nextChunk()
279
+
280
+ return executionResults
281
+ }
282
+
283
+ const pathLeadsToFile = (path) => {
284
+ return new Promise((resolve, reject) => {
238
285
  stat(path, (error, stats) => {
239
286
  if (error) {
240
287
  if (error.code === "ENOENT") {
@@ -247,12 +294,10 @@ const pathLeadsToFile = (path) =>
247
294
  }
248
295
  })
249
296
  })
297
+ }
250
298
 
251
299
  const reportToSummary = (report) => {
252
300
  const fileNames = Object.keys(report)
253
- const executionCount = fileNames.reduce((previous, fileName) => {
254
- return previous + Object.keys(report[fileName]).length
255
- }, 0)
256
301
 
257
302
  const countResultMatching = (predicate) => {
258
303
  return fileNames.reduce((previous, fileName) => {
@@ -269,9 +314,7 @@ const reportToSummary = (report) => {
269
314
  }, 0)
270
315
  }
271
316
 
272
- const disconnectedCount = countResultMatching(
273
- ({ status }) => status === "disconnected",
274
- )
317
+ const abortedCount = countResultMatching(({ status }) => status === "aborted")
275
318
  const timedoutCount = countResultMatching(
276
319
  ({ status }) => status === "timedout",
277
320
  )
@@ -281,8 +324,7 @@ const reportToSummary = (report) => {
281
324
  )
282
325
 
283
326
  return {
284
- executionCount,
285
- disconnectedCount,
327
+ abortedCount,
286
328
  timedoutCount,
287
329
  erroredCount,
288
330
  completedCount,
@@ -1,3 +1,7 @@
1
+ import {
2
+ Abortable,
3
+ raceProcessTeardownEvents,
4
+ } from "@jsenv/core/src/abort/main.js"
1
5
  import { mergeRuntimeSupport } from "@jsenv/core/src/internal/generateGroupMap/runtime_support.js"
2
6
  import { startCompileServer } from "../compiling/startCompileServer.js"
3
7
  import { babelPluginInstrument } from "./coverage/babel_plugin_instrument.js"
@@ -7,10 +11,12 @@ import { executeConcurrently } from "./executeConcurrently.js"
7
11
  export const executePlan = async (
8
12
  plan,
9
13
  {
14
+ signal,
15
+ handleSIGINT,
16
+
10
17
  logger,
11
18
  compileServerLogLevel,
12
19
  launchAndExecuteLogLevel,
13
- cancellationToken,
14
20
 
15
21
  projectDirectoryUrl,
16
22
  jsenvDirectoryRelativeUrl,
@@ -20,7 +26,7 @@ export const executePlan = async (
20
26
  importDefaultExtension,
21
27
 
22
28
  defaultMsAllocatedPerExecution,
23
- concurrencyLimit,
29
+ maxExecutionsInParallel,
24
30
  completedExecutionLogMerging,
25
31
  completedExecutionLogAbbreviation,
26
32
  logSummary,
@@ -68,8 +74,23 @@ export const executePlan = async (
68
74
  })
69
75
  })
70
76
 
77
+ const multipleExecutionsOperation = Abortable.fromSignal(signal)
78
+ if (handleSIGINT) {
79
+ Abortable.effect(multipleExecutionsOperation, (cb) =>
80
+ raceProcessTeardownEvents(
81
+ {
82
+ SIGINT: true,
83
+ },
84
+ () => {
85
+ logger.info("Aborting execution (SIGINT)")
86
+ cb()
87
+ },
88
+ ),
89
+ )
90
+ }
91
+
71
92
  const compileServer = await startCompileServer({
72
- cancellationToken,
93
+ signal: multipleExecutionsOperation.signal,
73
94
  compileServerLogLevel,
74
95
 
75
96
  projectDirectoryUrl,
@@ -94,21 +115,25 @@ export const executePlan = async (
94
115
  runtimeSupport,
95
116
  })
96
117
 
118
+ multipleExecutionsOperation.cleaner.addCallback(async () => {
119
+ await compileServer.stop()
120
+ })
121
+
97
122
  const executionSteps = await generateExecutionSteps(
98
123
  {
99
124
  ...plan,
100
125
  [compileServer.outDirectoryRelativeUrl]: null,
101
126
  },
102
127
  {
103
- cancellationToken,
128
+ signal: multipleExecutionsOperation.signal,
104
129
  projectDirectoryUrl,
105
130
  },
106
131
  )
107
132
 
108
133
  const result = await executeConcurrently(executionSteps, {
134
+ multipleExecutionsOperation,
109
135
  logger,
110
136
  launchAndExecuteLogLevel,
111
- cancellationToken,
112
137
 
113
138
  projectDirectoryUrl,
114
139
  compileServerOrigin: compileServer.origin,
@@ -121,7 +146,7 @@ export const executePlan = async (
121
146
  babelPluginMap: compileServer.babelPluginMap,
122
147
 
123
148
  defaultMsAllocatedPerExecution,
124
- concurrencyLimit,
149
+ maxExecutionsInParallel,
125
150
  completedExecutionLogMerging,
126
151
  completedExecutionLogAbbreviation,
127
152
  logSummary,
@@ -134,7 +159,8 @@ export const executePlan = async (
134
159
  coverageV8MergeConflictIsExpected,
135
160
  })
136
161
 
137
- compileServer.stop("all execution done")
162
+ // (used to stop potential chrome browser still opened to be reused)
163
+ multipleExecutionsOperation.cleaner.clean("all execution done")
138
164
 
139
165
  return {
140
166
  planSummary: result.summary,
@@ -1,14 +1,11 @@
1
1
  import {
2
- failureSignDefault,
3
- okSignDefault,
2
+ failureSignColorLess,
3
+ okSignColorLess,
4
4
  setANSIColor,
5
- ANSI_MAGENTA,
6
- ANSI_YELLOW,
7
- ANSI_RED,
8
5
  ANSI_GREY,
9
- ANSI_GREEN,
10
6
  } from "../logs/log_style.js"
11
7
  import { msAsDuration } from "../logs/msAsDuration.js"
8
+ import { EXECUTION_COLORS } from "./execution_colors.js"
12
9
  import { createSummaryDetails } from "./createSummaryLog.js"
13
10
 
14
11
  export const createExecutionResultLog = (
@@ -16,7 +13,7 @@ export const createExecutionResultLog = (
16
13
  {
17
14
  completedExecutionLogAbbreviation,
18
15
  executionCount,
19
- disconnectedCount,
16
+ abortedCount,
20
17
  timedoutCount,
21
18
  erroredCount,
22
19
  completedCount,
@@ -33,7 +30,7 @@ export const createExecutionResultLog = (
33
30
  })
34
31
  const summary = `(${createSummaryDetails({
35
32
  executionCount: executionNumber,
36
- disconnectedCount,
33
+ abortedCount,
37
34
  timedoutCount,
38
35
  erroredCount,
39
36
  completedCount,
@@ -54,32 +51,38 @@ file: ${fileRelativeUrl}
54
51
  runtime: ${runtime}${appendDuration({
55
52
  startMs,
56
53
  endMs,
57
- })}${appendConsole(consoleCalls)}${appendError(error, runtimeName)}`
54
+ })}${appendConsole(consoleCalls)}${appendError(error)}`
58
55
  }
59
56
 
60
57
  const descriptionFormatters = {
61
- disconnected: ({ executionNumber, executionCount }) => {
58
+ aborted: ({ executionNumber, executionCount }) => {
62
59
  return setANSIColor(
63
- `${failureSignDefault} execution ${executionNumber} of ${executionCount} disconnected`,
64
- ANSI_MAGENTA,
60
+ `${failureSignColorLess} execution ${executionNumber} of ${executionCount} aborted`,
61
+ EXECUTION_COLORS.aborted,
65
62
  )
66
63
  },
67
64
  timedout: ({ executionNumber, allocatedMs, executionCount }) => {
68
65
  return setANSIColor(
69
- `${failureSignDefault} execution ${executionNumber} of ${executionCount} timeout after ${allocatedMs}ms`,
70
- ANSI_YELLOW,
66
+ `${failureSignColorLess} execution ${executionNumber} of ${executionCount} timeout after ${allocatedMs}ms`,
67
+ EXECUTION_COLORS.timedout,
71
68
  )
72
69
  },
73
70
  errored: ({ executionNumber, executionCount }) => {
74
71
  return setANSIColor(
75
- `${failureSignDefault} execution ${executionNumber} of ${executionCount} error`,
76
- ANSI_RED,
72
+ `${failureSignColorLess} execution ${executionNumber} of ${executionCount} error`,
73
+ EXECUTION_COLORS.errored,
77
74
  )
78
75
  },
79
76
  completed: ({ executionNumber, executionCount }) => {
80
77
  return setANSIColor(
81
- `${okSignDefault} execution ${executionNumber} of ${executionCount} completed`,
82
- ANSI_GREEN,
78
+ `${okSignColorLess} execution ${executionNumber} of ${executionCount} completed`,
79
+ EXECUTION_COLORS.completed,
80
+ )
81
+ },
82
+ cancelled: ({ executionNumber, executionCount }) => {
83
+ return setANSIColor(
84
+ `${failureSignColorLess} execution ${executionNumber} of ${executionCount} cancelled`,
85
+ EXECUTION_COLORS.cancelled,
83
86
  )
84
87
  },
85
88
  }
@@ -107,21 +110,15 @@ ${consoleOutputTrimmed}
107
110
  ${setANSIColor(`-------------------------`, ANSI_GREY)}`
108
111
  }
109
112
 
110
- const appendError = (error, runtimeName) => {
113
+ const appendError = (error) => {
111
114
  if (!error) {
112
115
  return ``
113
116
  }
114
117
 
115
- if (runtimeName === "webkit") {
116
- return `
117
- error: ${error.message}
118
- at ${error.stack}`
119
- }
120
-
121
118
  return `
122
119
  error: ${error.stack}`
123
120
  }
124
121
 
125
- export const createShortExecutionResultLog = () => {
126
- return `Execution completed (2/9) - (all completed)`
127
- }
122
+ // export const createShortExecutionResultLog = () => {
123
+ // return `Execution completed (2/9) - (all completed)`
124
+ // }
@@ -0,0 +1,15 @@
1
+ import {
2
+ ANSI_GREY,
3
+ ANSI_YELLOW,
4
+ ANSI_RED,
5
+ ANSI_GREEN,
6
+ ANSI_MAGENTA,
7
+ } from "../logs/log_style.js"
8
+
9
+ export const EXECUTION_COLORS = {
10
+ aborted: ANSI_MAGENTA,
11
+ timedout: ANSI_YELLOW,
12
+ errored: ANSI_RED,
13
+ completed: ANSI_GREEN,
14
+ cancelled: ANSI_GREY,
15
+ }
@@ -1,16 +1,17 @@
1
1
  import { collectFiles } from "@jsenv/filesystem"
2
+
2
3
  import { generateFileExecutionSteps } from "./generateFileExecutionSteps.js"
3
4
 
4
5
  export const generateExecutionSteps = async (
5
6
  plan,
6
- { cancellationToken, projectDirectoryUrl },
7
+ { signal, projectDirectoryUrl },
7
8
  ) => {
8
9
  const structuredMetaMap = {
9
10
  filePlan: plan,
10
11
  }
11
12
 
12
13
  const fileResultArray = await collectFiles({
13
- cancellationToken,
14
+ signal,
14
15
  directoryUrl: projectDirectoryUrl,
15
16
  structuredMetaMap,
16
17
  predicate: ({ filePlan }) => filePlan,