@diplodoc/cli-tests 5.24.3 → 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__/alternates.test.ts.snap +303 -0
- package/e2e/__snapshots__/markdown-options.spec.ts.snap +209 -0
- package/e2e/alternates.test.ts +14 -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/runners/binary.ts +2 -0
- 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
|
@@ -894,3 +894,306 @@ exports[`Alternates > skip-html-extension 13`] = `
|
|
|
894
894
|
`;
|
|
895
895
|
|
|
896
896
|
exports[`Alternates > skip-html-extension 14`] = `"window.__DATA__.data.toc = {"href":"ru/","items":[{"href":"ru/about","name":"About","id":"UUID"},{"href":"ru/deep/test","name":"Test","id":"UUID"}],"path":"ru/toc.yaml","id":"UUID"};"`;
|
|
897
|
+
|
|
898
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used > filelist 1`] = `
|
|
899
|
+
"[
|
|
900
|
+
".yfm",
|
|
901
|
+
"az/about.html",
|
|
902
|
+
"az/deep/test.html",
|
|
903
|
+
"az/index.html",
|
|
904
|
+
"az/toc.js",
|
|
905
|
+
"en/about.html",
|
|
906
|
+
"en/deep/test.html",
|
|
907
|
+
"en/index.html",
|
|
908
|
+
"en/toc.js",
|
|
909
|
+
"index.html",
|
|
910
|
+
"ru/about.html",
|
|
911
|
+
"ru/deep/test.html",
|
|
912
|
+
"ru/index.html",
|
|
913
|
+
"ru/toc.js"
|
|
914
|
+
]"
|
|
915
|
+
`;
|
|
916
|
+
|
|
917
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 1`] = `
|
|
918
|
+
"langs: ['ru', 'en', {'lang': 'az', 'tld': 'az'}]
|
|
919
|
+
"
|
|
920
|
+
`;
|
|
921
|
+
|
|
922
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 2`] = `
|
|
923
|
+
"<!DOCTYPE html>
|
|
924
|
+
<html lang="az" dir="ltr">
|
|
925
|
+
<head>
|
|
926
|
+
<meta charset="utf-8">
|
|
927
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
928
|
+
<base href="../" />
|
|
929
|
+
<title>About</title>
|
|
930
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
931
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
932
|
+
</head>
|
|
933
|
+
<body class="g-root g-root_theme_light">
|
|
934
|
+
<div id="root"></div>
|
|
935
|
+
<script type="application/json" id="diplodoc-state">
|
|
936
|
+
{"data":{"leading":false,"html":"<p>Content</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"az/about.md"},"headings":[],"title":"About"},"router":{"pathname":"az/about","depth":2,"base":"../"},"lang":"az","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
937
|
+
</script>
|
|
938
|
+
<script type="application/javascript">
|
|
939
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
940
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
941
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
942
|
+
})(data.innerText));
|
|
943
|
+
window.STATIC_CONTENT = false;
|
|
944
|
+
</script>
|
|
945
|
+
<script type="application/javascript" defer src="az/toc.js"></script>
|
|
946
|
+
</body>
|
|
947
|
+
</html>"
|
|
948
|
+
`;
|
|
949
|
+
|
|
950
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 3`] = `
|
|
951
|
+
"<!DOCTYPE html>
|
|
952
|
+
<html lang="az" dir="ltr">
|
|
953
|
+
<head>
|
|
954
|
+
<meta charset="utf-8">
|
|
955
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
956
|
+
<base href="../../" />
|
|
957
|
+
<title>Test</title>
|
|
958
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
959
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
960
|
+
</head>
|
|
961
|
+
<body class="g-root g-root_theme_light">
|
|
962
|
+
<div id="root"></div>
|
|
963
|
+
<script type="application/json" id="diplodoc-state">
|
|
964
|
+
{"data":{"leading":false,"html":"<p>Content</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"az/deep/test.md"},"headings":[],"title":"Test"},"router":{"pathname":"az/deep/test","depth":3,"base":"../../"},"lang":"az","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
965
|
+
</script>
|
|
966
|
+
<script type="application/javascript">
|
|
967
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
968
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
969
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
970
|
+
})(data.innerText));
|
|
971
|
+
window.STATIC_CONTENT = false;
|
|
972
|
+
</script>
|
|
973
|
+
<script type="application/javascript" defer src="az/toc.js"></script>
|
|
974
|
+
</body>
|
|
975
|
+
</html>"
|
|
976
|
+
`;
|
|
977
|
+
|
|
978
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 4`] = `
|
|
979
|
+
"<!DOCTYPE html>
|
|
980
|
+
<html lang="az" dir="ltr">
|
|
981
|
+
<head>
|
|
982
|
+
<meta charset="utf-8">
|
|
983
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
984
|
+
<base href="../" />
|
|
985
|
+
<title></title>
|
|
986
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
987
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
988
|
+
</head>
|
|
989
|
+
<body class="g-root g-root_theme_light">
|
|
990
|
+
<div id="root"></div>
|
|
991
|
+
<script type="application/json" id="diplodoc-state">
|
|
992
|
+
{"data":{"leading":true,"data":{"links":[{"url":"az/about/index.html","name":"About"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"az/index.yaml"},"title":""},"router":{"pathname":"az/index","depth":2,"base":"../"},"lang":"az","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
993
|
+
</script>
|
|
994
|
+
<script type="application/javascript">
|
|
995
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
996
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
997
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
998
|
+
})(data.innerText));
|
|
999
|
+
window.STATIC_CONTENT = false;
|
|
1000
|
+
</script>
|
|
1001
|
+
<script type="application/javascript" defer src="az/toc.js"></script>
|
|
1002
|
+
</body>
|
|
1003
|
+
</html>"
|
|
1004
|
+
`;
|
|
1005
|
+
|
|
1006
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 5`] = `"window.__DATA__.data.toc = {"href":"az/index.html","items":[{"href":"az/about.html","name":"About","id":"UUID"},{"href":"az/deep/test.html","name":"Test","id":"UUID"}],"path":"az/toc.yaml","id":"UUID"};"`;
|
|
1007
|
+
|
|
1008
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 6`] = `
|
|
1009
|
+
"<!DOCTYPE html>
|
|
1010
|
+
<html lang="en" dir="ltr">
|
|
1011
|
+
<head>
|
|
1012
|
+
<meta charset="utf-8">
|
|
1013
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1014
|
+
<base href="../" />
|
|
1015
|
+
<title>About</title>
|
|
1016
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
1017
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
1018
|
+
</head>
|
|
1019
|
+
<body class="g-root g-root_theme_light">
|
|
1020
|
+
<div id="root"></div>
|
|
1021
|
+
<script type="application/json" id="diplodoc-state">
|
|
1022
|
+
{"data":{"leading":false,"html":"<p>Content</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"en/about.md"},"headings":[],"title":"About"},"router":{"pathname":"en/about","depth":2,"base":"../"},"lang":"en","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
1023
|
+
</script>
|
|
1024
|
+
<script type="application/javascript">
|
|
1025
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
1026
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
1027
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
1028
|
+
})(data.innerText));
|
|
1029
|
+
window.STATIC_CONTENT = false;
|
|
1030
|
+
</script>
|
|
1031
|
+
<script type="application/javascript" defer src="en/toc.js"></script>
|
|
1032
|
+
</body>
|
|
1033
|
+
</html>"
|
|
1034
|
+
`;
|
|
1035
|
+
|
|
1036
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 7`] = `
|
|
1037
|
+
"<!DOCTYPE html>
|
|
1038
|
+
<html lang="en" dir="ltr">
|
|
1039
|
+
<head>
|
|
1040
|
+
<meta charset="utf-8">
|
|
1041
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1042
|
+
<base href="../../" />
|
|
1043
|
+
<title>Test</title>
|
|
1044
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
1045
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
1046
|
+
</head>
|
|
1047
|
+
<body class="g-root g-root_theme_light">
|
|
1048
|
+
<div id="root"></div>
|
|
1049
|
+
<script type="application/json" id="diplodoc-state">
|
|
1050
|
+
{"data":{"leading":false,"html":"<p>Content</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"en/deep/test.md"},"headings":[],"title":"Test"},"router":{"pathname":"en/deep/test","depth":3,"base":"../../"},"lang":"en","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
1051
|
+
</script>
|
|
1052
|
+
<script type="application/javascript">
|
|
1053
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
1054
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
1055
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
1056
|
+
})(data.innerText));
|
|
1057
|
+
window.STATIC_CONTENT = false;
|
|
1058
|
+
</script>
|
|
1059
|
+
<script type="application/javascript" defer src="en/toc.js"></script>
|
|
1060
|
+
</body>
|
|
1061
|
+
</html>"
|
|
1062
|
+
`;
|
|
1063
|
+
|
|
1064
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 8`] = `
|
|
1065
|
+
"<!DOCTYPE html>
|
|
1066
|
+
<html lang="en" dir="ltr">
|
|
1067
|
+
<head>
|
|
1068
|
+
<meta charset="utf-8">
|
|
1069
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1070
|
+
<base href="../" />
|
|
1071
|
+
<title></title>
|
|
1072
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
1073
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
1074
|
+
</head>
|
|
1075
|
+
<body class="g-root g-root_theme_light">
|
|
1076
|
+
<div id="root"></div>
|
|
1077
|
+
<script type="application/json" id="diplodoc-state">
|
|
1078
|
+
{"data":{"leading":true,"data":{"links":[{"url":"en/about/index.html","name":"About"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"en/index.yaml"},"title":""},"router":{"pathname":"en/index","depth":2,"base":"../"},"lang":"en","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
1079
|
+
</script>
|
|
1080
|
+
<script type="application/javascript">
|
|
1081
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
1082
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
1083
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
1084
|
+
})(data.innerText));
|
|
1085
|
+
window.STATIC_CONTENT = false;
|
|
1086
|
+
</script>
|
|
1087
|
+
<script type="application/javascript" defer src="en/toc.js"></script>
|
|
1088
|
+
</body>
|
|
1089
|
+
</html>"
|
|
1090
|
+
`;
|
|
1091
|
+
|
|
1092
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 9`] = `"window.__DATA__.data.toc = {"href":"en/index.html","items":[{"href":"en/about.html","name":"About","id":"UUID"},{"href":"en/deep/test.html","name":"Test","id":"UUID"}],"path":"en/toc.yaml","id":"UUID"};"`;
|
|
1093
|
+
|
|
1094
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 10`] = `
|
|
1095
|
+
"<!DOCTYPE html>
|
|
1096
|
+
<html lang="ru" dir="ltr">
|
|
1097
|
+
<head>
|
|
1098
|
+
<meta charset="utf-8">
|
|
1099
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1100
|
+
<base href="./" />
|
|
1101
|
+
<title>Redirect to ./ru/index.html</title>
|
|
1102
|
+
<meta http-equiv="refresh" content="0; url=./ru/index.html">
|
|
1103
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
1104
|
+
<script type="application/javascript">
|
|
1105
|
+
window.location.replace("./ru/index.html");
|
|
1106
|
+
</script>
|
|
1107
|
+
</head>
|
|
1108
|
+
<body class="g-root g-root_theme_light">
|
|
1109
|
+
If you are not redirected automatically, follow this <a href="./ru/index.html">link</a>.
|
|
1110
|
+
</body>
|
|
1111
|
+
</html>"
|
|
1112
|
+
`;
|
|
1113
|
+
|
|
1114
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 11`] = `
|
|
1115
|
+
"<!DOCTYPE html>
|
|
1116
|
+
<html lang="ru" dir="ltr">
|
|
1117
|
+
<head>
|
|
1118
|
+
<meta charset="utf-8">
|
|
1119
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1120
|
+
<base href="../" />
|
|
1121
|
+
<title>About</title>
|
|
1122
|
+
<link rel="alternate" href="https://my-other-site.com/about" />
|
|
1123
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
1124
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
1125
|
+
</head>
|
|
1126
|
+
<body class="g-root g-root_theme_light">
|
|
1127
|
+
<div id="root"></div>
|
|
1128
|
+
<script type="application/json" id="diplodoc-state">
|
|
1129
|
+
{"data":{"leading":false,"html":"<p>Content</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"alternate":[{"href":"https://my-other-site.com/about"}],"vcsPath":"ru/about.md"},"headings":[],"title":"About"},"router":{"pathname":"ru/about","depth":2,"base":"../"},"lang":"ru","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
1130
|
+
</script>
|
|
1131
|
+
<script type="application/javascript">
|
|
1132
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
1133
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
1134
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
1135
|
+
})(data.innerText));
|
|
1136
|
+
window.STATIC_CONTENT = false;
|
|
1137
|
+
</script>
|
|
1138
|
+
<script type="application/javascript" defer src="ru/toc.js"></script>
|
|
1139
|
+
</body>
|
|
1140
|
+
</html>"
|
|
1141
|
+
`;
|
|
1142
|
+
|
|
1143
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 12`] = `
|
|
1144
|
+
"<!DOCTYPE html>
|
|
1145
|
+
<html lang="ru" dir="ltr">
|
|
1146
|
+
<head>
|
|
1147
|
+
<meta charset="utf-8">
|
|
1148
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1149
|
+
<base href="../../" />
|
|
1150
|
+
<title>Test</title>
|
|
1151
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
1152
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
1153
|
+
</head>
|
|
1154
|
+
<body class="g-root g-root_theme_light">
|
|
1155
|
+
<div id="root"></div>
|
|
1156
|
+
<script type="application/json" id="diplodoc-state">
|
|
1157
|
+
{"data":{"leading":false,"html":"<p>Content</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"ru/deep/test.md"},"headings":[],"title":"Test"},"router":{"pathname":"ru/deep/test","depth":3,"base":"../../"},"lang":"ru","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
1158
|
+
</script>
|
|
1159
|
+
<script type="application/javascript">
|
|
1160
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
1161
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
1162
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
1163
|
+
})(data.innerText));
|
|
1164
|
+
window.STATIC_CONTENT = false;
|
|
1165
|
+
</script>
|
|
1166
|
+
<script type="application/javascript" defer src="ru/toc.js"></script>
|
|
1167
|
+
</body>
|
|
1168
|
+
</html>"
|
|
1169
|
+
`;
|
|
1170
|
+
|
|
1171
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 13`] = `
|
|
1172
|
+
"<!DOCTYPE html>
|
|
1173
|
+
<html lang="ru" dir="ltr">
|
|
1174
|
+
<head>
|
|
1175
|
+
<meta charset="utf-8">
|
|
1176
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1177
|
+
<base href="../" />
|
|
1178
|
+
<title></title>
|
|
1179
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
1180
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
1181
|
+
</head>
|
|
1182
|
+
<body class="g-root g-root_theme_light">
|
|
1183
|
+
<div id="root"></div>
|
|
1184
|
+
<script type="application/json" id="diplodoc-state">
|
|
1185
|
+
{"data":{"leading":true,"data":{"links":[{"url":"ru/about/index.html","name":"About"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"ru/index.yaml"},"title":""},"router":{"pathname":"ru/index","depth":2,"base":"../"},"lang":"ru","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
1186
|
+
</script>
|
|
1187
|
+
<script type="application/javascript">
|
|
1188
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
1189
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
1190
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
1191
|
+
})(data.innerText));
|
|
1192
|
+
window.STATIC_CONTENT = false;
|
|
1193
|
+
</script>
|
|
1194
|
+
<script type="application/javascript" defer src="ru/toc.js"></script>
|
|
1195
|
+
</body>
|
|
1196
|
+
</html>"
|
|
1197
|
+
`;
|
|
1198
|
+
|
|
1199
|
+
exports[`Alternates with --no-add-alternate-meta > should not add alternate meta tags when --no-add-alternate-meta is used 14`] = `"window.__DATA__.data.toc = {"href":"ru/index.html","items":[{"href":"ru/about.html","name":"About","id":"UUID"},{"href":"ru/deep/test.html","name":"Test","id":"UUID"}],"path":"ru/toc.yaml","id":"UUID"};"`;
|
|
@@ -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"};"`;
|
package/e2e/alternates.test.ts
CHANGED
|
@@ -33,3 +33,17 @@ describe('Alternates', () => {
|
|
|
33
33
|
await compareDirectories(outputPath + '-html');
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
|
+
|
|
37
|
+
describe('Alternates with --no-add-alternate-meta', () => {
|
|
38
|
+
it('should not add alternate meta tags when --no-add-alternate-meta is used', async () => {
|
|
39
|
+
const {inputPath, outputPath} = getTestPaths('mocks/alternates');
|
|
40
|
+
|
|
41
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
42
|
+
md2md: false,
|
|
43
|
+
md2html: true,
|
|
44
|
+
args: '-j2 --no-add-alternate-meta',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
await compareDirectories(outputPath);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -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
|
+
}
|