@mintlify/cli 4.0.1744 → 4.0.1746
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.
|
@@ -298,6 +298,53 @@ describe('mint validate', () => {
|
|
|
298
298
|
]);
|
|
299
299
|
});
|
|
300
300
|
|
|
301
|
+
it('prefers structured warning fields over the message text', async () => {
|
|
302
|
+
writeSite(
|
|
303
|
+
{ 'index.mdx': HOME, 'guides/real.mdx': HOME },
|
|
304
|
+
{ navigation: { pages: ['index', 'guides/real', 'gone'] } }
|
|
305
|
+
);
|
|
306
|
+
vi.mocked(checkBuild).mockResolvedValue({
|
|
307
|
+
passed: false,
|
|
308
|
+
error: 'Build validation failed with 2 warning(s). See above for details.',
|
|
309
|
+
strict: true,
|
|
310
|
+
warnings: [
|
|
311
|
+
{
|
|
312
|
+
type: 'parse-error',
|
|
313
|
+
message: '\u001b[31m./wrong.mdx:9:9 Unexpected token\u001b[39m',
|
|
314
|
+
file: 'guides/real.mdx',
|
|
315
|
+
line: 3,
|
|
316
|
+
column: 7,
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
type: 'missing-nav-page',
|
|
320
|
+
message: '"gone" is referenced in the docs.json navigation but the file does not exist.',
|
|
321
|
+
file: 'docs.json',
|
|
322
|
+
ref: 'gone',
|
|
323
|
+
},
|
|
324
|
+
],
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
const result = await report('validate');
|
|
328
|
+
|
|
329
|
+
expect(result.diagnostics).toHaveLength(2);
|
|
330
|
+
expect(result.diagnostics).toEqual(
|
|
331
|
+
expect.arrayContaining([
|
|
332
|
+
expect.objectContaining({
|
|
333
|
+
rule: 'parse-error',
|
|
334
|
+
file: 'guides/real.mdx',
|
|
335
|
+
line: 3,
|
|
336
|
+
column: 7,
|
|
337
|
+
message: './wrong.mdx:9:9 Unexpected token',
|
|
338
|
+
}),
|
|
339
|
+
expect.objectContaining({
|
|
340
|
+
rule: 'missing-nav-page',
|
|
341
|
+
file: 'docs.json',
|
|
342
|
+
line: expect.any(Number),
|
|
343
|
+
}),
|
|
344
|
+
])
|
|
345
|
+
);
|
|
346
|
+
});
|
|
347
|
+
|
|
301
348
|
it('fails when the build fails on a parse error outside --files', async () => {
|
|
302
349
|
writeSite({ 'index.mdx': HOME, 'other.mdx': HOME });
|
|
303
350
|
vi.mocked(checkBuild).mockResolvedValue({
|