99}
1010
1111const assert = require ( 'assert' ) ;
12- const { readFile } = require ( 'fs' ) ;
12+ const { readFileSync } = require ( 'fs' ) ;
1313const fixtures = require ( '../common/fixtures' ) ;
1414const { replaceLinks } = require ( '../../tools/doc/markdown.js' ) ;
1515const html = require ( '../../tools/doc/html.js' ) ;
@@ -58,11 +58,6 @@ function toHTML({ input, filename, nodeVersion, versions }) {
5858// This HTML will be stripped of all whitespace because we don't currently
5959// have an HTML parser.
6060const testData = [
61- {
62- file : fixtures . path ( 'sample_document.md' ) ,
63- html : '<ol><li>fish</li><li>fish</li></ol>' +
64- '<ul><li>Redfish</li><li>Bluefish</li></ul>'
65- } ,
6661 {
6762 file : fixtures . path ( 'order_of_end_tags_5873.md' ) ,
6863 html : '<h3>ClassMethod: Buffer.from(array) <span> ' +
@@ -126,6 +121,10 @@ const testData = [
126121 'href="#foo_see_also" id="foo_see_also">#</a></span></h2><p>Check' +
127122 'out also<a href="https://nodejs.org/">this guide</a></p>'
128123 } ,
124+ {
125+ file : fixtures . path ( 'document_with_special_heading.md' ) ,
126+ html : '<title>Sample markdown with special heading |' ,
127+ }
129128] ;
130129
131130const spaces = / \s / g;
@@ -144,17 +143,16 @@ testData.forEach(({ file, html }) => {
144143 // Normalize expected data by stripping whitespace.
145144 const expected = html . replace ( spaces , '' ) ;
146145
147- readFile ( file , 'utf8' , common . mustCall ( async ( err , input ) => {
148- assert . ifError ( err ) ;
149- const output = toHTML ( { input : input ,
150- filename : 'foo' ,
151- nodeVersion : process . version ,
152- versions : versions } ) ;
146+ const input = readFileSync ( file , 'utf8' ) ;
147+
148+ const output = toHTML ( { input,
149+ filename : 'foo' ,
150+ nodeVersion : process . version ,
151+ versions } ) ;
153152
154- const actual = output . replace ( spaces , '' ) ;
155- // Assert that the input stripped of all whitespace contains the
156- // expected markup.
157- assert ( actual . includes ( expected ) ,
158- `ACTUAL: ${ actual } \nEXPECTED: ${ expected } ` ) ;
159- } ) ) ;
153+ const actual = output . replace ( spaces , '' ) ;
154+ // Assert that the input stripped of all whitespace contains the
155+ // expected markup.
156+ assert ( actual . includes ( expected ) ,
157+ `ACTUAL: ${ actual } \nEXPECTED: ${ expected } ` ) ;
160158} ) ;
0 commit comments