@@ -6,6 +6,7 @@ import { format, parse } from "./run-prettier.js";
66import consistentEndOfLine from "./utils/consistent-end-of-line.js" ;
77import createSnapshot from "./utils/create-snapshot.js" ;
88import visualizeEndOfLine from "./utils/visualize-end-of-line.js" ;
9+ import * as testSecondFormat from "./test-second-format.js" ;
910import { shouldThrowOnFormat } from "./utilities.js" ;
1011import getPrettier from "./get-prettier.js" ;
1112import getCreateParser from "./get-create-parser.js" ;
@@ -125,25 +126,7 @@ async function runTest({
125126 }
126127 }
127128
128- const isUnstableTest = failedTests . isUnstable ( filename , formatOptions ) ;
129- if (
130- ( formatResult . changed || isUnstableTest ) &&
131- // No range and cursor
132- formatResult . input === code
133- ) {
134- const { eolVisualizedOutput : firstOutput , output } = formatResult ;
135- const { eolVisualizedOutput : secondOutput } = await format (
136- output ,
137- formatOptions ,
138- ) ;
139- if ( isUnstableTest ) {
140- // To keep eye on failed tests, this assert never supposed to pass,
141- // if it fails, just remove the file from `unstableTests`
142- expect ( secondOutput ) . not . toEqual ( firstOutput ) ;
143- } else {
144- expect ( secondOutput ) . toEqual ( firstOutput ) ;
145- }
146- }
129+ testSecondFormat . run ( code , formatResult , filename , formatOptions ) ;
147130
148131 const isAstUnstableTest = failedTests . isAstUnstable ( filename , formatOptions ) ;
149132 // Some parsers skip parsing empty files
0 commit comments