1- import {
1+ import type {
22 ManifestDependencyFieldNames ,
33 PackageManifest ,
4+ } from '@metamask/action-utils' ;
5+ import {
46 getPackageManifest ,
57 getWorkspaceLocations ,
68 writeJsonFile ,
9+ ManifestFieldNames ,
710} from '@metamask/action-utils' ;
8- import { ManifestFieldNames } from '@metamask/action-utils' ;
911import * as autoChangelog from '@metamask/auto-changelog' ;
1012import { promises as fs } from 'fs' ;
1113import cloneDeep from 'lodash.clonedeep' ;
14+ import {
15+ beforeEach ,
16+ describe ,
17+ expect ,
18+ it ,
19+ vi ,
20+ type MockInstance ,
21+ } from 'vitest' ;
1222
1323import * as gitOps from './git-operations' ;
1424import {
@@ -19,8 +29,6 @@ import {
1929 updatePackages ,
2030} from './package-operations' ;
2131
22- import { beforeEach , describe , expect , it , vi , type MockInstance } from 'vitest' ;
23-
2432vi . mock ( 'fs' , ( ) => ( {
2533 default : { } ,
2634 promises : {
@@ -70,10 +78,6 @@ type DependencyFieldsDict = Partial<
7078 Record < ManifestDependencyFieldNames , Record < string , string > >
7179> ;
7280
73- // Convenience method to match behavior of utils.writeJsonFile
74- const jsonStringify = ( value : unknown ) : string =>
75- `${ JSON . stringify ( value , null , 2 ) } \n` ;
76-
7781const getMockManifest = (
7882 name : string ,
7983 version : string ,
@@ -104,9 +108,7 @@ describe('package-operations', () => {
104108 } ;
105109
106110 beforeEach ( ( ) => {
107- vi . spyOn ( fs , 'lstat' ) . mockImplementation ( ( async (
108- path : string ,
109- ) => {
111+ vi . spyOn ( fs , 'lstat' ) . mockImplementation ( ( async ( path : string ) => {
110112 return path . endsWith ( SOME_FILE )
111113 ? { isDirectory : ( ) : boolean => false }
112114 : { isDirectory : ( ) : boolean => true } ;
@@ -411,9 +413,10 @@ describe('package-operations', () => {
411413
412414 // no new changelog content and no unreleased changes will cause an error
413415 updateChangelogMock . mockImplementation ( async ( ) => '' ) ;
414- const actualChangelog = await vi . importActual < typeof import ( '@metamask/auto-changelog' ) > (
415- '@metamask/auto-changelog/dist/changelog' ,
416- ) ;
416+ const actualChangelog = await vi . importActual <
417+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
418+ typeof import ( '@metamask/auto-changelog' )
419+ > ( '@metamask/auto-changelog/dist/changelog' ) ;
417420
418421 // @ts -expect-error: Partial mock.
419422 parseChangelogMock . mockImplementationOnce ( ( ) => {
@@ -478,6 +481,7 @@ describe('package-operations', () => {
478481
479482 updateChangelogMock . mockImplementation ( async ( ) => '' ) ;
480483 const actualChangelog = await vi . importActual <
484+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
481485 typeof import ( '@metamask/auto-changelog' )
482486 > ( '@metamask/auto-changelog/dist/changelog' ) ;
483487
@@ -543,6 +547,7 @@ describe('package-operations', () => {
543547 // no new changelog content and no unreleased changes will cause an error
544548 updateChangelogMock . mockImplementation ( async ( ) => '' ) ;
545549 const actualChangelog = await vi . importActual <
550+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
546551 typeof import ( '@metamask/auto-changelog' )
547552 > ( '@metamask/auto-changelog/dist/changelog' ) ;
548553
0 commit comments