zarro 1.202.0 → 1.203.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.
@@ -56,7 +56,7 @@
56
56
  });
57
57
  env.register({
58
58
  name: "MAX_CONCURRENCY",
59
- default: os.cpus().length.toString(),
59
+ default: `${Math.floor(os.cpus().length / 2)}`,
60
60
  help: "Overrides other concurrency settings (BUILD_MAX_CPU_COUNT, MAX_NUNIT_AGENTS)"
61
61
  });
62
62
  env.register({
@@ -183,7 +183,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
183
183
  });
184
184
  await runInParallel(concurrency, ...tasks);
185
185
  if (testResults.quackersEnabled) {
186
- logOverallResults(testResults);
186
+ logOverallResults(testResults, testProcessResults);
187
187
  }
188
188
  else {
189
189
  console.log("If you install Quackers.TestLogger into your test projects, you'll get a lot more info here!");
@@ -231,7 +231,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
231
231
  }
232
232
  return args.map(quote).join(" ");
233
233
  }
234
- function logOverallResults(testResults) {
234
+ function logOverallResults(testResults, testProcessResults) {
235
235
  const total = testResults.passed + testResults.skipped + testResults.failed, now = Date.now(), runTimeMs = now - testResults.started, runTime = nunitLikeTime(runTimeMs), darkerThemeSelected = (process.env["QUACKERS_THEME"] || "").toLowerCase() === "darker", red = darkerThemeSelected
236
236
  ? ansiColors.red.bind(ansiColors)
237
237
  : ansiColors.redBright.bind(ansiColors), cyan = darkerThemeSelected
@@ -239,6 +239,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
239
239
  : ansiColors.cyanBright.bind(ansiColors), yellow = darkerThemeSelected
240
240
  ? ansiColors.yellow.bind(ansiColors)
241
241
  : ansiColors.yellowBright.bind(ansiColors);
242
+ logTestSuiteTimes(testProcessResults, yellow);
242
243
  logFailures(testResults, red);
243
244
  logSlow(testResults, cyan);
244
245
  console.log(yellow(`
@@ -255,6 +256,41 @@ Test Run Summary
255
256
  `));
256
257
  console.log("\n");
257
258
  }
259
+ function logTestSuiteTimes(testProcessResults, yellow) {
260
+ if (!testProcessResults || testProcessResults.length === 0) {
261
+ return;
262
+ }
263
+ testProcessResults.sort((a, b) => {
264
+ if (a.runTimeMs === b.runTimeMs) {
265
+ return 0;
266
+ }
267
+ return a.runTimeMs > b.runTimeMs ? -1 : 1;
268
+ });
269
+ const assembliesAndTimes = testProcessResults.reduce((acc, cur) => {
270
+ const project = parseTestProjectFrom(cur.args);
271
+ acc.push({ project, runTimeMs: cur.runTimeMs });
272
+ return acc;
273
+ }, []);
274
+ console.log(yellow(`Test suite timings:`));
275
+ for (const r of assembliesAndTimes) {
276
+ console.log(yellow(` ${r.project}: ${nunitLikeTime(r.runTimeMs)}`));
277
+ }
278
+ }
279
+ function parseTestProjectFrom(args) {
280
+ let next = false;
281
+ for (const arg of args) {
282
+ if (arg === "test") {
283
+ next = true;
284
+ continue;
285
+ }
286
+ if (next) {
287
+ return path.basename(arg)
288
+ .replace(/\.dll$/i, "")
289
+ .replace(/\.csproj$/i, "");
290
+ }
291
+ }
292
+ return `(project name parse failed for:) ${args.join(" ")}`;
293
+ }
258
294
  function logSlow(testResults, cyan) {
259
295
  logResultsSection(testResults.slowSummary, cyan("Slow tests:"), QUACKERS_SLOW_INDEX_PLACEHOLDER);
260
296
  }
@@ -328,7 +364,7 @@ Test Run Summary
328
364
  // addTrxLoggerTo(loggers, target);
329
365
  testResults.quackersEnabled = testResults.quackersEnabled || useQuackers;
330
366
  try {
331
- const result = await test({
367
+ return await test({
332
368
  target,
333
369
  verbosity: finalVerbosity,
334
370
  configuration,
@@ -342,12 +378,10 @@ Test Run Summary
342
378
  env: testEnvironment,
343
379
  label
344
380
  });
345
- return result;
346
381
  }
347
382
  catch (e) {
348
383
  debug("WARN: catching SystemError instead of rethrowing it");
349
- const err = e;
350
- return err;
384
+ return e;
351
385
  }
352
386
  }
353
387
  function addTrxLoggerTo(loggers, target) {
@@ -557,6 +591,7 @@ Test Run Summary
557
591
  testWithNunitCli,
558
592
  shouldTestInParallel,
559
593
  testOneDotNetCoreProject,
560
- testAsDotNetCore
594
+ testAsDotNetCore,
595
+ logTestSuiteTimes
561
596
  };
562
597
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.202.0",
3
+ "version": "1.203.0",
4
4
  "description": "Some glue to make gulp easier, perhaps even zero- or close-to-zero-conf",
5
5
  "bin": {
6
6
  "zarro": "index.js"
@@ -87,6 +87,7 @@
87
87
  "sax": "^1.2.4",
88
88
  "semver": "^7.5.4",
89
89
  "simple-git": "^3.25.0",
90
+ "system-wrapper": "^1.8.0",
90
91
  "temp": "^0.9.4",
91
92
  "through2": "^3.0.2",
92
93
  "undertaker-forward-reference": "^1.0.2",
package/types.d.ts CHANGED
@@ -276,12 +276,14 @@ declare global {
276
276
  }
277
277
 
278
278
  type DotNetTester = (configuration: string, source: string[]) => Promise<TestResults>;
279
+ type ResultOrError = SystemResult | SystemError;
279
280
 
280
281
  interface TestDotNetLogic {
281
282
  runTests: () => Promise<void>;
282
283
  testWithNunitCli: DotNetTester;
283
284
  testAsDotNetCore: DotNetTester;
284
285
  shouldTestInParallel: (testProjectPaths: string[]) => Promise<boolean>;
286
+ logTestSuiteTimes: (results: ResultOrError[], styleFn: StyleFunction) => void;
285
287
  testOneDotNetCoreProject: (
286
288
  target: string,
287
289
  configuration: string,