@@ -235,7 +235,7 @@ beforeEach(() => {
235235 eslintMock . mock . lintText . mockClear ( ) ;
236236 eslintMock . mock . calculateConfigForFile . mockClear ( ) ;
237237 prettierMock . format . mockClear ( ) ;
238- prettierMock . resolveConfig . sync . mockClear ( ) ;
238+ prettierMock . resolveConfig . mockClear ( ) ;
239239 fsMock . readFileSync . mockClear ( ) ;
240240 loglevelMock . mock . clearAll ( ) ;
241241 global . __PRETTIER_ESLINT_TEST_STATE__ = { } ;
@@ -376,33 +376,15 @@ test('logs error if it cannot read the file from the filePath', async () => {
376376 fsMock . readFileSync = originalMock ;
377377} ) ;
378378
379- test ( 'calls prettier.resolveConfig.sync with the file path' , async ( ) => {
379+ test ( 'calls prettier.resolveConfig with the file path' , async ( ) => {
380380 const filePath = require . resolve ( '../../tests/fixtures/paths/foo.js' ) ;
381381 await format ( {
382382 filePath,
383383 text : defaultInputText ( ) ,
384384 eslintConfig : getESLintConfigWithDefaultRules ( )
385385 } ) ;
386- expect ( prettierMock . resolveConfig . sync ) . toHaveBeenCalledTimes ( 1 ) ;
387- expect ( prettierMock . resolveConfig . sync ) . toHaveBeenCalledWith ( filePath ) ;
388- } ) ;
389-
390- test ( 'does not raise an error if prettier.resolveConfig.sync is not defined' , ( ) => {
391- const filePath = require . resolve ( '../../tests/fixtures/paths/foo.js' ) ;
392- const originalPrettierMockResolveConfigSync = prettierMock . resolveConfig . sync ;
393- prettierMock . resolveConfig . sync = undefined ;
394-
395- function callingFormat ( ) {
396- return format ( {
397- filePath,
398- text : defaultInputText ( ) ,
399- eslintConfig : getESLintConfigWithDefaultRules ( )
400- } ) ;
401- }
402-
403- expect ( callingFormat ) . not . toThrowError ( ) ;
404-
405- prettierMock . resolveConfig . sync = originalPrettierMockResolveConfigSync ;
386+ expect ( prettierMock . resolveConfig ) . toHaveBeenCalledTimes ( 1 ) ;
387+ expect ( prettierMock . resolveConfig ) . toHaveBeenCalledWith ( filePath ) ;
406388} ) ;
407389
408390test ( 'does not raise an error if prettier.resolveConfig is not defined' , async ( ) => {
0 commit comments