zarro 1.149.2 → 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.
@@ -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,13 @@ 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
177
  try {
176
- const result = await testOneDotNetCoreProject(path, configuration, verbosity, testResults, true);
178
+ const result = await testOneDotNetCoreProject(path, configuration, verbosity, testResults, runningInParallel, rebuild);
177
179
  testProcessResults.push(result);
178
180
  }
179
181
  catch (e) {
@@ -245,7 +247,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
245
247
  console.log(yellow(`
246
248
  Test Run Summary
247
249
  Overall result: ${overallResultFor(testResults)}
248
- Test Count: ${total}, Passed: ${testResults.passed}, Failed: ${testResults.failed}, Skipped: ${testResults.skipped}, Slow: ${testResults.slowSummary.length}
250
+ Test Count: ${total}
251
+ Passed: ${testResults.passed}
252
+ Failed: ${testResults.failed}
253
+ Skipped: ${testResults.skipped}
254
+ Slow: ${testResults.slowSummary.length}
249
255
  Start time: ${dateString(testResults.started)}
250
256
  End time: ${dateString(now)}
251
257
  Duration: ${runTime}
@@ -303,6 +309,7 @@ Test Run Summary
303
309
  inSummary: false,
304
310
  inFailureSummary: false,
305
311
  inSlowSummary: false,
312
+ inTotalsSummary: false,
306
313
  // there is some valid logging (eg build) before the first quackers log
307
314
  // -> suppress when running in parallel (and by default when sequential)
308
315
  haveSeenQuackersLog: runningInParallel || env.resolveFlag("DOTNET_TEST_QUIET_QUACKERS"),
@@ -320,7 +327,8 @@ Test Run Summary
320
327
  ? "quiet" // if quackers is providing details, quieten down the built-in console logger
321
328
  : verbosity;
322
329
  await mkdir(buildReportFolder);
323
- addTrxLoggerTo(loggers, target);
330
+ // FIXME: re-enable once totals tests are passing
331
+ // addTrxLoggerTo(loggers, target);
324
332
  testResults.quackersEnabled = testResults.quackersEnabled || useQuackers;
325
333
  try {
326
334
  const result = await test({
@@ -355,113 +363,120 @@ Test Run Summary
355
363
  console.error(s);
356
364
  }
357
365
  function quackersStdOutHandler(state, s) {
358
- s = s || "";
359
- if (s.includes("\n")) {
360
- const lines = s.split("\n").map(s => s.trimEnd());
361
- for (const line of lines) {
362
- quackersStdOutHandler(state, line);
363
- }
364
- return;
365
- }
366
- state.fullLog.push(s);
367
- debug(`[test stdout] ${s}`);
368
- if (s.startsWith(quackersFullSummaryStartMarker)) {
369
- debug(" summary starts");
370
- state.inSummary = true;
371
- return;
372
- }
373
- if (s.startsWith(quackersFullSummaryCompleteMarker)) {
374
- debug(" summary ends");
375
- state.inSummary = false;
376
- return;
377
- }
378
- if (state.inSummary) {
379
- const hasQuackersPrefix = s.startsWith(QUACKERS_LOG_PREFIX);
380
- if (s.match(/overall/i)) {
381
- console.log({
382
- state,
383
- isQuackersLog: hasQuackersPrefix
384
- });
385
- }
386
- /* actual summary log example, using settings
387
-
388
- QUACKERS_LOG_PREFIX = "::",
389
- QUACKERS_SUMMARY_START_MARKER = `::SS::`,
390
- QUACKERS_SUMMARY_COMPLETE_MARKER = `::SC::`,
391
- QUACKERS_FAILURE_START_MARKER = `::SF::`,
392
- QUACKERS_FAILURE_INDEX_PLACEHOLDER = "::[#]::",
393
- QUACKERS_SLOW_INDEX_PLACEHOLDER = "::[-]::",
394
- QUACKERS_SLOW_SUMMARY_START_MARKER = "::SSS::",
395
- QUACKERS_SLOW_SUMMARY_COMPLETE_MARKER = "::SSC::",
396
- QUACKERS_VERBOSE_SUMMARY = "true",
397
- QUACKERS_OUTPUT_FAILURES_INLINE = "true",
398
-
399
- ::::SS::
400
- ::::SSS::
401
- :: {some slow summary data}
402
- ::::SSC::
403
- ::
404
- ::
405
- ::Test results:
406
- ::Passed: 8
407
- ::Failed: 2
408
- ::Skipped: 1
409
- ::Total: 11
410
-
411
- ::Failures:
412
-
413
- ::[1] QuackersTestHost.SomeTests.ShouldBeLessThan50(75)
414
- :: NExpect.Exceptions.UnmetExpectationException : Expected 75 to be less than 50
415
- :: at QuackersTestHost.SomeTests.ShouldBeLessThan50(Int32 value) in C:\code\opensource\quackers\src\Demo\SomeTests.cs:line 66
416
- ::
417
-
418
- ::[2] QuackersTestHost.SomeTests.ShouldFail
419
- :: NExpect.Exceptions.UnmetExpectationException : Expected false but got true
420
- :: at QuackersTestHost.SomeTests.ShouldFail() in C:\code\opensource\quackers\src\Demo\SomeTests.cs:line 28
421
- ::
422
- ::::SC::
423
- */
424
- const line = stripQuackersLogPrefix(s);
425
- if (line.startsWith(QUACKERS_FAILURE_START_MARKER)) {
426
- debug("failure summary start");
427
- 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
+ }
428
373
  return;
429
374
  }
430
- if (line.startsWith(QUACKERS_SLOW_SUMMARY_START_MARKER)) {
431
- debug("slow summary start");
432
- 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;
433
380
  return;
434
381
  }
435
- if (line.startsWith(QUACKERS_SLOW_SUMMARY_COMPLETE_MARKER)) {
436
- debug("slow summary complete");
437
- state.inSlowSummary = false;
382
+ if (s.startsWith(quackersFullSummaryCompleteMarker)) {
383
+ debug(" summary ends");
384
+ state.inSummary = false;
438
385
  return;
439
386
  }
440
- if (state.inFailureSummary) {
441
- 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
+ }
442
464
  return;
443
465
  }
444
- if (state.inSlowSummary) {
445
- 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}"`);
446
475
  }
447
- incrementTestResultCount(state.testResults, line);
448
- return;
449
- }
450
- const isQuackersLog = s.startsWith(QUACKERS_LOG_PREFIX);
451
- if (s.match(/overall/i)) {
452
- console.log({
453
- state,
454
- isQuackersLog
455
- });
456
- }
457
- if (isQuackersLog) {
458
- state.haveSeenQuackersLog = true;
459
- }
460
- if (!state.haveSeenQuackersLog || isQuackersLog) {
461
- console.log(stripQuackersLogPrefix(s));
462
476
  }
463
- else {
464
- debug(`discarding log: "${s}"`);
477
+ catch (e) {
478
+ const err = e;
479
+ const err2 = err;
465
480
  }
466
481
  }
467
482
  function incrementTestResultCount(testResults, line) {
@@ -518,10 +533,12 @@ Test Run Summary
518
533
  QUACKERS_FAILURE_START_MARKER,
519
534
  QUACKERS_SLOW_SUMMARY_START_MARKER,
520
535
  QUACKERS_SLOW_SUMMARY_COMPLETE_MARKER,
521
- QUACKERS_VERBOSE_SUMMARY,
536
+ QUACKERS_VERBOSE_SUMMARY: QUACKERS_SHOW_SUMMARY,
522
537
  QUACKERS_OUTPUT_FAILURES_INLINE,
523
538
  QUACKERS_FAILURE_INDEX_PLACEHOLDER,
524
- QUACKERS_SLOW_INDEX_PLACEHOLDER
539
+ QUACKERS_SLOW_INDEX_PLACEHOLDER,
540
+ QUACKERS_SUMMARY_TOTALS_START_MARKER,
541
+ QUACKERS_SUMMARY_TOTALS_COMPLETE_MARKER
525
542
  };
526
543
  if (prefix) {
527
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.2",
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;