@@ -243,7 +243,7 @@ TotallyCustom uppercase
243243content with comments
244244BlockHere
245245 `
246-
246+
247247 /** @type {ProcessFileOptions } */
248248 const options = {
249249 content,
@@ -263,9 +263,53 @@ BlockHere
263263 const result = await processFile ( options )
264264
265265 console . log ( 'result' , result )
266-
266+
267267 assert . is ( result . stripComments , true )
268268 assert . is ( result . isNewPath , true )
269269} )
270270
271+ test ( 'removeComments should strip comment blocks from output file' , async ( ) => {
272+ const content = `# Test Document
273+
274+ <!-- block uppercase -->
275+ hello world
276+ <!-- /block -->
277+
278+ Some content in between.
279+
280+ <!-- block wordcount -->
281+ one two three four five
282+ <!-- /block -->
283+
284+ End of document.
285+ `
286+
287+ const removeCommentsOutput = path . join ( testDir , 'stripped.md' )
288+
289+ /** @type {ProcessFileOptions } */
290+ const options = {
291+ content,
292+ outputPath : removeCommentsOutput ,
293+ removeComments : true ,
294+ transforms : mockTransforms
295+ }
296+
297+ const result = await processFile ( options )
298+
299+ assert . is ( result . stripComments , true , 'stripComments should be true' )
300+ assert . is ( result . isNewPath , true , 'isNewPath should be true' )
301+ assert . is ( result . isChanged , true , 'isChanged should be true' )
302+
303+ // Read the output file and verify comments are stripped
304+ const outputContent = await fs . readFile ( removeCommentsOutput , 'utf8' )
305+
306+ // Should contain the transformed content
307+ assert . ok ( outputContent . includes ( 'HELLO WORLD' ) , 'should have transformed content' )
308+ assert . ok ( outputContent . includes ( 'Word count: 5' ) , 'should have wordcount transform' )
309+
310+ // Should NOT contain comment blocks
311+ assert . not . ok ( outputContent . includes ( '<!-- block' ) , 'should not have opening comment' )
312+ assert . not . ok ( outputContent . includes ( '<!-- /block' ) , 'should not have closing comment' )
313+ } )
314+
271315test . run ( )
0 commit comments