1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| import assert from "node:assert/strict";
| import { test } from "node:test";
| import { checkDiagnostics } from "../support/prepare-site.mjs";
|
| test("clean diagnostics pass", () => checkDiagnostics("Total in 20 ms\n"));
| test("unexpected path warnings fail", () => {
| assert.throws(
| () => checkDiagnostics("WARN Duplicate target path /posts/\n"),
| /Unexpected Hugo/,
| );
| });
| test("unexpected deprecations fail", () => {
| assert.throws(
| () => checkDiagnostics("WARN Feature is deprecated\n"),
| /Unexpected Hugo/,
| );
| });
| test("expected diagnostics are required exactly once", () => {
| checkDiagnostics("WARN Intentional warning\n", ["Intentional warning"]);
| assert.throws(
| () => checkDiagnostics("", ["Intentional warning"]),
| /exactly one/,
| );
| assert.throws(
| () =>
| checkDiagnostics(
| "WARN Intentional warning\nWARN Intentional warning\n",
| ["Intentional warning"],
| ),
| /exactly one/,
| );
| });
| test("expected diagnostics cannot hide another warning", () => {
| assert.throws(
| () =>
| checkDiagnostics("WARN Intentional warning\nWARN Unexpected\n", [
| "Intentional warning",
| ]),
| /Unexpected Hugo/,
| );
| });
|
|