@@ -270,16 +270,16 @@ suite('Extension Tests', async () => {
270270 } ) ;
271271
272272 test ( 'FormatDocumentProvider' , async ( ) => {
273- const editorTabs = await vscode . window . showTextDocument ( vscode . Uri . joinPath ( fixturesUri , 'DocumentFormattingEditProvider-tabs.tmLanguage.json' ) , showTextDocumentOptions ) ;
274- const editorSpaces = await vscode . window . showTextDocument ( vscode . Uri . joinPath ( fixturesUri , 'DocumentFormattingEditProvider-3spaces.tmLanguage.json' ) , showTextDocumentOptions ) ;
273+ const editorTabs = await vscode . window . showTextDocument ( vscode . Uri . joinPath ( baselinesUri , 'DocumentFormattingEditProvider-tabs.tmLanguage.json' ) , showTextDocumentOptions ) ;
274+ const editorSpaces = await vscode . window . showTextDocument ( vscode . Uri . joinPath ( baselinesUri , 'DocumentFormattingEditProvider-3spaces.tmLanguage.json' ) , showTextDocumentOptions ) ;
275275 const editorUnformatted = await vscode . window . showTextDocument ( vscode . Uri . joinPath ( fixturesUri , 'JSON.tmLanguage.json' ) , showTextDocumentOptions ) ;
276276
277277 const documentFormatted = await vscode . workspace . openTextDocument ( { content : editorUnformatted . document . getText ( ) , language : 'json-textmate' , encoding : '\r\n' } ) ;
278- const editorFormatted = await vscode . window . showTextDocument ( documentFormatted ) ;
278+ const editorFormatted = await vscode . window . showTextDocument ( documentFormatted , showTextDocumentOptions ) ;
279279
280280 const formatActual : vscode . TextEdit [ ] [ ] = [ ] ;
281281
282- async function testFormatFile ( editor : vscode . TextEditor , options : vscode . FormattingOptions = { tabSize : 4 , insertSpaces : false , } ) {
282+ async function assertFormatFile ( editor : vscode . TextEditor , options : vscode . FormattingOptions = { tabSize : 4 , insertSpaces : false , } ) {
283283 const edits : vscode . TextEdit [ ] = await vscode . commands . executeCommand (
284284 '_executeFormatDocumentProvider' ,
285285 editorFormatted . document . uri ,
@@ -297,10 +297,13 @@ suite('Extension Tests', async () => {
297297 await vscode . commands . executeCommand ( 'editor.action.formatDocument' ) ;
298298 await vscode . commands . executeCommand ( 'editor.action.formatDocument' ) ;
299299
300+ await editorSettings . update ( 'insertSpaces' , false ) ;
301+ await editorSettings . update ( 'tabSize' , 4 ) ;
302+
300303 formatActual . push ( edits ) ;
301304
302305 if ( runTests ) {
303- assert . equal ( editorFormatted . document . getText ( ) , editor . document . getText ( ) ) ;
306+ assert . equal ( editorFormatted . document . getText ( ) . replaceAll ( / [ \r \n ] + / gm , '\r\n' ) , editor . document . getText ( ) . replaceAll ( / [ \r \n ] + / gm , '\r\n' ) ) ;
304307 }
305308 else {
306309 const uint8Array = new TextEncoder ( ) . encode ( editorFormatted . document . getText ( ) ) ;
@@ -326,7 +329,7 @@ suite('Extension Tests', async () => {
326329 formatActual . push ( edits ) ;
327330 }
328331
329- await testFormatFile ( editorTabs ) ;
332+ await assertFormatFile ( editorTabs ) ;
330333 // Partially minify document;
331334 await editorFormatted . edit (
332335 editBuilder => {
@@ -336,8 +339,8 @@ suite('Extension Tests', async () => {
336339 }
337340 ) ;
338341 // TODO: TreeSitter broken. can't handle partially minified JSON
339- await testFormatFile ( editorSpaces , { tabSize : 3 , insertSpaces : true } ) ;
340- await testFormatFile ( editorTabs ) ;
342+ await assertFormatFile ( editorSpaces , { tabSize : 3 , insertSpaces : true } ) ;
343+ await assertFormatFile ( editorTabs ) ;
341344
342345 await assertFormatRange ( editorUnformatted , 12 , 8 , 19 , 18 ) ;
343346 await assertFormatRange ( editorUnformatted , 31 , 37 , 36 , 37 ) ;
0 commit comments