@jsenv/core 23.2.2 → 23.3.0

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 (34) hide show
  1. package/{license → LICENSE} +0 -0
  2. package/package.json +13 -14
  3. package/src/buildProject.js +12 -13
  4. package/src/execute.js +92 -93
  5. package/src/internal/browser-launcher/executeHtmlFile.js +6 -7
  6. package/src/internal/building/buildUsingRollup.js +3 -4
  7. package/src/internal/building/build_logs.js +7 -6
  8. package/src/internal/building/createJsenvRollupPlugin.js +9 -14
  9. package/src/internal/building/url_trace.js +3 -4
  10. package/src/internal/compiling/createCompiledFileService.js +8 -5
  11. package/src/internal/compiling/startCompileServer.js +55 -46
  12. package/src/internal/executing/coverage/relativeUrlToEmptyCoverage.js +2 -3
  13. package/src/internal/executing/createSummaryLog.js +12 -14
  14. package/src/internal/executing/executeConcurrently.js +7 -5
  15. package/src/internal/executing/executePlan.js +80 -80
  16. package/src/internal/executing/executionLogs.js +14 -18
  17. package/src/internal/executing/execution_colors.js +6 -12
  18. package/src/internal/executing/launchAndExecute.js +125 -145
  19. package/src/internal/node-launcher/createControllableNodeProcess.js +26 -23
  20. package/src/launchBrowser.js +64 -61
  21. package/src/launchNode.js +6 -6
  22. package/src/startExploring.js +2 -17
  23. package/src/abort/abortable.js +0 -172
  24. package/src/abort/callback_list.js +0 -64
  25. package/src/abort/callback_race.js +0 -34
  26. package/src/abort/cleaner.js +0 -22
  27. package/src/abort/main.js +0 -32
  28. package/src/abort/process_teardown_events.js +0 -59
  29. package/src/internal/createCallbackList.js +0 -21
  30. package/src/internal/executing/logUtils.js +0 -30
  31. package/src/internal/executing/writeLog.js +0 -106
  32. package/src/internal/executing/writeLog.test-manual.js +0 -62
  33. package/src/internal/logs/log_style.js +0 -40
  34. package/src/signal/signal.js +0 -65
@@ -2,7 +2,7 @@ import { readFileSync } from "node:fs"
2
2
  import {
3
3
  jsenvAccessControlAllowedHeaders,
4
4
  startServer,
5
- serveFile,
5
+ fetchFileSystem,
6
6
  createSSERoom,
7
7
  composeServicesWithTiming,
8
8
  urlToContentType,
@@ -23,13 +23,15 @@ import {
23
23
  urlIsInsideOf,
24
24
  urlToBasename,
25
25
  } from "@jsenv/filesystem"
26
+ import {
27
+ createCallbackList,
28
+ createCallbackListNotifiedOnce,
29
+ } from "@jsenv/abort"
26
30
 
27
- import { Abortable } from "@jsenv/core/src/abort/main.js"
28
31
  import { isBrowserPartOfSupportedRuntimes } from "@jsenv/core/src/internal/generateGroupMap/runtime_support.js"
29
32
  import { loadBabelPluginMapFromFile } from "./load_babel_plugin_map_from_file.js"
30
33
  import { extractSyntaxBabelPluginMap } from "./babel_plugins.js"
31
34
  import { generateGroupMap } from "../generateGroupMap/generateGroupMap.js"
32
- import { createCallbackList } from "../createCallbackList.js"
33
35
  import {
34
36
  jsenvCompileProxyFileInfo,
35
37
  sourcemapMainFileInfo,
@@ -46,6 +48,7 @@ import { createTransformHtmlSourceFileService } from "./html_source_file_service
46
48
 
47
49
  export const startCompileServer = async ({
48
50
  signal = new AbortController().signal,
51
+ handleSIGINT,
49
52
  compileServerLogLevel,
50
53
 
51
54
  projectDirectoryUrl,
@@ -215,12 +218,12 @@ export const startCompileServer = async ({
215
218
  ...babelPluginMap,
216
219
  }
217
220
 
218
- const compileServerOperation = Abortable.fromSignal(signal)
221
+ const serverStopCallbackList = createCallbackListNotifiedOnce()
219
222
 
220
223
  let projectFileRequestedCallback = () => {}
221
224
  if (livereloadSSE) {
222
225
  const sseSetup = setupServerSentEventsForLivereload({
223
- compileServerOperation,
226
+ serverStopCallbackList,
224
227
  projectDirectoryUrl,
225
228
  jsenvDirectoryRelativeUrl,
226
229
  outDirectoryRelativeUrl,
@@ -230,7 +233,7 @@ export const startCompileServer = async ({
230
233
 
231
234
  projectFileRequestedCallback = sseSetup.projectFileRequestedCallback
232
235
  const serveSSEForLivereload = createSSEForLivereloadService({
233
- compileServerOperation,
236
+ serverStopCallbackList,
234
237
  outDirectoryRelativeUrl,
235
238
  trackMainAndDependencies: sseSetup.trackMainAndDependencies,
236
239
  })
@@ -296,7 +299,6 @@ export const startCompileServer = async ({
296
299
  projectDirectoryUrl,
297
300
  }),
298
301
  "service:compiled file": createCompiledFileService({
299
- compileServerOperation,
300
302
  logger,
301
303
 
302
304
  projectDirectoryUrl,
@@ -345,9 +347,9 @@ export const startCompileServer = async ({
345
347
  }
346
348
 
347
349
  const compileServer = await startServer({
348
- signal: compileServerOperation.signal,
350
+ signal,
349
351
  stopOnExit: false,
350
- stopOnSIGINT: false,
352
+ stopOnSIGINT: handleSIGINT,
351
353
  stopOnInternalError: false,
352
354
  sendServerInternalErrorDetails: true,
353
355
  keepProcessAlive,
@@ -380,9 +382,9 @@ export const startCompileServer = async ({
380
382
  ...customServices,
381
383
  ...jsenvServices,
382
384
  }),
383
- onStop: () => {
385
+ onStop: (reason) => {
384
386
  onStop()
385
- compileServerOperation.cleaner.clean()
387
+ serverStopCallbackList.notify(reason)
386
388
  },
387
389
  })
388
390
 
@@ -559,7 +561,7 @@ const compareValueJson = (left, right) => {
559
561
  *
560
562
  */
561
563
  const setupServerSentEventsForLivereload = ({
562
- compileServerOperation,
564
+ serverStopCallbackList,
563
565
  projectDirectoryUrl,
564
566
  jsenvDirectoryRelativeUrl,
565
567
  outDirectoryRelativeUrl,
@@ -582,7 +584,7 @@ const setupServerSentEventsForLivereload = ({
582
584
  return
583
585
  }
584
586
 
585
- projectFileRequested.notify(relativeUrl, request)
587
+ projectFileRequested.notify({ relativeUrl, request })
586
588
  }
587
589
  const watchDescription = {
588
590
  ...livereloadWatchConfig,
@@ -605,7 +607,7 @@ const setupServerSentEventsForLivereload = ({
605
607
  recursive: true,
606
608
  },
607
609
  )
608
- compileServerOperation.cleaner.addCallback(unregisterDirectoryLifecyle)
610
+ serverStopCallbackList.add(unregisterDirectoryLifecyle)
609
611
 
610
612
  const getDependencySet = (mainRelativeUrl) => {
611
613
  if (trackerMap.has(mainRelativeUrl)) {
@@ -618,7 +620,7 @@ const setupServerSentEventsForLivereload = ({
618
620
  }
619
621
 
620
622
  // each time a file is requested for the first time its dependencySet is computed
621
- projectFileRequested.register((mainRelativeUrl) => {
623
+ projectFileRequested.add(({ relativeUrl: mainRelativeUrl }) => {
622
624
  // for now no use case of livereloading on node.js
623
625
  // and for browsers only html file can be main files
624
626
  // this avoid collecting dependencies of non html files that will never be used
@@ -632,8 +634,8 @@ const setupServerSentEventsForLivereload = ({
632
634
  dependencySet.add(mainRelativeUrl)
633
635
  trackerMap.set(mainRelativeUrl, dependencySet)
634
636
 
635
- const unregisterDependencyRequested = projectFileRequested.register(
636
- (relativeUrl, request) => {
637
+ const removeDependencyRequestedCallback = projectFileRequested.add(
638
+ ({ relativeUrl, request }) => {
637
639
  if (dependencySet.has(relativeUrl)) {
638
640
  return
639
641
  }
@@ -656,10 +658,10 @@ const setupServerSentEventsForLivereload = ({
656
658
  dependencySet.add(relativeUrl)
657
659
  },
658
660
  )
659
- const unregisterMainRemoved = projectFileRemoved.register((relativeUrl) => {
661
+ const removeMainRemovedCallback = projectFileRemoved.add((relativeUrl) => {
660
662
  if (relativeUrl === mainRelativeUrl) {
661
- unregisterDependencyRequested()
662
- unregisterMainRemoved()
663
+ removeDependencyRequestedCallback()
664
+ removeMainRemovedCallback()
663
665
  trackerMap.delete(mainRelativeUrl)
664
666
  }
665
667
  })
@@ -671,19 +673,19 @@ const setupServerSentEventsForLivereload = ({
671
673
  ) => {
672
674
  livereloadLogger.debug(`track ${mainRelativeUrl} and its dependencies`)
673
675
 
674
- const unregisterModified = projectFileModified.register((relativeUrl) => {
676
+ const removeModifiedCallback = projectFileModified.add((relativeUrl) => {
675
677
  const dependencySet = getDependencySet(mainRelativeUrl)
676
678
  if (dependencySet.has(relativeUrl)) {
677
679
  modified(relativeUrl)
678
680
  }
679
681
  })
680
- const unregisterRemoved = projectFileRemoved.register((relativeUrl) => {
682
+ const removeRemovedCallback = projectFileRemoved.add((relativeUrl) => {
681
683
  const dependencySet = getDependencySet(mainRelativeUrl)
682
684
  if (dependencySet.has(relativeUrl)) {
683
685
  removed(relativeUrl)
684
686
  }
685
687
  })
686
- const unregisterAdded = projectFileAdded.register((relativeUrl) => {
688
+ const removeAddedCallback = projectFileAdded.add((relativeUrl) => {
687
689
  const dependencySet = getDependencySet(mainRelativeUrl)
688
690
  if (dependencySet.has(relativeUrl)) {
689
691
  added(relativeUrl)
@@ -694,9 +696,9 @@ const setupServerSentEventsForLivereload = ({
694
696
  livereloadLogger.debug(
695
697
  `stop tracking ${mainRelativeUrl} and its dependencies.`,
696
698
  )
697
- unregisterModified()
698
- unregisterRemoved()
699
- unregisterAdded()
699
+ removeModifiedCallback()
700
+ removeRemovedCallback()
701
+ removeAddedCallback()
700
702
  }
701
703
  }
702
704
 
@@ -768,7 +770,7 @@ const setupServerSentEventsForLivereload = ({
768
770
  }
769
771
 
770
772
  const createSSEForLivereloadService = ({
771
- compileServerOperation,
773
+ serverStopCallbackList,
772
774
  outDirectoryRelativeUrl,
773
775
  trackMainAndDependencies,
774
776
  }) => {
@@ -802,13 +804,11 @@ const createSSEForLivereloadService = ({
802
804
  },
803
805
  })
804
806
 
805
- const removeSSECleanupCallback = compileServerOperation.cleaner.addCallback(
806
- () => {
807
- removeSSECleanupCallback()
808
- sseRoom.close()
809
- stopTracking()
810
- },
811
- )
807
+ const removeSSECleanupCallback = serverStopCallbackList.add(() => {
808
+ removeSSECleanupCallback()
809
+ sseRoom.close()
810
+ stopTracking()
811
+ })
812
812
  cache.push({
813
813
  mainFileRelativeUrl,
814
814
  sseRoom,
@@ -857,10 +857,13 @@ const createCompilationAssetFileService = ({ projectDirectoryUrl }) => {
857
857
  const { origin, ressource } = request
858
858
  const requestUrl = `${origin}${ressource}`
859
859
  if (urlIsCompilationAsset(requestUrl)) {
860
- return serveFile(request, {
861
- rootDirectoryUrl: projectDirectoryUrl,
862
- etagEnabled: true,
863
- })
860
+ return fetchFileSystem(
861
+ new URL(request.ressource.slice(1), projectDirectoryUrl),
862
+ {
863
+ headers: request.headers,
864
+ etagEnabled: true,
865
+ },
866
+ )
864
867
  }
865
868
  return null
866
869
  }
@@ -916,10 +919,13 @@ const createSourceFileService = ({
916
919
  const relativeUrl = ressource.slice(1)
917
920
  projectFileRequestedCallback(relativeUrl, request)
918
921
 
919
- const responsePromise = serveFile(request, {
920
- rootDirectoryUrl: projectDirectoryUrl,
921
- etagEnabled: projectFileEtagEnabled,
922
- })
922
+ const responsePromise = fetchFileSystem(
923
+ new URL(request.ressource.slice(1), projectDirectoryUrl),
924
+ {
925
+ headers: request.headers,
926
+ etagEnabled: projectFileEtagEnabled,
927
+ },
928
+ )
923
929
 
924
930
  return responsePromise
925
931
  }
@@ -1051,10 +1057,13 @@ const createOutFilesService = async ({
1051
1057
  if (!isOutRootFile(requestUrl)) {
1052
1058
  return null
1053
1059
  }
1054
- return serveFile(request, {
1055
- rootDirectoryUrl: projectDirectoryUrl,
1056
- etagEnabled: true,
1057
- })
1060
+ return fetchFileSystem(
1061
+ new URL(request.ressource.slice(1), projectDirectoryUrl),
1062
+ {
1063
+ headers: request.headers,
1064
+ etagEnabled: true,
1065
+ },
1066
+ )
1058
1067
  }
1059
1068
  }
1060
1069
  // serve from memory
@@ -1,6 +1,5 @@
1
1
  import { resolveUrl, urlToFileSystemPath, readFile } from "@jsenv/filesystem"
2
2
 
3
- import { Abortable } from "@jsenv/core/src/abort/main.js"
4
3
  import {
5
4
  babelPluginsFromBabelPluginMap,
6
5
  getMinimalBabelPluginMap,
@@ -15,7 +14,7 @@ export const relativeUrlToEmptyCoverage = async (
15
14
  const { transformAsync } = await import("@babel/core")
16
15
 
17
16
  const fileUrl = resolveUrl(relativeUrl, projectDirectoryUrl)
18
- Abortable.throwIfAborted(multipleExecutionsOperation)
17
+ multipleExecutionsOperation.throwIfAborted()
19
18
  const source = await readFile(fileUrl)
20
19
 
21
20
  try {
@@ -25,7 +24,7 @@ export const relativeUrlToEmptyCoverage = async (
25
24
  "transform-instrument": [babelPluginInstrument, { projectDirectoryUrl }],
26
25
  }
27
26
 
28
- Abortable.throwIfAborted(multipleExecutionsOperation)
27
+ multipleExecutionsOperation.throwIfAborted()
29
28
  const { metadata } = await transformAsync(source, {
30
29
  filename: urlToFileSystemPath(fileUrl),
31
30
  filenameRelative: relativeUrl,
@@ -1,4 +1,5 @@
1
- import { setANSIColor } from "../logs/log_style.js"
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
 
@@ -39,19 +40,19 @@ export const createSummaryDetails = ({
39
40
  cancelledCount,
40
41
  }) => {
41
42
  if (abortedCount === executionCount) {
42
- return `all ${setANSIColor(`aborted`, EXECUTION_COLORS.aborted)}`
43
+ return `all ${ANSI.color(`aborted`, EXECUTION_COLORS.aborted)}`
43
44
  }
44
45
  if (timedoutCount === executionCount) {
45
- return `all ${setANSIColor(`timed out`, EXECUTION_COLORS.timedout)}`
46
+ return `all ${ANSI.color(`timed out`, EXECUTION_COLORS.timedout)}`
46
47
  }
47
48
  if (erroredCount === executionCount) {
48
- return `all ${setANSIColor(`errored`, EXECUTION_COLORS.errored)}`
49
+ return `all ${ANSI.color(`errored`, EXECUTION_COLORS.errored)}`
49
50
  }
50
51
  if (completedCount === executionCount) {
51
- return `all ${setANSIColor(`completed`, EXECUTION_COLORS.completed)}`
52
+ return `all ${ANSI.color(`completed`, EXECUTION_COLORS.completed)}`
52
53
  }
53
54
  if (cancelledCount === executionCount) {
54
- return `all ${setANSIColor(`cancelled`, EXECUTION_COLORS.cancelled)}`
55
+ return `all ${ANSI.color(`cancelled`, EXECUTION_COLORS.cancelled)}`
55
56
  }
56
57
 
57
58
  return createMixedDetails({
@@ -75,22 +76,19 @@ const createMixedDetails = ({
75
76
 
76
77
  if (timedoutCount) {
77
78
  parts.push(
78
- `${timedoutCount} ${setANSIColor(
79
- `timed out`,
80
- EXECUTION_COLORS.timedout,
81
- )}`,
79
+ `${timedoutCount} ${ANSI.color(`timed out`, EXECUTION_COLORS.timedout)}`,
82
80
  )
83
81
  }
84
82
 
85
83
  if (erroredCount) {
86
84
  parts.push(
87
- `${erroredCount} ${setANSIColor(`errored`, EXECUTION_COLORS.errored)}`,
85
+ `${erroredCount} ${ANSI.color(`errored`, EXECUTION_COLORS.errored)}`,
88
86
  )
89
87
  }
90
88
 
91
89
  if (completedCount) {
92
90
  parts.push(
93
- `${completedCount} ${setANSIColor(
91
+ `${completedCount} ${ANSI.color(
94
92
  `completed`,
95
93
  EXECUTION_COLORS.completed,
96
94
  )}`,
@@ -99,13 +97,13 @@ const createMixedDetails = ({
99
97
 
100
98
  if (abortedCount) {
101
99
  parts.push(
102
- `${abortedCount} ${setANSIColor(`aborted`, EXECUTION_COLORS.aborted)}`,
100
+ `${abortedCount} ${ANSI.color(`aborted`, EXECUTION_COLORS.aborted)}`,
103
101
  )
104
102
  }
105
103
 
106
104
  if (cancelledCount) {
107
105
  parts.push(
108
- `${cancelledCount} ${setANSIColor(
106
+ `${cancelledCount} ${ANSI.color(
109
107
  `cancelled`,
110
108
  EXECUTION_COLORS.cancelled,
111
109
  )}`,
@@ -2,10 +2,10 @@ import { stat } from "node:fs"
2
2
  import wrapAnsi from "wrap-ansi"
3
3
  import { loggerToLevels, createDetailedMessage } from "@jsenv/logger"
4
4
  import { urlToFileSystemPath } from "@jsenv/filesystem"
5
+ import { createLog } from "@jsenv/log"
5
6
 
6
7
  import { launchAndExecute } from "../executing/launchAndExecute.js"
7
8
  import { reportToCoverage } from "./coverage/reportToCoverage.js"
8
- import { writeLog } from "./writeLog.js"
9
9
  import { createExecutionResultLog } from "./executionLogs.js"
10
10
  import { createSummaryLog } from "./createSummaryLog.js"
11
11
 
@@ -173,11 +173,13 @@ export const executeConcurrently = async (
173
173
  : true) &&
174
174
  executionResult.status === "completed"
175
175
  ) {
176
- previousExecutionLog = previousExecutionLog.update(log)
176
+ previousExecutionLog.write(log)
177
177
  } else {
178
- previousExecutionLog = writeLog(log, {
179
- mightUpdate: completedExecutionLogMerging,
180
- })
178
+ if (previousExecutionLog) {
179
+ previousExecutionLog.destroy()
180
+ }
181
+ previousExecutionLog = createLog()
182
+ previousExecutionLog.write(log)
181
183
  }
182
184
  }
183
185
 
@@ -1,7 +1,5 @@
1
- import {
2
- Abortable,
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"
@@ -74,97 +72,99 @@ export const executePlan = async (
74
72
  })
75
73
  })
76
74
 
77
- const multipleExecutionsOperation = Abortable.fromSignal(signal)
75
+ const multipleExecutionsOperation = Abort.startOperation()
76
+ multipleExecutionsOperation.addAbortSignal(signal)
78
77
  if (handleSIGINT) {
79
- Abortable.effect(multipleExecutionsOperation, (cb) =>
80
- raceProcessTeardownEvents(
78
+ multipleExecutionsOperation.addAbortSource((abort) => {
79
+ return raceProcessTeardownEvents(
81
80
  {
82
81
  SIGINT: true,
83
82
  },
84
83
  () => {
85
84
  logger.info("Aborting execution (SIGINT)")
86
- cb()
85
+ abort()
87
86
  },
88
- ),
89
- )
87
+ )
88
+ })
90
89
  }
91
90
 
92
- const compileServer = await startCompileServer({
93
- signal: multipleExecutionsOperation.signal,
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
- {
91
+ try {
92
+ const compileServer = await startCompileServer({
128
93
  signal: multipleExecutionsOperation.signal,
129
- projectDirectoryUrl,
130
- },
131
- )
94
+ compileServerLogLevel,
132
95
 
133
- const result = await executeConcurrently(executionSteps, {
134
- multipleExecutionsOperation,
135
- logger,
136
- launchAndExecuteLogLevel,
137
-
138
- projectDirectoryUrl,
139
- compileServerOrigin: compileServer.origin,
140
- outDirectoryRelativeUrl: compileServer.outDirectoryRelativeUrl,
141
-
142
- // not sure we actually have to pass import params to executeConcurrently
143
- importResolutionMethod,
144
- importDefaultExtension,
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
+ })
145
117
 
146
- babelPluginMap: compileServer.babelPluginMap,
118
+ multipleExecutionsOperation.addEndCallback(async () => {
119
+ await compileServer.stop()
120
+ })
147
121
 
148
- defaultMsAllocatedPerExecution,
149
- maxExecutionsInParallel,
150
- completedExecutionLogMerging,
151
- completedExecutionLogAbbreviation,
152
- logSummary,
153
- measureGlobalDuration,
122
+ const executionSteps = await generateExecutionSteps(
123
+ {
124
+ ...plan,
125
+ [compileServer.outDirectoryRelativeUrl]: null,
126
+ },
127
+ {
128
+ signal: multipleExecutionsOperation.signal,
129
+ projectDirectoryUrl,
130
+ },
131
+ )
154
132
 
155
- coverage,
156
- coverageConfig,
157
- coverageIncludeMissing,
158
- coverageForceIstanbul,
159
- coverageV8MergeConflictIsExpected,
160
- })
133
+ const result = await executeConcurrently(executionSteps, {
134
+ multipleExecutionsOperation,
135
+ logger,
136
+ launchAndExecuteLogLevel,
161
137
 
162
- // (used to stop potential chrome browser still opened to be reused)
163
- multipleExecutionsOperation.cleaner.clean("all execution done")
138
+ projectDirectoryUrl,
139
+ compileServerOrigin: compileServer.origin,
140
+ outDirectoryRelativeUrl: compileServer.outDirectoryRelativeUrl,
141
+
142
+ // not sure we actually have to pass import params to executeConcurrently
143
+ importResolutionMethod,
144
+ importDefaultExtension,
145
+
146
+ babelPluginMap: compileServer.babelPluginMap,
147
+
148
+ defaultMsAllocatedPerExecution,
149
+ maxExecutionsInParallel,
150
+ completedExecutionLogMerging,
151
+ completedExecutionLogAbbreviation,
152
+ logSummary,
153
+ measureGlobalDuration,
154
+
155
+ coverage,
156
+ coverageConfig,
157
+ coverageIncludeMissing,
158
+ coverageForceIstanbul,
159
+ coverageV8MergeConflictIsExpected,
160
+ })
164
161
 
165
- return {
166
- planSummary: result.summary,
167
- planReport: result.report,
168
- planCoverage: result.coverage,
162
+ return {
163
+ planSummary: result.summary,
164
+ planReport: result.report,
165
+ planCoverage: result.coverage,
166
+ }
167
+ } finally {
168
+ await multipleExecutionsOperation.end()
169
169
  }
170
170
  }
@@ -1,9 +1,5 @@
1
- import {
2
- failureSignColorLess,
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 setANSIColor(
60
- `${failureSignColorLess} execution ${executionNumber} of ${executionCount} aborted`,
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 setANSIColor(
66
- `${failureSignColorLess} execution ${executionNumber} of ${executionCount} timeout after ${allocatedMs}ms`,
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 setANSIColor(
72
- `${failureSignColorLess} execution ${executionNumber} of ${executionCount} error`,
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 setANSIColor(
78
- `${okSignColorLess} execution ${executionNumber} of ${executionCount} completed`,
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 setANSIColor(
84
- `${failureSignColorLess} execution ${executionNumber} of ${executionCount} cancelled`,
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
- ${setANSIColor(`-------- console --------`, ANSI_GREY)}
104
+ ${ANSI.color(`-------- console --------`, ANSI.GREY)}
109
105
  ${consoleOutputTrimmed}
110
- ${setANSIColor(`-------------------------`, ANSI_GREY)}`
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: ANSI_MAGENTA,
11
- timedout: ANSI_YELLOW,
12
- errored: ANSI_RED,
13
- completed: ANSI_GREEN,
14
- cancelled: ANSI_GREY,
4
+ aborted: ANSI.MAGENTA,
5
+ timedout: ANSI.YELLOW,
6
+ errored: ANSI.RED,
7
+ completed: ANSI.GREEN,
8
+ cancelled: ANSI.GREY,
15
9
  }