@diplodoc/cli-tests 5.25.0 → 5.25.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.
Files changed (39) hide show
  1. package/e2e/__snapshots__/assets.spec.ts.snap +0 -0
  2. package/e2e/__snapshots__/bundles.spec.ts.snap +1 -1
  3. package/e2e/__snapshots__/markdown-options.spec.ts.snap +209 -0
  4. package/e2e/__snapshots__/neuro-expert.test.ts.snap +1 -1
  5. package/e2e/__snapshots__/search.test.ts.snap +1 -1
  6. package/e2e/__snapshots__/skip-html-extension.spec.ts.snap +2 -2
  7. package/e2e/__snapshots__/toc-label.test.ts.snap +127 -0
  8. package/e2e/__snapshots__/vars-conditions.spec.ts.snap +1 -1
  9. package/e2e/load-custom-resources.spec.ts +4 -16
  10. package/e2e/markdown-options.spec.ts +17 -0
  11. package/e2e/metadata.spec.ts +7 -14
  12. package/e2e/rtl.spec.ts +4 -15
  13. package/e2e/skip-html-extension.spec.ts +4 -15
  14. package/e2e/toc-label.test.ts +23 -0
  15. package/fixtures/cliAdapter.ts +1 -1
  16. package/fixtures/utils/file.ts +18 -1
  17. package/mocks/assets/input/.yfm +1 -1
  18. package/mocks/bundles/input/.yfm +1 -1
  19. package/mocks/markdown-options/example-1/input/.yfm +5 -0
  20. package/mocks/markdown-options/example-1/input/breaks.md +5 -0
  21. package/mocks/markdown-options/example-1/input/linkify-tlds.md +7 -0
  22. package/mocks/markdown-options/example-1/input/linkify.md +3 -0
  23. package/mocks/markdown-options/example-1/input/toc.yaml +7 -0
  24. package/mocks/markdown-options/example-2/input/.yfm +3 -0
  25. package/mocks/markdown-options/example-2/input/breaks.md +5 -0
  26. package/mocks/markdown-options/example-2/input/linkify-tlds.md +7 -0
  27. package/mocks/markdown-options/example-2/input/linkify.md +3 -0
  28. package/mocks/markdown-options/example-2/input/toc.yaml +7 -0
  29. package/mocks/neuro-expert/input/.yfm +1 -1
  30. package/mocks/pdf-page/yfm-config/input/.yfm +1 -1
  31. package/mocks/search/input/.yfm +1 -1
  32. package/mocks/skip-html-extension/monolingual/input/.yfm +1 -1
  33. package/mocks/skip-html-extension/multilingual/input/.yfm +1 -1
  34. package/mocks/toc-label/input/.yfm +1 -0
  35. package/mocks/toc-label/input/index.md +3 -0
  36. package/mocks/toc-label/input/page1.md +3 -0
  37. package/mocks/toc-label/input/toc.yaml +10 -0
  38. package/mocks/vars-conditions/input/.yfm +1 -1
  39. package/package.json +1 -1
@@ -33,7 +33,7 @@ exports[`Check bundles > bundles list is correct > filelist 1`] = `
33
33
  `;
34
34
 
35
35
  exports[`Check bundles > bundles list is correct 1`] = `
36
- "allowHTML: true
36
+ "allowHtml: true
37
37
 
38
38
  meta:
39
39
  rootPath: http://127.0.0.1:5000/
@@ -0,0 +1,209 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`Markdown options from .yfm config > Markdown options from .yfm config 1 > filelist 1`] = `
4
+ "[
5
+ ".yfm",
6
+ "breaks.html",
7
+ "linkify-tlds.html",
8
+ "linkify.html",
9
+ "toc.js"
10
+ ]"
11
+ `;
12
+
13
+ exports[`Markdown options from .yfm config > Markdown options from .yfm config 1 1`] = `
14
+ "breaks: false
15
+ linkify: true
16
+ linkifyTlds:
17
+ - myext
18
+ - custom
19
+ "
20
+ `;
21
+
22
+ exports[`Markdown options from .yfm config > Markdown options from .yfm config 1 2`] = `
23
+ "<!DOCTYPE html>
24
+ <html lang="ru" dir="ltr">
25
+ <head>
26
+ <meta charset="utf-8">
27
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
28
+ <base href="./" />
29
+ <title>Breaks test</title>
30
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
31
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
32
+ </head>
33
+ <body class="g-root g-root_theme_light">
34
+ <div id="root"></div>
35
+ <script type="application/json" id="diplodoc-state">
36
+ {"data":{"leading":false,"html":"&lt;p&gt;First sentence/nSecond sentence/nThird sentence&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"breaks.md"},"headings":[],"title":"Breaks test"},"router":{"pathname":"breaks","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
37
+ </script>
38
+ <script type="application/javascript">
39
+ const data = document.querySelector('script#diplodoc-state');
40
+ window.__DATA__ = JSON.parse((function unescape(string) {
41
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
42
+ })(data.innerText));
43
+ window.STATIC_CONTENT = false;
44
+ </script>
45
+ <script type="application/javascript" defer src="toc.js"></script>
46
+ </body>
47
+ </html>"
48
+ `;
49
+
50
+ exports[`Markdown options from .yfm config > Markdown options from .yfm config 1 3`] = `
51
+ "<!DOCTYPE html>
52
+ <html lang="ru" dir="ltr">
53
+ <head>
54
+ <meta charset="utf-8">
55
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
56
+ <base href="./" />
57
+ <title>Linkify TLDs test</title>
58
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
59
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
60
+ </head>
61
+ <body class="g-root g-root_theme_light">
62
+ <div id="root"></div>
63
+ <script type="application/json" id="diplodoc-state">
64
+ {"data":{"leading":false,"html":"&lt;p&gt;Visit &lt;a href=\\"http://example.myext\\"&gt;example.myext&lt;/a&gt; for custom TLD.&lt;/p&gt;/n&lt;p&gt;Standard &lt;a href=\\"http://example.com\\"&gt;example.com&lt;/a&gt; link.&lt;/p&gt;/n&lt;p&gt;Unknown example.faketld should not be linked.&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"linkify-tlds.md"},"headings":[],"title":"Linkify TLDs test"},"router":{"pathname":"linkify-tlds","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
65
+ </script>
66
+ <script type="application/javascript">
67
+ const data = document.querySelector('script#diplodoc-state');
68
+ window.__DATA__ = JSON.parse((function unescape(string) {
69
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
70
+ })(data.innerText));
71
+ window.STATIC_CONTENT = false;
72
+ </script>
73
+ <script type="application/javascript" defer src="toc.js"></script>
74
+ </body>
75
+ </html>"
76
+ `;
77
+
78
+ exports[`Markdown options from .yfm config > Markdown options from .yfm config 1 4`] = `
79
+ "<!DOCTYPE html>
80
+ <html lang="ru" dir="ltr">
81
+ <head>
82
+ <meta charset="utf-8">
83
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
84
+ <base href="./" />
85
+ <title>Linkify test</title>
86
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
87
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
88
+ </head>
89
+ <body class="g-root g-root_theme_light">
90
+ <div id="root"></div>
91
+ <script type="application/json" id="diplodoc-state">
92
+ {"data":{"leading":false,"html":"&lt;p&gt;Visit &lt;a href=\\"https://example.com\\" target=\\"_blank\\" rel=\\"noreferrer noopener\\"&gt;https://example.com&lt;/a&gt; for more info.&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"linkify.md"},"headings":[],"title":"Linkify test"},"router":{"pathname":"linkify","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
93
+ </script>
94
+ <script type="application/javascript">
95
+ const data = document.querySelector('script#diplodoc-state');
96
+ window.__DATA__ = JSON.parse((function unescape(string) {
97
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
98
+ })(data.innerText));
99
+ window.STATIC_CONTENT = false;
100
+ </script>
101
+ <script type="application/javascript" defer src="toc.js"></script>
102
+ </body>
103
+ </html>"
104
+ `;
105
+
106
+ exports[`Markdown options from .yfm config > Markdown options from .yfm config 1 5`] = `"window.__DATA__.data.toc = {"items":[{"name":"Breaks","href":"breaks.html","id":"UUID"},{"name":"Linkify","href":"linkify.html","id":"UUID"},{"name":"Linkify TLDs","href":"linkify-tlds.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
107
+
108
+ exports[`Markdown options from .yfm config > Markdown options from .yfm config 2 > filelist 1`] = `
109
+ "[
110
+ ".yfm",
111
+ "breaks.html",
112
+ "linkify-tlds.html",
113
+ "linkify.html",
114
+ "toc.js"
115
+ ]"
116
+ `;
117
+
118
+ exports[`Markdown options from .yfm config > Markdown options from .yfm config 2 1`] = `
119
+ "breaks: true
120
+ linkify: false
121
+
122
+ "
123
+ `;
124
+
125
+ exports[`Markdown options from .yfm config > Markdown options from .yfm config 2 2`] = `
126
+ "<!DOCTYPE html>
127
+ <html lang="ru" dir="ltr">
128
+ <head>
129
+ <meta charset="utf-8">
130
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
131
+ <base href="./" />
132
+ <title>Breaks test</title>
133
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
134
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
135
+ </head>
136
+ <body class="g-root g-root_theme_light">
137
+ <div id="root"></div>
138
+ <script type="application/json" id="diplodoc-state">
139
+ {"data":{"leading":false,"html":"&lt;p&gt;First sentence&lt;br /&gt;/nSecond sentence&lt;br /&gt;/nThird sentence&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"breaks.md"},"headings":[],"title":"Breaks test"},"router":{"pathname":"breaks","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
140
+ </script>
141
+ <script type="application/javascript">
142
+ const data = document.querySelector('script#diplodoc-state');
143
+ window.__DATA__ = JSON.parse((function unescape(string) {
144
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
145
+ })(data.innerText));
146
+ window.STATIC_CONTENT = false;
147
+ </script>
148
+ <script type="application/javascript" defer src="toc.js"></script>
149
+ </body>
150
+ </html>"
151
+ `;
152
+
153
+ exports[`Markdown options from .yfm config > Markdown options from .yfm config 2 3`] = `
154
+ "<!DOCTYPE html>
155
+ <html lang="ru" dir="ltr">
156
+ <head>
157
+ <meta charset="utf-8">
158
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
159
+ <base href="./" />
160
+ <title>Linkify TLDs test</title>
161
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
162
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
163
+ </head>
164
+ <body class="g-root g-root_theme_light">
165
+ <div id="root"></div>
166
+ <script type="application/json" id="diplodoc-state">
167
+ {"data":{"leading":false,"html":"&lt;p&gt;Visit example.myext for custom TLD.&lt;/p&gt;/n&lt;p&gt;Standard example.com link.&lt;/p&gt;/n&lt;p&gt;Unknown example.faketld should not be linked.&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"linkify-tlds.md"},"headings":[],"title":"Linkify TLDs test"},"router":{"pathname":"linkify-tlds","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
168
+ </script>
169
+ <script type="application/javascript">
170
+ const data = document.querySelector('script#diplodoc-state');
171
+ window.__DATA__ = JSON.parse((function unescape(string) {
172
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
173
+ })(data.innerText));
174
+ window.STATIC_CONTENT = false;
175
+ </script>
176
+ <script type="application/javascript" defer src="toc.js"></script>
177
+ </body>
178
+ </html>"
179
+ `;
180
+
181
+ exports[`Markdown options from .yfm config > Markdown options from .yfm config 2 4`] = `
182
+ "<!DOCTYPE html>
183
+ <html lang="ru" dir="ltr">
184
+ <head>
185
+ <meta charset="utf-8">
186
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
187
+ <base href="./" />
188
+ <title>Linkify test</title>
189
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
190
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
191
+ </head>
192
+ <body class="g-root g-root_theme_light">
193
+ <div id="root"></div>
194
+ <script type="application/json" id="diplodoc-state">
195
+ {"data":{"leading":false,"html":"&lt;p&gt;Visit https://example.com for more info.&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"linkify.md"},"headings":[],"title":"Linkify test"},"router":{"pathname":"linkify","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
196
+ </script>
197
+ <script type="application/javascript">
198
+ const data = document.querySelector('script#diplodoc-state');
199
+ window.__DATA__ = JSON.parse((function unescape(string) {
200
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
201
+ })(data.innerText));
202
+ window.STATIC_CONTENT = false;
203
+ </script>
204
+ <script type="application/javascript" defer src="toc.js"></script>
205
+ </body>
206
+ </html>"
207
+ `;
208
+
209
+ exports[`Markdown options from .yfm config > Markdown options from .yfm config 2 5`] = `"window.__DATA__.data.toc = {"items":[{"name":"Breaks","href":"breaks.html","id":"UUID"},{"name":"Linkify","href":"linkify.html","id":"UUID"},{"name":"Linkify TLDs","href":"linkify-tlds.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
@@ -20,7 +20,7 @@ exports[`Neuro-expert > Neuro-expert > filelist 1`] = `
20
20
  `;
21
21
 
22
22
  exports[`Neuro-expert > Neuro-expert 1`] = `
23
- "allowHTML: true
23
+ "allowHtml: true
24
24
  langs: ['en','ru']
25
25
 
26
26
  neuroExpert:
@@ -9,7 +9,7 @@ exports[`Local search > internal > filelist 1`] = `
9
9
  `;
10
10
 
11
11
  exports[`Local search > internal 1`] = `
12
- "allowHTML: true
12
+ "allowHtml: true
13
13
  langs: ['en','ru']
14
14
 
15
15
  interface:
@@ -13,7 +13,7 @@ exports[`Skip html extension > correctly trims .html and index.html on monolingu
13
13
  `;
14
14
 
15
15
  exports[`Skip html extension > correctly trims .html and index.html on monolingual docs 1`] = `
16
- "allowHTML: true
16
+ "allowHtml: true
17
17
  "
18
18
  `;
19
19
 
@@ -179,7 +179,7 @@ exports[`Skip html extension > correctly trims .html and index.html on multiling
179
179
  `;
180
180
 
181
181
  exports[`Skip html extension > correctly trims .html and index.html on multilingual docs 1`] = `
182
- "allowHTML: true
182
+ "allowHtml: true
183
183
  langs: ['en','ru']
184
184
  "
185
185
  `;
@@ -0,0 +1,127 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`Toc label > should pass TocLabel object through to toc output > filelist 1`] = `
4
+ "[
5
+ ".yfm",
6
+ "index.md",
7
+ "page1.md",
8
+ "toc.yaml"
9
+ ]"
10
+ `;
11
+
12
+ exports[`Toc label > should pass TocLabel object through to toc output > filelist 2`] = `
13
+ "[
14
+ ".yfm",
15
+ "index.html",
16
+ "page1.html",
17
+ "toc.js"
18
+ ]"
19
+ `;
20
+
21
+ exports[`Toc label > should pass TocLabel object through to toc output 1`] = `
22
+ "allowHtml: true
23
+ "
24
+ `;
25
+
26
+ exports[`Toc label > should pass TocLabel object through to toc output 2`] = `
27
+ "---
28
+ metadata:
29
+ - name: generator
30
+ content: Diplodoc Platform vDIPLODOC-VERSION
31
+ vcsPath: index.md
32
+ ---
33
+ # Toc Label Test
34
+
35
+ Content
36
+ "
37
+ `;
38
+
39
+ exports[`Toc label > should pass TocLabel object through to toc output 3`] = `
40
+ "---
41
+ metadata:
42
+ - name: generator
43
+ content: Diplodoc Platform vDIPLODOC-VERSION
44
+ vcsPath: page1.md
45
+ ---
46
+ # Page 1
47
+
48
+ Content
49
+ "
50
+ `;
51
+
52
+ exports[`Toc label > should pass TocLabel object through to toc output 4`] = `
53
+ "title: Toc Label Test
54
+ href: index.md
55
+ label:
56
+ title: Preview
57
+ description: This service is in preview
58
+ theme: info
59
+ items:
60
+ - name: Page 1
61
+ href: page1.md
62
+ path: toc.yaml
63
+ "
64
+ `;
65
+
66
+ exports[`Toc label > should pass TocLabel object through to toc output 5`] = `
67
+ "allowHtml: true
68
+ "
69
+ `;
70
+
71
+ exports[`Toc label > should pass TocLabel object through to toc output 6`] = `
72
+ "<!DOCTYPE html>
73
+ <html lang="ru" dir="ltr">
74
+ <head>
75
+ <meta charset="utf-8">
76
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
77
+ <base href="./" />
78
+ <title>Toc Label Test | Toc Label Test</title>
79
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
80
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
81
+ </head>
82
+ <body class="g-root g-root_theme_light">
83
+ <div id="root"></div>
84
+ <script type="application/json" id="diplodoc-state">
85
+ {"data":{"leading":false,"html":"&lt;p&gt;Content&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"index.md"},"headings":[],"title":"Toc Label Test"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
86
+ </script>
87
+ <script type="application/javascript">
88
+ const data = document.querySelector('script#diplodoc-state');
89
+ window.__DATA__ = JSON.parse((function unescape(string) {
90
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
91
+ })(data.innerText));
92
+ window.STATIC_CONTENT = false;
93
+ </script>
94
+ <script type="application/javascript" defer src="toc.js"></script>
95
+ </body>
96
+ </html>"
97
+ `;
98
+
99
+ exports[`Toc label > should pass TocLabel object through to toc output 7`] = `
100
+ "<!DOCTYPE html>
101
+ <html lang="ru" dir="ltr">
102
+ <head>
103
+ <meta charset="utf-8">
104
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
105
+ <base href="./" />
106
+ <title>Page 1 | Toc Label Test</title>
107
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
108
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
109
+ </head>
110
+ <body class="g-root g-root_theme_light">
111
+ <div id="root"></div>
112
+ <script type="application/json" id="diplodoc-state">
113
+ {"data":{"leading":false,"html":"&lt;p&gt;Content&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"page1.md"},"headings":[],"title":"Page 1"},"router":{"pathname":"page1","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
114
+ </script>
115
+ <script type="application/javascript">
116
+ const data = document.querySelector('script#diplodoc-state');
117
+ window.__DATA__ = JSON.parse((function unescape(string) {
118
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
119
+ })(data.innerText));
120
+ window.STATIC_CONTENT = false;
121
+ </script>
122
+ <script type="application/javascript" defer src="toc.js"></script>
123
+ </body>
124
+ </html>"
125
+ `;
126
+
127
+ exports[`Toc label > should pass TocLabel object through to toc output 8`] = `"window.__DATA__.data.toc = {"title":"Toc Label Test","href":"index.html","label":{"title":"Preview","description":"This service is in preview","theme":"info"},"items":[{"name":"Page 1","href":"page1.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
@@ -12,7 +12,7 @@ exports[`Vars and conditions > Vars and conditions > filelist 1`] = `
12
12
  `;
13
13
 
14
14
  exports[`Vars and conditions > Vars and conditions 1`] = `
15
- "allowHTML: true
15
+ "allowHtml: true
16
16
  "
17
17
  `;
18
18
 
@@ -1,30 +1,18 @@
1
- import {describe, test} from 'vitest';
1
+ import {describe} from 'vitest';
2
2
 
3
- import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
4
-
5
- const generateMapTestTemplate = (
6
- testTitle: string,
7
- testRootPath: string,
8
- {md2md = true, md2html = true, args = '--allow-custom-resources'},
9
- ) => {
10
- test(testTitle, async () => {
11
- const {inputPath, outputPath} = getTestPaths(testRootPath);
12
- await TestAdapter.testBuildPass(inputPath, outputPath, {md2md, md2html, args});
13
- await compareDirectories(outputPath);
14
- });
15
- };
3
+ import {generateMapTestTemplate} from '../fixtures';
16
4
 
17
5
  describe('Allow load custom resources', () => {
18
6
  generateMapTestTemplate(
19
7
  'md2md with custom resources',
20
8
  'mocks/load-custom-resources/md2md-with-resources',
21
- {md2html: false},
9
+ {md2html: false, args: '--allow-custom-resources'},
22
10
  );
23
11
 
24
12
  generateMapTestTemplate(
25
13
  'md2html with custom resources',
26
14
  'mocks/load-custom-resources/md2html-with-resources',
27
- {md2md: false},
15
+ {md2md: false, args: '--allow-custom-resources'},
28
16
  );
29
17
 
30
18
  generateMapTestTemplate(
@@ -0,0 +1,17 @@
1
+ import {describe} from 'vitest';
2
+
3
+ import {generateMapTestTemplate} from '../fixtures';
4
+
5
+ describe('Markdown options from .yfm config', () => {
6
+ generateMapTestTemplate(
7
+ 'Markdown options from .yfm config 1',
8
+ 'mocks/markdown-options/example-1',
9
+ {md2html: true, md2md: false, args: '-j2'},
10
+ );
11
+
12
+ generateMapTestTemplate(
13
+ 'Markdown options from .yfm config 2',
14
+ 'mocks/markdown-options/example-2',
15
+ {md2html: true, md2md: false, args: '-j2'},
16
+ );
17
+ });
@@ -2,15 +2,19 @@ import {readFileSync, readdirSync} from 'node:fs';
2
2
  import {join} from 'node:path';
3
3
  import {describe, expect, test} from 'vitest';
4
4
 
5
- import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
5
+ import {TestAdapter, generateMapTestTemplate, getTestPaths} from '../fixtures';
6
6
 
7
7
  function findFile(dir: string, predicate: (name: string) => boolean): string | null {
8
8
  try {
9
9
  for (const name of readdirSync(dir, {withFileTypes: true})) {
10
10
  const full = join(dir, name.name);
11
+
11
12
  if (name.isDirectory()) {
12
13
  const found = findFile(full, predicate);
13
- if (found) return found;
14
+
15
+ if (found) {
16
+ return found;
17
+ }
14
18
  } else if (predicate(name.name)) {
15
19
  return full;
16
20
  }
@@ -18,21 +22,10 @@ function findFile(dir: string, predicate: (name: string) => boolean): string | n
18
22
  } catch {
19
23
  return null;
20
24
  }
25
+
21
26
  return null;
22
27
  }
23
28
 
24
- const generateMapTestTemplate = (
25
- testTitle: string,
26
- testRootPath: string,
27
- {md2md = true, md2html = true},
28
- ) => {
29
- test(testTitle, async () => {
30
- const {inputPath, outputPath} = getTestPaths(testRootPath);
31
- await TestAdapter.testBuildPass(inputPath, outputPath, {md2md, md2html});
32
- await compareDirectories(outputPath);
33
- });
34
- };
35
-
36
29
  describe('Allow load custom resources', () => {
37
30
  generateMapTestTemplate('md2md with metadata', 'mocks/metadata/md2md-with-metadata', {
38
31
  md2html: false,
package/e2e/rtl.spec.ts CHANGED
@@ -1,28 +1,17 @@
1
- import {describe, test} from 'vitest';
1
+ import {describe} from 'vitest';
2
2
 
3
- import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
4
-
5
- const generateMapTestTemplate = (
6
- testTitle: string,
7
- testRootPath: string,
8
- {md2md = true, md2html = true, args = '--allow-custom-resources'},
9
- ) => {
10
- test(testTitle, async () => {
11
- const {inputPath, outputPath} = getTestPaths(testRootPath);
12
- await TestAdapter.testBuildPass(inputPath, outputPath, {md2md, md2html, args});
13
- await compareDirectories(outputPath);
14
- });
15
- };
3
+ import {generateMapTestTemplate} from '../fixtures';
16
4
 
17
5
  describe('Generate html document with correct lang and dir attributes. Load correct bundles.', () => {
18
6
  generateMapTestTemplate(
19
7
  'documentation with rtl and ltr langs',
20
8
  'mocks/rtl/multidirectional-languages',
21
- {md2html: true, md2md: false},
9
+ {md2html: true, md2md: false, args: '--allow-custom-resources'},
22
10
  );
23
11
 
24
12
  generateMapTestTemplate('documentation with only one rtl lang', 'mocks/rtl/rtl-language', {
25
13
  md2html: true,
26
14
  md2md: false,
15
+ args: '--allow-custom-resources',
27
16
  });
28
17
  });
@@ -1,28 +1,17 @@
1
- import {describe, test} from 'vitest';
1
+ import {describe} from 'vitest';
2
2
 
3
- import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
4
-
5
- const generateMapTestTemplate = (testTitle: string, testRootPath: string) => {
6
- test(testTitle, async () => {
7
- const {inputPath, outputPath} = getTestPaths(testRootPath);
8
-
9
- await TestAdapter.testBuildPass(inputPath, outputPath, {
10
- md2md: false,
11
- md2html: true,
12
- args: '-j2 --skip-html-extension',
13
- });
14
- await compareDirectories(outputPath);
15
- });
16
- };
3
+ import {generateMapTestTemplate} from '../fixtures';
17
4
 
18
5
  describe('Skip html extension', () => {
19
6
  generateMapTestTemplate(
20
7
  'correctly trims .html and index.html on multilingual docs',
21
8
  'mocks/skip-html-extension/multilingual',
9
+ {md2md: false, md2html: true, args: '-j2 --skip-html-extension'},
22
10
  );
23
11
 
24
12
  generateMapTestTemplate(
25
13
  'correctly trims .html and index.html on monolingual docs',
26
14
  'mocks/skip-html-extension/monolingual',
15
+ {md2md: false, md2html: true, args: '-j2 --skip-html-extension'},
27
16
  );
28
17
  });
@@ -0,0 +1,23 @@
1
+ import {describe, it} from 'vitest';
2
+
3
+ import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
4
+
5
+ describe('Toc label', () => {
6
+ it('should pass TocLabel object through to toc output', async () => {
7
+ const {inputPath, outputPath} = getTestPaths('mocks/toc-label');
8
+
9
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
10
+ md2md: true,
11
+ md2html: false,
12
+ args: '-j2',
13
+ });
14
+ await TestAdapter.testBuildPass(outputPath, outputPath + '-html', {
15
+ md2md: false,
16
+ md2html: true,
17
+ args: '-j2',
18
+ });
19
+
20
+ await compareDirectories(outputPath);
21
+ await compareDirectories(outputPath + '-html');
22
+ });
23
+ });
@@ -26,7 +26,7 @@ class Build {
26
26
 
27
27
  run(input: string, output: string, args: string[], env?: Record<string, string>) {
28
28
  return this.runner.runYfmDocs(
29
- ['--input', input, '--output', output, '--quiet', '--allowHTML', ...args],
29
+ ['--input', input, '--output', output, '--quiet', '--allowHtml', ...args],
30
30
  env,
31
31
  );
32
32
  }
@@ -1,8 +1,12 @@
1
+ import type {BuildRunArgs} from '../cliAdapter';
2
+
1
3
  import {readFileSync} from 'node:fs';
2
4
  import {rm} from 'node:fs/promises';
3
5
  import {join, resolve} from 'node:path';
4
6
  import {glob} from 'glob';
5
- import {expect} from 'vitest';
7
+ import {expect, test} from 'vitest';
8
+
9
+ import {TestAdapter} from '../cliAdapter';
6
10
 
7
11
  import {bundleless, hashless, platformless} from './test';
8
12
 
@@ -119,3 +123,16 @@ export function getTestPaths(testRootPath: string): TestPaths {
119
123
  export function cleanupDirectory(path: string) {
120
124
  return rm(path, {recursive: true, force: true});
121
125
  }
126
+
127
+ export function generateMapTestTemplate(
128
+ testTitle: string,
129
+ testRootPath: string,
130
+ options: BuildRunArgs = {},
131
+ ) {
132
+ test(testTitle, async () => {
133
+ const {inputPath, outputPath} = getTestPaths(testRootPath);
134
+
135
+ await TestAdapter.testBuildPass(inputPath, outputPath, options);
136
+ await compareDirectories(outputPath);
137
+ });
138
+ }
@@ -1 +1 @@
1
- allowHTML: true
1
+ allowHtml: true
@@ -1,4 +1,4 @@
1
- allowHTML: true
1
+ allowHtml: true
2
2
 
3
3
  meta:
4
4
  rootPath: http://127.0.0.1:5000/
@@ -0,0 +1,5 @@
1
+ breaks: false
2
+ linkify: true
3
+ linkifyTlds:
4
+ - myext
5
+ - custom
@@ -0,0 +1,5 @@
1
+ # Breaks test
2
+
3
+ First sentence
4
+ Second sentence
5
+ Third sentence
@@ -0,0 +1,7 @@
1
+ # Linkify TLDs test
2
+
3
+ Visit example.myext for custom TLD.
4
+
5
+ Standard example.com link.
6
+
7
+ Unknown example.faketld should not be linked.
@@ -0,0 +1,3 @@
1
+ # Linkify test
2
+
3
+ Visit https://example.com for more info.
@@ -0,0 +1,7 @@
1
+ items:
2
+ - name: Breaks
3
+ href: ./breaks.md
4
+ - name: Linkify
5
+ href: ./linkify.md
6
+ - name: Linkify TLDs
7
+ href: ./linkify-tlds.md
@@ -0,0 +1,3 @@
1
+ breaks: true
2
+ linkify: false
3
+
@@ -0,0 +1,5 @@
1
+ # Breaks test
2
+
3
+ First sentence
4
+ Second sentence
5
+ Third sentence
@@ -0,0 +1,7 @@
1
+ # Linkify TLDs test
2
+
3
+ Visit example.myext for custom TLD.
4
+
5
+ Standard example.com link.
6
+
7
+ Unknown example.faketld should not be linked.
@@ -0,0 +1,3 @@
1
+ # Linkify test
2
+
3
+ Visit https://example.com for more info.
@@ -0,0 +1,7 @@
1
+ items:
2
+ - name: Breaks
3
+ href: ./breaks.md
4
+ - name: Linkify
5
+ href: ./linkify.md
6
+ - name: Linkify TLDs
7
+ href: ./linkify-tlds.md
@@ -1,4 +1,4 @@
1
- allowHTML: true
1
+ allowHtml: true
2
2
  langs: ['en','ru']
3
3
 
4
4
  neuroExpert:
@@ -1,4 +1,4 @@
1
- allowHTML: true
1
+ allowHtml: true
2
2
 
3
3
  pdf:
4
4
  enabled: true
@@ -1,4 +1,4 @@
1
- allowHTML: true
1
+ allowHtml: true
2
2
  langs: ['en','ru']
3
3
 
4
4
  interface:
@@ -1 +1 @@
1
- allowHTML: true
1
+ allowHtml: true
@@ -1,2 +1,2 @@
1
- allowHTML: true
1
+ allowHtml: true
2
2
  langs: ['en','ru']
@@ -0,0 +1 @@
1
+ allowHtml: true
@@ -0,0 +1,3 @@
1
+ # Toc Label Test
2
+
3
+ Content
@@ -0,0 +1,3 @@
1
+ # Page 1
2
+
3
+ Content
@@ -0,0 +1,10 @@
1
+ title: Toc Label Test
2
+ href: index.md
3
+ label:
4
+ title: Preview
5
+ description: This service is in preview
6
+ theme: info
7
+
8
+ items:
9
+ - name: Page 1
10
+ href: page1.md
@@ -1 +1 @@
1
- allowHTML: true
1
+ allowHtml: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.25.0",
3
+ "version": "5.25.2",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },