22 * @typedef {import('./test-types.js') } DoNotTouchThisIncludesCustomNodesInTree
33 */
44
5- import test from 'tape'
5+ import assert from 'node:assert/strict'
6+ import test from 'node:test'
67import { fromMarkdown } from 'mdast-util-from-markdown'
78import { toMarkdown } from 'mdast-util-to-markdown'
89import { removePosition } from 'unist-util-remove-position'
@@ -13,8 +14,8 @@ const custom = {type: 'custom', marker: {open: '<', close: '>'}}
1314const json = { type : 'json' , fence : { open : '{' , close : '}' } }
1415const yamlAnywhere = { type : 'yaml' , marker : '-' , anywhere : true }
1516
16- test ( 'markdown -> mdast ' , ( t ) => {
17- t . deepEqual (
17+ test ( 'frontmatterFromMarkdown ' , ( ) => {
18+ assert . deepEqual (
1819 removePosition (
1920 fromMarkdown ( '---' , {
2021 extensions : [ frontmatter ( ) ] ,
@@ -26,7 +27,7 @@ test('markdown -> mdast', (t) => {
2627 'should not support a single yaml fence (thematic break)'
2728 )
2829
29- t . deepEqual (
30+ assert . deepEqual (
3031 removePosition (
3132 fromMarkdown ( '---\n---' , {
3233 extensions : [ frontmatter ( ) ] ,
@@ -38,7 +39,7 @@ test('markdown -> mdast', (t) => {
3839 'should parse empty yaml'
3940 )
4041
41- t . deepEqual (
42+ assert . deepEqual (
4243 removePosition (
4344 fromMarkdown ( ' ---\n---' , {
4445 extensions : [ frontmatter ( ) ] ,
@@ -53,7 +54,7 @@ test('markdown -> mdast', (t) => {
5354 'should not support a prefix (indent) before a yaml opening fence'
5455 )
5556
56- t . deepEqual (
57+ assert . deepEqual (
5758 removePosition (
5859 fromMarkdown ( '---\n ---' , {
5960 extensions : [ frontmatter ( ) ] ,
@@ -68,7 +69,7 @@ test('markdown -> mdast', (t) => {
6869 'should not support a prefix (indent) before a yaml closing fence'
6970 )
7071
71- t . deepEqual (
72+ assert . deepEqual (
7273 removePosition (
7374 fromMarkdown ( '--- \n---\t ' , {
7475 extensions : [ frontmatter ( ) ] ,
@@ -80,7 +81,7 @@ test('markdown -> mdast', (t) => {
8081 'should parse an arbitrary suffix after the opening and closing fence of yaml'
8182 )
8283
83- t . deepEqual (
84+ assert . deepEqual (
8485 removePosition (
8586 fromMarkdown ( '--- --\n---' , {
8687 extensions : [ frontmatter ( ) ] ,
@@ -95,7 +96,7 @@ test('markdown -> mdast', (t) => {
9596 'should not support other characters after the suffix on the opening fence of yaml'
9697 )
9798
98- t . deepEqual (
99+ assert . deepEqual (
99100 removePosition (
100101 fromMarkdown ( '---\n--- x' , {
101102 extensions : [ frontmatter ( ) ] ,
@@ -113,7 +114,7 @@ test('markdown -> mdast', (t) => {
113114 'should not support other characters after the suffix on the closing fence of yaml'
114115 )
115116
116- t . deepEqual (
117+ assert . deepEqual (
117118 removePosition (
118119 fromMarkdown ( '----\n---' , {
119120 extensions : [ frontmatter ( ) ] ,
@@ -128,7 +129,7 @@ test('markdown -> mdast', (t) => {
128129 'should not support an opening yaml fence of more than 3 characters'
129130 )
130131
131- t . deepEqual (
132+ assert . deepEqual (
132133 removePosition (
133134 fromMarkdown ( '---\n----' , {
134135 extensions : [ frontmatter ( ) ] ,
@@ -143,7 +144,7 @@ test('markdown -> mdast', (t) => {
143144 'should not support a closing yaml fence of more than 3 characters'
144145 )
145146
146- t . deepEqual (
147+ assert . deepEqual (
147148 removePosition (
148149 fromMarkdown ( '--\n---' , {
149150 extensions : [ frontmatter ( ) ] ,
@@ -160,7 +161,7 @@ test('markdown -> mdast', (t) => {
160161 'should not support an opening yaml fence of less than 3 characters'
161162 )
162163
163- t . deepEqual (
164+ assert . deepEqual (
164165 removePosition (
165166 fromMarkdown ( '---\n--' , {
166167 extensions : [ frontmatter ( ) ] ,
@@ -178,7 +179,7 @@ test('markdown -> mdast', (t) => {
178179 'should not support a closing yaml fence of less than 3 characters'
179180 )
180181
181- t . deepEqual (
182+ assert . deepEqual (
182183 removePosition (
183184 fromMarkdown ( '---\na\nb\n---' , {
184185 extensions : [ frontmatter ( ) ] ,
@@ -190,7 +191,7 @@ test('markdown -> mdast', (t) => {
190191 'should support content in yaml'
191192 )
192193
193- t . deepEqual (
194+ assert . deepEqual (
194195 removePosition (
195196 fromMarkdown ( '---\na\n\nb\n---' , {
196197 extensions : [ frontmatter ( ) ] ,
@@ -202,7 +203,7 @@ test('markdown -> mdast', (t) => {
202203 'should support blank lines in yaml'
203204 )
204205
205- t . deepEqual (
206+ assert . deepEqual (
206207 removePosition (
207208 fromMarkdown ( '+++\na\n\nb\n+++' , {
208209 extensions : [ frontmatter ( 'toml' ) ] ,
@@ -214,7 +215,7 @@ test('markdown -> mdast', (t) => {
214215 'should support toml'
215216 )
216217
217- t . deepEqual (
218+ assert . deepEqual (
218219 removePosition (
219220 fromMarkdown ( '<<<\na\n\nb\n>>>' , {
220221 extensions : [ frontmatter ( custom ) ] ,
@@ -226,7 +227,7 @@ test('markdown -> mdast', (t) => {
226227 'should support a custom matter (1)'
227228 )
228229
229- t . deepEqual (
230+ assert . deepEqual (
230231 removePosition (
231232 fromMarkdown ( '{\na\n\nb\n}' , {
232233 extensions : [ frontmatter ( json ) ] ,
@@ -238,7 +239,7 @@ test('markdown -> mdast', (t) => {
238239 'should support a custom matter (2)'
239240 )
240241
241- t . deepEqual (
242+ assert . deepEqual (
242243 removePosition (
243244 fromMarkdown ( '# Hello\n---\na\n\nb\n---\n+++' , {
244245 extensions : [ frontmatter ( ) ] ,
@@ -259,7 +260,7 @@ test('markdown -> mdast', (t) => {
259260 'should not support yaml frontmatter in the middle'
260261 )
261262
262- t . deepEqual (
263+ assert . deepEqual (
263264 removePosition (
264265 fromMarkdown ( '# Hello\n---\na\n\nb\n---\n+++' , {
265266 extensions : [ frontmatter ( yamlAnywhere ) ] ,
@@ -277,12 +278,10 @@ test('markdown -> mdast', (t) => {
277278 } ,
278279 'should not support custom matters in the middle'
279280 )
280-
281- t . end ( )
282281} )
283282
284- test ( 'mdast -> markdown ' , ( t ) => {
285- t . deepEqual (
283+ test ( 'frontmatterToMarkdown ' , ( ) => {
284+ assert . deepEqual (
286285 toMarkdown (
287286 { type : 'root' , children : [ { type : 'yaml' , value : '' } ] } ,
288287 { extensions : [ frontmatterToMarkdown ( ) ] }
@@ -291,7 +290,7 @@ test('mdast -> markdown', (t) => {
291290 'should serialize empty yaml'
292291 )
293292
294- t . deepEqual (
293+ assert . deepEqual (
295294 toMarkdown (
296295 { type : 'root' , children : [ { type : 'yaml' , value : 'a\nb' } ] } ,
297296 { extensions : [ frontmatterToMarkdown ( ) ] }
@@ -300,7 +299,7 @@ test('mdast -> markdown', (t) => {
300299 'should support content in yaml'
301300 )
302301
303- t . deepEqual (
302+ assert . deepEqual (
304303 toMarkdown (
305304 { type : 'root' , children : [ { type : 'yaml' , value : 'a\n\nb' } ] } ,
306305 { extensions : [ frontmatterToMarkdown ( ) ] }
@@ -309,7 +308,7 @@ test('mdast -> markdown', (t) => {
309308 'should support blank lines in yaml'
310309 )
311310
312- t . deepEqual (
311+ assert . deepEqual (
313312 toMarkdown (
314313 { type : 'root' , children : [ { type : 'toml' , value : 'a\n\nb' } ] } ,
315314 { extensions : [ frontmatterToMarkdown ( 'toml' ) ] }
@@ -318,7 +317,7 @@ test('mdast -> markdown', (t) => {
318317 'should support blank lines in yaml'
319318 )
320319
321- t . deepEqual (
320+ assert . deepEqual (
322321 toMarkdown (
323322 { type : 'root' , children : [ { type : 'custom' , value : 'a\n\nb' } ] } ,
324323 { extensions : [ frontmatterToMarkdown ( custom ) ] }
@@ -327,7 +326,7 @@ test('mdast -> markdown', (t) => {
327326 'should support a custom matter (1)'
328327 )
329328
330- t . deepEqual (
329+ assert . deepEqual (
331330 toMarkdown (
332331 { type : 'root' , children : [ { type : 'json' , value : 'a\n\nb' } ] } ,
333332 { extensions : [ frontmatterToMarkdown ( json ) ] }
@@ -336,14 +335,12 @@ test('mdast -> markdown', (t) => {
336335 'should support a custom matter (2)'
337336 )
338337
339- t . deepEqual (
338+ assert . deepEqual (
340339 toMarkdown (
341340 { type : 'root' , children : [ { type : 'text' , value : '<<<\na\n\nb\n>>>' } ] } ,
342341 { extensions : [ frontmatterToMarkdown ( custom ) ] }
343342 ) ,
344343 '\\<<<\na\n\nb\n\\>>>\n' ,
345344 'should escape what would otherwise be custom matter'
346345 )
347-
348- t . end ( )
349346} )
0 commit comments