@diplodoc/cli-tests 5.25.0 → 5.25.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/__snapshots__/markdown-options.spec.ts.snap +209 -0
- package/e2e/load-custom-resources.spec.ts +4 -16
- package/e2e/markdown-options.spec.ts +17 -0
- package/e2e/metadata.spec.ts +7 -14
- package/e2e/rtl.spec.ts +4 -15
- package/e2e/skip-html-extension.spec.ts +4 -15
- package/fixtures/utils/file.ts +18 -1
- package/mocks/markdown-options/example-1/input/.yfm +5 -0
- package/mocks/markdown-options/example-1/input/breaks.md +5 -0
- package/mocks/markdown-options/example-1/input/linkify-tlds.md +7 -0
- package/mocks/markdown-options/example-1/input/linkify.md +3 -0
- package/mocks/markdown-options/example-1/input/toc.yaml +7 -0
- package/mocks/markdown-options/example-2/input/.yfm +3 -0
- package/mocks/markdown-options/example-2/input/breaks.md +5 -0
- package/mocks/markdown-options/example-2/input/linkify-tlds.md +7 -0
- package/mocks/markdown-options/example-2/input/linkify.md +3 -0
- package/mocks/markdown-options/example-2/input/toc.yaml +7 -0
- package/package.json +1 -1
|
@@ -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":"<p>First sentence/nSecond sentence/nThird sentence</p>/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(/</g, "<").replace(/>/g, ">").replace(/&/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":"<p>Visit <a href=\\"http://example.myext\\">example.myext</a> for custom TLD.</p>/n<p>Standard <a href=\\"http://example.com\\">example.com</a> link.</p>/n<p>Unknown example.faketld should not be linked.</p>/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(/</g, "<").replace(/>/g, ">").replace(/&/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":"<p>Visit <a href=\\"https://example.com\\" target=\\"_blank\\" rel=\\"noreferrer noopener\\">https://example.com</a> for more info.</p>/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(/</g, "<").replace(/>/g, ">").replace(/&/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":"<p>First sentence<br />/nSecond sentence<br />/nThird sentence</p>/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(/</g, "<").replace(/>/g, ">").replace(/&/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":"<p>Visit example.myext for custom TLD.</p>/n<p>Standard example.com link.</p>/n<p>Unknown example.faketld should not be linked.</p>/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(/</g, "<").replace(/>/g, ">").replace(/&/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":"<p>Visit https://example.com for more info.</p>/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(/</g, "<").replace(/>/g, ">").replace(/&/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"};"`;
|
|
@@ -1,30 +1,18 @@
|
|
|
1
|
-
import {describe
|
|
1
|
+
import {describe} from 'vitest';
|
|
2
2
|
|
|
3
|
-
import {
|
|
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
|
+
});
|
package/e2e/metadata.spec.ts
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
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
|
|
1
|
+
import {describe} from 'vitest';
|
|
2
2
|
|
|
3
|
-
import {
|
|
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
|
|
1
|
+
import {describe} from 'vitest';
|
|
2
2
|
|
|
3
|
-
import {
|
|
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
|
});
|
package/fixtures/utils/file.ts
CHANGED
|
@@ -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
|
+
}
|