@diplodoc/cli-tests 5.22.0 → 5.22.1
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/e2e/empty-presets.spec.ts +32 -0
- package/mocks/empty-presets/input/.yfm +1 -0
- package/mocks/empty-presets/input/index.md +3 -0
- package/mocks/empty-presets/input/presets.yaml +3 -0
- package/mocks/empty-presets/input/subfolder/presets.yaml +3 -0
- package/mocks/empty-presets/input/subfolder/subpage.md +3 -0
- package/mocks/empty-presets/input/subfolder/toc.yaml +4 -0
- package/mocks/empty-presets/input/toc.yaml +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {describe, expect, test} from 'vitest';
|
|
2
|
+
import {existsSync, readFileSync} from 'node:fs';
|
|
3
|
+
import {resolve} from 'node:path';
|
|
4
|
+
|
|
5
|
+
import {TestAdapter, getTestPaths} from '../fixtures';
|
|
6
|
+
|
|
7
|
+
describe('Empty presets.yaml handling', () => {
|
|
8
|
+
test('should not create empty presets.yaml files in md output format when no variables are used', async () => {
|
|
9
|
+
const {inputPath, outputPath} = getTestPaths('mocks/empty-presets');
|
|
10
|
+
|
|
11
|
+
// Test with --output-format=md and disabled templating
|
|
12
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
13
|
+
md2md: true,
|
|
14
|
+
args: '-f md --no-template',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// Check that presets.yaml file was NOT created in the output
|
|
18
|
+
const presetsPath = resolve(outputPath, 'presets.yaml');
|
|
19
|
+
expect(existsSync(presetsPath)).toBe(false);
|
|
20
|
+
|
|
21
|
+
// Check that subfolder presets.yaml file was NOT created in the output
|
|
22
|
+
const subfolderPresetsPath = resolve(outputPath, 'subfolder/presets.yaml');
|
|
23
|
+
expect(existsSync(subfolderPresetsPath)).toBe(false);
|
|
24
|
+
|
|
25
|
+
// Verify that the markdown files were still processed correctly
|
|
26
|
+
const indexContent = readFileSync(resolve(outputPath, 'index.md'), 'utf8');
|
|
27
|
+
expect(indexContent).toContain('Test Page');
|
|
28
|
+
|
|
29
|
+
const subpageContent = readFileSync(resolve(outputPath, 'subfolder/subpage.md'), 'utf8');
|
|
30
|
+
expect(subpageContent).toContain('Sub Page');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
varsPreset: default
|