Skip to content

Commit 544c724

Browse files
author
Daniel Del Core
committed
fix cli test
1 parent 040e5ee commit 544c724

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

packages/cli/src/main.spec.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -551,20 +551,7 @@ describe('main', () => {
551551

552552
(PluginManager as jest.Mock).mockImplementation(() => ({
553553
install: jest.fn().mockResolvedValue(undefined),
554-
require: jest.fn(),
555-
getInfo: jest
556-
.fn()
557-
.mockReturnValue({ location: path.join(__dirname, 'path', 'to') }),
558-
uninstallAll: jest.fn().mockResolvedValue(undefined),
559-
}));
560-
});
561-
562-
it('should run package transform for single version', async () => {
563-
jest.spyOn(fs, 'existsSync').mockReturnValue(true);
564-
jest.mock(
565-
mockMatchedPath,
566-
() => ({
567-
__esModule: true,
554+
require: () => ({
568555
default: {
569556
transforms: {
570557
'18.0.0': 'mylib/path/to/18.js',
@@ -574,9 +561,15 @@ describe('main', () => {
574561
},
575562
},
576563
}),
577-
{ virtual: true },
578-
);
564+
getInfo: jest
565+
.fn()
566+
.mockReturnValue({ location: path.join(__dirname, 'path', 'to') }),
567+
uninstallAll: jest.fn().mockResolvedValue(undefined),
568+
}));
569+
});
579570

571+
it('should run package transform for single version', async () => {
572+
jest.spyOn(fs, 'existsSync').mockReturnValue(true);
580573
await main([mockPath], {
581574
packages: 'mylib@18.0.0',
582575
parser: 'babel',

0 commit comments

Comments
 (0)