doc-detective 3.1.0-dev.1 → 3.1.0-dev.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.
- package/package.json +3 -3
- package/reference.png +0 -0
- package/src/index.js +1 -1
- package/src/utils.js +122 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doc-detective",
|
|
3
|
-
"version": "3.1.0-dev.
|
|
3
|
+
"version": "3.1.0-dev.2",
|
|
4
4
|
"description": "Treat doc content as testable assertions to validate doc accuracy and product UX.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"doc-detective": "src/index.js"
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
36
36
|
"doc-detective-common": "^3.1.0-dev.1",
|
|
37
|
-
"doc-detective-core": "^3.
|
|
37
|
+
"doc-detective-core": "^3.1.0-dev.2",
|
|
38
38
|
"yargs": "^17.7.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"chai": "^5.2.0",
|
|
42
|
-
"mocha": "^11.
|
|
42
|
+
"mocha": "^11.7.0"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/reference.png
ADDED
|
Binary file
|
package/src/index.js
CHANGED
package/src/utils.js
CHANGED
|
@@ -116,8 +116,8 @@ async function setConfig({ configPath, args }) {
|
|
|
116
116
|
if (args.logLevel) {
|
|
117
117
|
config.logLevel = args.logLevel;
|
|
118
118
|
}
|
|
119
|
-
if (args.allowUnsafe) {
|
|
120
|
-
config.allowUnsafeTests =
|
|
119
|
+
if (typeof args.allowUnsafe === "boolean") {
|
|
120
|
+
config.allowUnsafeTests = args.allowUnsafe;
|
|
121
121
|
}
|
|
122
122
|
// Resolve paths
|
|
123
123
|
config = await resolvePaths({
|
|
@@ -230,6 +230,10 @@ const reporters = {
|
|
|
230
230
|
(contexts && contexts.fail > 0) ||
|
|
231
231
|
(steps && steps.fail > 0);
|
|
232
232
|
|
|
233
|
+
// Any skipped overall?
|
|
234
|
+
const allSpecsSkipped =
|
|
235
|
+
specs && specs.pass === 0 && specs.fail === 0 && specs.skipped > 0;
|
|
236
|
+
|
|
233
237
|
console.log(
|
|
234
238
|
`\n${colors.bold}===== Doc Detective Results Summary =====${colors.reset}`
|
|
235
239
|
);
|
|
@@ -238,7 +242,11 @@ const reporters = {
|
|
|
238
242
|
if (specs) {
|
|
239
243
|
console.log(`\n${colors.bold}Specs:${colors.reset}`);
|
|
240
244
|
console.log(`Total: ${totalSpecs}`);
|
|
241
|
-
|
|
245
|
+
if (specs.pass > 0) {
|
|
246
|
+
console.log(`${colors.green}Passed: ${specs.pass}${colors.reset}`);
|
|
247
|
+
} else {
|
|
248
|
+
console.log(`Passed: ${specs.pass}`);
|
|
249
|
+
}
|
|
242
250
|
console.log(
|
|
243
251
|
`${specs.fail > 0 ? colors.red : colors.green}Failed: ${specs.fail}${
|
|
244
252
|
colors.reset
|
|
@@ -248,14 +256,19 @@ const reporters = {
|
|
|
248
256
|
console.log(
|
|
249
257
|
`${colors.yellow}Warnings: ${specs.warning}${colors.reset}`
|
|
250
258
|
);
|
|
251
|
-
if (specs.skipped > 0)
|
|
259
|
+
if (specs.skipped > 0)
|
|
260
|
+
console.log(`${colors.yellow}Skipped: ${specs.skipped}${colors.reset}`);
|
|
252
261
|
}
|
|
253
262
|
|
|
254
263
|
// Print tests summary if available
|
|
255
264
|
if (tests) {
|
|
256
265
|
console.log(`\n${colors.bold}Tests:${colors.reset}`);
|
|
257
266
|
console.log(`Total: ${totalTests}`);
|
|
258
|
-
|
|
267
|
+
if (tests.pass > 0) {
|
|
268
|
+
console.log(`${colors.green}Passed: ${tests.pass}${colors.reset}`);
|
|
269
|
+
} else {
|
|
270
|
+
console.log(`Passed: ${tests.pass}`);
|
|
271
|
+
}
|
|
259
272
|
console.log(
|
|
260
273
|
`${tests.fail > 0 ? colors.red : colors.green}Failed: ${tests.fail}${
|
|
261
274
|
colors.reset
|
|
@@ -265,14 +278,19 @@ const reporters = {
|
|
|
265
278
|
console.log(
|
|
266
279
|
`${colors.yellow}Warnings: ${tests.warning}${colors.reset}`
|
|
267
280
|
);
|
|
268
|
-
if (tests.skipped > 0)
|
|
281
|
+
if (tests.skipped > 0)
|
|
282
|
+
console.log(`${colors.yellow}Skipped: ${tests.skipped}${colors.reset}`);
|
|
269
283
|
}
|
|
270
284
|
|
|
271
285
|
// Print contexts summary if available
|
|
272
286
|
if (contexts) {
|
|
273
287
|
console.log(`\n${colors.bold}Contexts:${colors.reset}`);
|
|
274
288
|
console.log(`Total: ${totalContexts}`);
|
|
275
|
-
|
|
289
|
+
if (contexts.pass > 0) {
|
|
290
|
+
console.log(`${colors.green}Passed: ${contexts.pass}${colors.reset}`);
|
|
291
|
+
} else {
|
|
292
|
+
console.log(`Passed: ${contexts.pass}`);
|
|
293
|
+
}
|
|
276
294
|
console.log(
|
|
277
295
|
`${contexts.fail > 0 ? colors.red : colors.green}Failed: ${
|
|
278
296
|
contexts.fail
|
|
@@ -282,14 +300,19 @@ const reporters = {
|
|
|
282
300
|
console.log(
|
|
283
301
|
`${colors.yellow}Warnings: ${contexts.warning}${colors.reset}`
|
|
284
302
|
);
|
|
285
|
-
if (contexts.skipped > 0)
|
|
303
|
+
if (contexts.skipped > 0)
|
|
304
|
+
console.log(`${colors.yellow}Skipped: ${contexts.skipped}${colors.reset}`);
|
|
286
305
|
}
|
|
287
306
|
|
|
288
307
|
// Print steps summary if available
|
|
289
308
|
if (steps) {
|
|
290
309
|
console.log(`\n${colors.bold}Steps:${colors.reset}`);
|
|
291
310
|
console.log(`Total: ${totalSteps}`);
|
|
292
|
-
|
|
311
|
+
if (steps.pass > 0) {
|
|
312
|
+
console.log(`${colors.green}Passed: ${steps.pass}${colors.reset}`);
|
|
313
|
+
} else {
|
|
314
|
+
console.log(`Passed: ${steps.pass}`);
|
|
315
|
+
}
|
|
293
316
|
console.log(
|
|
294
317
|
`${steps.fail > 0 ? colors.red : colors.green}Failed: ${steps.fail}${
|
|
295
318
|
colors.reset
|
|
@@ -299,7 +322,13 @@ const reporters = {
|
|
|
299
322
|
console.log(
|
|
300
323
|
`${colors.yellow}Warnings: ${steps.warning}${colors.reset}`
|
|
301
324
|
);
|
|
302
|
-
if (steps.skipped > 0)
|
|
325
|
+
if (steps.skipped > 0)
|
|
326
|
+
console.log(`${colors.yellow}Skipped: ${steps.skipped}${colors.reset}`);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// If all specs were skipped, call it out
|
|
330
|
+
if (allSpecsSkipped) {
|
|
331
|
+
console.log(`\n${colors.yellow}⚠️ All items were skipped. No specs passed or failed. ⚠️${colors.reset}`);
|
|
303
332
|
}
|
|
304
333
|
|
|
305
334
|
// If we have specs with failures, display them
|
|
@@ -314,7 +343,13 @@ const reporters = {
|
|
|
314
343
|
const failedContexts = [];
|
|
315
344
|
const failedSteps = [];
|
|
316
345
|
|
|
317
|
-
//
|
|
346
|
+
// Collect skipped
|
|
347
|
+
const skippedSpecs = [];
|
|
348
|
+
const skippedTests = [];
|
|
349
|
+
const skippedContexts = [];
|
|
350
|
+
const skippedSteps = [];
|
|
351
|
+
|
|
352
|
+
// Process specs array to collect failures and skipped
|
|
318
353
|
results.specs.forEach((spec, specIndex) => {
|
|
319
354
|
// Check if spec has failed
|
|
320
355
|
if (spec.result === "FAIL") {
|
|
@@ -323,6 +358,13 @@ const reporters = {
|
|
|
323
358
|
id: spec.specId || `Spec ${specIndex + 1}`,
|
|
324
359
|
});
|
|
325
360
|
}
|
|
361
|
+
// Check if spec was skipped
|
|
362
|
+
if (spec.result === "SKIPPED") {
|
|
363
|
+
skippedSpecs.push({
|
|
364
|
+
index: specIndex,
|
|
365
|
+
id: spec.specId || `Spec ${specIndex + 1}`,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
326
368
|
|
|
327
369
|
// Process tests in this spec
|
|
328
370
|
if (spec.tests && spec.tests.length > 0) {
|
|
@@ -336,6 +378,15 @@ const reporters = {
|
|
|
336
378
|
id: test.testId || `Test ${testIndex + 1}`,
|
|
337
379
|
});
|
|
338
380
|
}
|
|
381
|
+
// Check if test was skipped
|
|
382
|
+
if (test.result === "SKIPPED") {
|
|
383
|
+
skippedTests.push({
|
|
384
|
+
specIndex,
|
|
385
|
+
testIndex,
|
|
386
|
+
specId: spec.specId || `Spec ${specIndex + 1}`,
|
|
387
|
+
id: test.testId || `Test ${testIndex + 1}`,
|
|
388
|
+
});
|
|
389
|
+
}
|
|
339
390
|
|
|
340
391
|
// Process contexts in this test
|
|
341
392
|
if (test.contexts && test.contexts.length > 0) {
|
|
@@ -357,6 +408,23 @@ const reporters = {
|
|
|
357
408
|
: "unknown",
|
|
358
409
|
});
|
|
359
410
|
}
|
|
411
|
+
// Check if context was skipped
|
|
412
|
+
if (
|
|
413
|
+
context.result === "SKIPPED" ||
|
|
414
|
+
(context.result && context.result.status === "SKIPPED")
|
|
415
|
+
) {
|
|
416
|
+
skippedContexts.push({
|
|
417
|
+
specIndex,
|
|
418
|
+
testIndex,
|
|
419
|
+
contextIndex,
|
|
420
|
+
specId: spec.specId || `Spec ${specIndex + 1}`,
|
|
421
|
+
testId: test.testId || `Test ${testIndex + 1}`,
|
|
422
|
+
platform: context.platform || "unknown",
|
|
423
|
+
browser: context.browser
|
|
424
|
+
? context.browser.name
|
|
425
|
+
: "unknown",
|
|
426
|
+
});
|
|
427
|
+
}
|
|
360
428
|
|
|
361
429
|
// Process steps in this context
|
|
362
430
|
if (context.steps && context.steps.length > 0) {
|
|
@@ -378,6 +446,22 @@ const reporters = {
|
|
|
378
446
|
error: step.resultDescription || "Unknown error",
|
|
379
447
|
});
|
|
380
448
|
}
|
|
449
|
+
// Check if step was skipped
|
|
450
|
+
if (step.result === "SKIPPED") {
|
|
451
|
+
skippedSteps.push({
|
|
452
|
+
specIndex,
|
|
453
|
+
testIndex,
|
|
454
|
+
contextIndex,
|
|
455
|
+
stepIndex,
|
|
456
|
+
specId: spec.specId || `Spec ${specIndex + 1}`,
|
|
457
|
+
testId: test.testId || `Test ${testIndex + 1}`,
|
|
458
|
+
platform: context.platform || "unknown",
|
|
459
|
+
browser: context.browser
|
|
460
|
+
? context.browser.name
|
|
461
|
+
: "unknown",
|
|
462
|
+
stepId: step.stepId || `Step ${stepIndex + 1}`,
|
|
463
|
+
});
|
|
464
|
+
}
|
|
381
465
|
});
|
|
382
466
|
}
|
|
383
467
|
});
|
|
@@ -427,7 +511,33 @@ const reporters = {
|
|
|
427
511
|
console.log(` Error: ${item.error}`);
|
|
428
512
|
});
|
|
429
513
|
}
|
|
430
|
-
|
|
514
|
+
|
|
515
|
+
// Display skipped items in yellow
|
|
516
|
+
if (skippedSpecs.length > 0) {
|
|
517
|
+
console.log(`\n${colors.yellow}Skipped Specs:${colors.reset}`);
|
|
518
|
+
skippedSpecs.forEach((item, i) => {
|
|
519
|
+
console.log(`${colors.yellow}${i + 1}. ${item.id}${colors.reset}`);
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
if (skippedTests.length > 0) {
|
|
523
|
+
console.log(`\n${colors.yellow}Skipped Tests:${colors.reset}`);
|
|
524
|
+
skippedTests.forEach((item, i) => {
|
|
525
|
+
console.log(`${colors.yellow}${i + 1}. ${item.id} (from ${item.specId})${colors.reset}`);
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
if (skippedContexts.length > 0) {
|
|
529
|
+
console.log(`\n${colors.yellow}Skipped Contexts:${colors.reset}`);
|
|
530
|
+
skippedContexts.forEach((item, i) => {
|
|
531
|
+
console.log(`${colors.yellow}${i + 1}. ${item.platform}/${item.browser} (from ${item.testId})${colors.reset}`);
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
if (skippedSteps.length > 0) {
|
|
535
|
+
console.log(`\n${colors.yellow}Skipped Steps:${colors.reset}`);
|
|
536
|
+
skippedSteps.forEach((item, i) => {
|
|
537
|
+
console.log(`${colors.yellow}${i + 1}. ${item.platform}/${item.browser} - ${item.stepId}${colors.reset}`);
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
} else if (!hasFailures && !allSpecsSkipped) {
|
|
431
541
|
// Celebration when all tests pass
|
|
432
542
|
console.log(`\n${colors.green}🎉 All items passed! 🎉${colors.reset}`);
|
|
433
543
|
}
|