zarro 1.149.0 → 1.150.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.
@@ -386,7 +386,6 @@
386
386
  const positiveFlags = ["yes", "true", "1"];
387
387
  const negativeFlags = ["no", "false", "0"];
388
388
  function resolveFlag(name, fallback) {
389
- debugger;
390
389
  const resolved = resolveInternal(name), value = resolved === undefined || resolved === ""
391
390
  ? undefined
392
391
  : resolved.toLowerCase();
@@ -48,6 +48,11 @@
48
48
  default: "false",
49
49
  help: "run your dotnet core tests in parallel - will be automatically enabled if not set and the quackers logger is used"
50
50
  });
51
+ env.register({
52
+ name: "DOTNET_TEST_REBUILD",
53
+ default: "false",
54
+ help: "force project rebuild before testing - useful if you don't have a full pipeline that includes an initial build (eg when using test-dotnet-logic manually"
55
+ });
51
56
  env.register({
52
57
  name: "DOTNET_PARALLEL_STAGGER_MS",
53
58
  default: "1000",
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  (function () {
4
- const QUACKERS_LOG_PREFIX = ":quackers_log:", QUACKERS_SUMMARY_START_MARKER = `::start_summary::`, QUACKERS_SUMMARY_COMPLETE_MARKER = `::summary_complete::`, QUACKERS_FAILURE_START_MARKER = `::start_failures::`, QUACKERS_FAILURE_INDEX_PLACEHOLDER = "::[#]::", QUACKERS_SLOW_INDEX_PLACEHOLDER = "::[-]::", QUACKERS_SLOW_SUMMARY_START_MARKER = "::slow_summary_start::", QUACKERS_SLOW_SUMMARY_COMPLETE_MARKER = "::slow_summary_complete::", QUACKERS_VERBOSE_SUMMARY = "true", QUACKERS_OUTPUT_FAILURES_INLINE = "true", quackersLogPrefixLength = QUACKERS_LOG_PREFIX.length, quackersFullSummaryStartMarker = `${QUACKERS_LOG_PREFIX}${QUACKERS_SUMMARY_START_MARKER}`, quackersFullSummaryCompleteMarker = `${QUACKERS_LOG_PREFIX}${QUACKERS_SUMMARY_COMPLETE_MARKER}`, { rm, ls, FsEntities, readTextFile, mkdir } = require("yafs"), gulp = requireModule("gulp"), log = requireModule("log"), path = require("path"), gulpDebug = require("gulp-debug"), debug = requireModule("debug")(__filename), filter = require("gulp-filter"), ansiColors = requireModule("ansi-colors"), promisifyStream = requireModule("promisify-stream"), nunitRunner = requireModule("gulp-nunit-runner"), testUtilFinder = requireModule("testutil-finder"), env = requireModule("env"), resolveTestMasks = requireModule("resolve-test-masks"), logConfig = requireModule("log-config"), gatherPaths = requireModule("gather-paths"), { test } = requireModule("dotnet-cli"), { resolveTestPrefixFor } = requireModule("test-utils"), buildReportFolder = path.dirname(env.resolve("BUILD_REPORT_XML")), Version = requireModule("version"), quote = requireModule("quote-if-required"), netFrameworkTestAssemblyFilter = requireModule("netfx-test-assembly-filter"), { baseName, chopExtension } = requireModule("path-utils");
4
+ const QUACKERS_LOG_PREFIX = ":quackers_log:", QUACKERS_SUMMARY_START_MARKER = `::start_summary::`, QUACKERS_SUMMARY_COMPLETE_MARKER = `::summary_complete::`, QUACKERS_FAILURE_START_MARKER = `::start_failures::`, QUACKERS_FAILURE_INDEX_PLACEHOLDER = "::[#]::", QUACKERS_SLOW_INDEX_PLACEHOLDER = "::[-]::", QUACKERS_SLOW_SUMMARY_START_MARKER = "::slow_summary_start::", QUACKERS_SLOW_SUMMARY_COMPLETE_MARKER = "::slow_summary_complete::", QUACKERS_SHOW_SUMMARY = "true", QUACKERS_SUMMARY_TOTALS_START_MARKER = "::totals_summary_start::", QUACKERS_SUMMARY_TOTALS_COMPLETE_MARKER = "::totals_summary_complete::", QUACKERS_OUTPUT_FAILURES_INLINE = "true", quackersLogPrefixLength = QUACKERS_LOG_PREFIX.length, quackersFullSummaryStartMarker = `${QUACKERS_LOG_PREFIX}${QUACKERS_SUMMARY_START_MARKER}`, quackersFullSummaryCompleteMarker = `${QUACKERS_LOG_PREFIX}${QUACKERS_SUMMARY_COMPLETE_MARKER}`, { rm, ls, FsEntities, readTextFile, mkdir } = require("yafs"), gulp = requireModule("gulp"), log = requireModule("log"), path = require("path"), gulpDebug = require("gulp-debug"), debug = requireModule("debug")(__filename), filter = require("gulp-filter"), ansiColors = requireModule("ansi-colors"), promisifyStream = requireModule("promisify-stream"), nunitRunner = requireModule("gulp-nunit-runner"), testUtilFinder = requireModule("testutil-finder"), env = requireModule("env"), resolveTestMasks = requireModule("resolve-test-masks"), logConfig = requireModule("log-config"), gatherPaths = requireModule("gather-paths"), { test } = requireModule("dotnet-cli"), { resolveTestPrefixFor } = requireModule("test-utils"), buildReportFolder = path.dirname(env.resolve("BUILD_REPORT_XML")), Version = requireModule("version"), quote = requireModule("quote-if-required"), netFrameworkTestAssemblyFilter = requireModule("netfx-test-assembly-filter"), { baseName, chopExtension } = requireModule("path-utils");
5
5
  async function runTests() {
6
6
  await mkdir(buildReportFolder);
7
7
  const dotNetCore = env.resolveFlag("DOTNET_CORE");
@@ -159,7 +159,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
159
159
  failureSummary: [],
160
160
  slowSummary: [],
161
161
  started: Date.now(),
162
- fullLog: []
162
+ fullLog: [],
163
163
  }, testProcessResults = [], testProjectPaths = await gatherPaths(testProjects, true), verbosity = env.resolve("BUILD_VERBOSITY");
164
164
  const testInParallel = await shouldTestInParallel(testProjectPaths);
165
165
  const concurrency = testInParallel
@@ -169,11 +169,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
169
169
  for (const projectPath of testProjectPaths) {
170
170
  console.log(` ${projectPath}`);
171
171
  }
172
+ const rebuild = env.resolveFlag(env.DOTNET_TEST_REBUILD);
173
+ const runningInParallel = concurrency > 1;
172
174
  const tasks = testProjectPaths.map((path, idx) => {
173
175
  return async () => {
174
176
  debug(`${idx} start test run ${path}`);
175
- const result = await testOneDotNetCoreProject(path, configuration, verbosity, testResults, true);
176
- testProcessResults.push(result);
177
+ try {
178
+ const result = await testOneDotNetCoreProject(path, configuration, verbosity, testResults, runningInParallel, rebuild);
179
+ testProcessResults.push(result);
180
+ }
181
+ catch (e) {
182
+ console.error(`unable to test dotnet core project '${path}':\n${e}`);
183
+ process.exit(1);
184
+ }
177
185
  };
178
186
  });
179
187
  await runInParallel(concurrency, ...tasks);
@@ -236,13 +244,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
236
244
  : ansiColors.yellowBright.bind(ansiColors);
237
245
  logFailures(testResults, red);
238
246
  logSlow(testResults, cyan);
239
- console.log(yellow(`
240
- Test Run Summary
241
- Overall result: ${overallResultFor(testResults)}
242
- Test Count: ${total}, Passed: ${testResults.passed}, Failed: ${testResults.failed}, Skipped: ${testResults.skipped}, Slow: ${testResults.slowSummary.length}
243
- Start time: ${dateString(testResults.started)}
244
- End time: ${dateString(now)}
245
- Duration: ${runTime}
247
+ console.log(yellow(`
248
+ Test Run Summary
249
+ Overall result: ${overallResultFor(testResults)}
250
+ Test Count: ${total}
251
+ Passed: ${testResults.passed}
252
+ Failed: ${testResults.failed}
253
+ Skipped: ${testResults.skipped}
254
+ Slow: ${testResults.slowSummary.length}
255
+ Start time: ${dateString(testResults.started)}
256
+ End time: ${dateString(now)}
257
+ Duration: ${runTime}
246
258
  `));
247
259
  console.log("\n");
248
260
  }
@@ -297,6 +309,7 @@ Test Run Summary
297
309
  inSummary: false,
298
310
  inFailureSummary: false,
299
311
  inSlowSummary: false,
312
+ inTotalsSummary: false,
300
313
  // there is some valid logging (eg build) before the first quackers log
301
314
  // -> suppress when running in parallel (and by default when sequential)
302
315
  haveSeenQuackersLog: runningInParallel || env.resolveFlag("DOTNET_TEST_QUIET_QUACKERS"),
@@ -314,7 +327,8 @@ Test Run Summary
314
327
  ? "quiet" // if quackers is providing details, quieten down the built-in console logger
315
328
  : verbosity;
316
329
  await mkdir(buildReportFolder);
317
- addTrxLoggerTo(loggers, target);
330
+ // FIXME: re-enable once totals tests are passing
331
+ // addTrxLoggerTo(loggers, target);
318
332
  testResults.quackersEnabled = testResults.quackersEnabled || useQuackers;
319
333
  try {
320
334
  const result = await test({
@@ -349,113 +363,120 @@ Test Run Summary
349
363
  console.error(s);
350
364
  }
351
365
  function quackersStdOutHandler(state, s) {
352
- s = s || "";
353
- if (s.includes("\n")) {
354
- const lines = s.split("\n").map(s => s.trimEnd());
355
- for (const line of lines) {
356
- quackersStdOutHandler(state, line);
357
- }
358
- return;
359
- }
360
- state.fullLog.push(s);
361
- debug(`[test stdout] ${s}`);
362
- if (s.startsWith(quackersFullSummaryStartMarker)) {
363
- debug(" summary starts");
364
- state.inSummary = true;
365
- return;
366
- }
367
- if (s.startsWith(quackersFullSummaryCompleteMarker)) {
368
- debug(" summary ends");
369
- state.inSummary = false;
370
- return;
371
- }
372
- if (state.inSummary) {
373
- const hasQuackersPrefix = s.startsWith(QUACKERS_LOG_PREFIX);
374
- if (s.match(/overall/i)) {
375
- console.log({
376
- state,
377
- isQuackersLog: hasQuackersPrefix
378
- });
379
- }
380
- /* actual summary log example, using settings
381
-
382
- QUACKERS_LOG_PREFIX = "::",
383
- QUACKERS_SUMMARY_START_MARKER = `::SS::`,
384
- QUACKERS_SUMMARY_COMPLETE_MARKER = `::SC::`,
385
- QUACKERS_FAILURE_START_MARKER = `::SF::`,
386
- QUACKERS_FAILURE_INDEX_PLACEHOLDER = "::[#]::",
387
- QUACKERS_SLOW_INDEX_PLACEHOLDER = "::[-]::",
388
- QUACKERS_SLOW_SUMMARY_START_MARKER = "::SSS::",
389
- QUACKERS_SLOW_SUMMARY_COMPLETE_MARKER = "::SSC::",
390
- QUACKERS_VERBOSE_SUMMARY = "true",
391
- QUACKERS_OUTPUT_FAILURES_INLINE = "true",
392
-
393
- ::::SS::
394
- ::::SSS::
395
- :: {some slow summary data}
396
- ::::SSC::
397
- ::
398
- ::
399
- ::Test results:
400
- ::Passed: 8
401
- ::Failed: 2
402
- ::Skipped: 1
403
- ::Total: 11
404
-
405
- ::Failures:
406
-
407
- ::[1] QuackersTestHost.SomeTests.ShouldBeLessThan50(75)
408
- :: NExpect.Exceptions.UnmetExpectationException : Expected 75 to be less than 50
409
- :: at QuackersTestHost.SomeTests.ShouldBeLessThan50(Int32 value) in C:\code\opensource\quackers\src\Demo\SomeTests.cs:line 66
410
- ::
411
-
412
- ::[2] QuackersTestHost.SomeTests.ShouldFail
413
- :: NExpect.Exceptions.UnmetExpectationException : Expected false but got true
414
- :: at QuackersTestHost.SomeTests.ShouldFail() in C:\code\opensource\quackers\src\Demo\SomeTests.cs:line 28
415
- ::
416
- ::::SC::
417
- */
418
- const line = stripQuackersLogPrefix(s);
419
- if (line.startsWith(QUACKERS_FAILURE_START_MARKER)) {
420
- debug("failure summary start");
421
- state.inFailureSummary = true;
366
+ try {
367
+ s = s || "";
368
+ if (s.includes("\n")) {
369
+ const lines = s.split("\n").map(s => s.trimEnd());
370
+ for (const line of lines) {
371
+ quackersStdOutHandler(state, line);
372
+ }
422
373
  return;
423
374
  }
424
- if (line.startsWith(QUACKERS_SLOW_SUMMARY_START_MARKER)) {
425
- debug("slow summary start");
426
- state.inSlowSummary = true;
375
+ state.fullLog.push(s);
376
+ debug(`[test stdout] ${s}`);
377
+ if (s.startsWith(quackersFullSummaryStartMarker)) {
378
+ debug(" summary starts");
379
+ state.inSummary = true;
427
380
  return;
428
381
  }
429
- if (line.startsWith(QUACKERS_SLOW_SUMMARY_COMPLETE_MARKER)) {
430
- debug("slow summary complete");
431
- state.inSlowSummary = false;
382
+ if (s.startsWith(quackersFullSummaryCompleteMarker)) {
383
+ debug(" summary ends");
384
+ state.inSummary = false;
432
385
  return;
433
386
  }
434
- if (state.inFailureSummary) {
435
- state.testResults.failureSummary.push(line);
387
+ if (state.inSummary) {
388
+ /* actual summary log example, using settings
389
+
390
+ QUACKERS_LOG_PREFIX = "::",
391
+ QUACKERS_SUMMARY_START_MARKER = `::SS::`,
392
+ QUACKERS_SUMMARY_COMPLETE_MARKER = `::SC::`,
393
+ QUACKERS_FAILURE_START_MARKER = `::SF::`,
394
+ QUACKERS_FAILURE_INDEX_PLACEHOLDER = "::[#]::",
395
+ QUACKERS_SLOW_INDEX_PLACEHOLDER = "::[-]::",
396
+ QUACKERS_SLOW_SUMMARY_START_MARKER = "::SSS::",
397
+ QUACKERS_SLOW_SUMMARY_COMPLETE_MARKER = "::SSC::",
398
+ QUACKERS_VERBOSE_SUMMARY = "true",
399
+ QUACKERS_OUTPUT_FAILURES_INLINE = "true",
400
+
401
+ ::::SS::
402
+ ::::SSS::
403
+ :: {some slow summary data}
404
+ ::::SSC::
405
+ ::
406
+ ::
407
+ ::Test results:
408
+ ::Passed: 8
409
+ ::Failed: 2
410
+ ::Skipped: 1
411
+ ::Total: 11
412
+
413
+ ::Failures:
414
+
415
+ ::[1] QuackersTestHost.SomeTests.ShouldBeLessThan50(75)
416
+ :: NExpect.Exceptions.UnmetExpectationException : Expected 75 to be less than 50
417
+ :: at QuackersTestHost.SomeTests.ShouldBeLessThan50(Int32 value) in C:\code\opensource\quackers\src\Demo\SomeTests.cs:line 66
418
+ ::
419
+
420
+ ::[2] QuackersTestHost.SomeTests.ShouldFail
421
+ :: NExpect.Exceptions.UnmetExpectationException : Expected false but got true
422
+ :: at QuackersTestHost.SomeTests.ShouldFail() in C:\code\opensource\quackers\src\Demo\SomeTests.cs:line 28
423
+ ::
424
+ ::::SC::
425
+ */
426
+ const line = stripQuackersLogPrefix(s);
427
+ if (line.startsWith(QUACKERS_FAILURE_START_MARKER)) {
428
+ debug("failure summary start");
429
+ state.inFailureSummary = true;
430
+ return;
431
+ }
432
+ if (line.startsWith(QUACKERS_SLOW_SUMMARY_START_MARKER)) {
433
+ debug("slow summary start");
434
+ state.inSlowSummary = true;
435
+ return;
436
+ }
437
+ if (line.startsWith(QUACKERS_SLOW_SUMMARY_COMPLETE_MARKER)) {
438
+ debug("slow summary complete");
439
+ state.inSlowSummary = false;
440
+ return;
441
+ }
442
+ if (line.startsWith(QUACKERS_SUMMARY_TOTALS_START_MARKER)) {
443
+ debug("totals summary start");
444
+ state.inTotalsSummary = true;
445
+ return;
446
+ }
447
+ if (line.startsWith(QUACKERS_SUMMARY_TOTALS_COMPLETE_MARKER)) {
448
+ debug("totals summary complete");
449
+ state.inTotalsSummary = false;
450
+ return;
451
+ }
452
+ if (state.inTotalsSummary) {
453
+ incrementTestResultCount(state.testResults, line);
454
+ return;
455
+ }
456
+ if (state.inFailureSummary) {
457
+ state.testResults.failureSummary.push(line);
458
+ return;
459
+ }
460
+ if (state.inSlowSummary) {
461
+ state.testResults.slowSummary.push(line);
462
+ return;
463
+ }
436
464
  return;
437
465
  }
438
- if (state.inSlowSummary) {
439
- state.testResults.slowSummary.push(line);
466
+ const isQuackersLog = s.startsWith(QUACKERS_LOG_PREFIX);
467
+ if (isQuackersLog) {
468
+ state.haveSeenQuackersLog = true;
469
+ }
470
+ if (!state.haveSeenQuackersLog || isQuackersLog) {
471
+ console.log(stripQuackersLogPrefix(s));
472
+ }
473
+ else {
474
+ debug(`discarding log: "${s}"`);
440
475
  }
441
- incrementTestResultCount(state.testResults, line);
442
- return;
443
- }
444
- const isQuackersLog = s.startsWith(QUACKERS_LOG_PREFIX);
445
- if (s.match(/overall/i)) {
446
- console.log({
447
- state,
448
- isQuackersLog
449
- });
450
- }
451
- if (isQuackersLog) {
452
- state.haveSeenQuackersLog = true;
453
- }
454
- if (!state.haveSeenQuackersLog || isQuackersLog) {
455
- console.log(stripQuackersLogPrefix(s));
456
476
  }
457
- else {
458
- debug(`discarding log: "${s}"`);
477
+ catch (e) {
478
+ const err = e;
479
+ const err2 = err;
459
480
  }
460
481
  }
461
482
  function incrementTestResultCount(testResults, line) {
@@ -512,10 +533,12 @@ Test Run Summary
512
533
  QUACKERS_FAILURE_START_MARKER,
513
534
  QUACKERS_SLOW_SUMMARY_START_MARKER,
514
535
  QUACKERS_SLOW_SUMMARY_COMPLETE_MARKER,
515
- QUACKERS_VERBOSE_SUMMARY,
536
+ QUACKERS_VERBOSE_SUMMARY: QUACKERS_SHOW_SUMMARY,
516
537
  QUACKERS_OUTPUT_FAILURES_INLINE,
517
538
  QUACKERS_FAILURE_INDEX_PLACEHOLDER,
518
- QUACKERS_SLOW_INDEX_PLACEHOLDER
539
+ QUACKERS_SLOW_INDEX_PLACEHOLDER,
540
+ QUACKERS_SUMMARY_TOTALS_START_MARKER,
541
+ QUACKERS_SUMMARY_TOTALS_COMPLETE_MARKER
519
542
  };
520
543
  if (prefix) {
521
544
  quackersVars.QUACKERS_TEST_NAME_PREFIX = prefix;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.149.0",
3
+ "version": "1.150.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"
@@ -22,7 +22,7 @@
22
22
  "autotest-full-once": "run-s clear-console build test",
23
23
  "autotest-full": "nodemon -w gulp-tasks -w tests -w types.d.ts -x \"npm run autotest-full-once || cd .\" -e ts",
24
24
  "preautobuild": "run-s build-fetch-github-release",
25
- "autobuild": "tsc --watch --incremental",
25
+ "autobuild": "nodemon -w gulp-tasks/**/*.ts -i gulp-tasks/modules/fetch-github-release -w tests/**/*.ts -w types.d.ts -x \"npm run build || cd .\" -e ts",
26
26
  "prestart": "run-s build",
27
27
  "start": "node index.js",
28
28
  "zarro": "node index.js",
@@ -119,9 +119,11 @@
119
119
  "debugger-is-attached": "^1.2.0",
120
120
  "expect-even-more-jest": "^1.15.0",
121
121
  "filesystem-sandbox": "^1.20.0",
122
+ "ioredis": "^5.3.2",
122
123
  "jest": "^29.6.2",
123
124
  "nodemon": "^3.0.1",
124
125
  "proxyquire": "^2.1.3",
126
+ "redlock": "^5.0.0-beta.2",
125
127
  "ts-jest": "^29.1.1",
126
128
  "typescript": "^5.1.6",
127
129
  "yargs": "^16.2.0"
package/types.d.ts CHANGED
@@ -471,6 +471,7 @@ declare global {
471
471
  "BUILD_FAIL_ON_ERROR" |
472
472
  "BUILD_MSBUILD_NODE_REUSE" |
473
473
  "DOTNET_TEST_PARALLEL" |
474
+ "DOTNET_TEST_REBUILD" |
474
475
  "DOTNET_CORE" |
475
476
  "DRY_RUN" |
476
477
  "ENFORCE_VERIFICATION" |
@@ -644,6 +645,7 @@ declare global {
644
645
  BUILD_FAIL_ON_ERROR: FlagEnvVar;
645
646
  BUILD_MSBUILD_NODE_REUSE: FlagEnvVar;
646
647
  DOTNET_TEST_PARALLEL: FlagEnvVar;
648
+ DOTNET_TEST_REBUILD: FlagEnvVar;
647
649
  DOTNET_CORE: FlagEnvVar;
648
650
  DRY_RUN: FlagEnvVar;
649
651
  ENFORCE_VERIFICATION: FlagEnvVar;