You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

22 lines
801 B

jest.setMock('../prompt-installation', {
promptInstallation: jest.fn(),
});
const ExternalCommand = require('../../commands/resolveCommand');
const { packageExists } = require('../package-exists');
const { promptInstallation } = require('../prompt-installation');
describe('@webpack-cli/utils', () => {
it('should check existence of package', () => {
// use an actual path relative to the packageUtils file
expect(packageExists('./logger')).toBeTruthy();
expect(packageExists('./nonexistent-package')).toBeFalsy();
});
it('should not throw if the user interrupts', async () => {
promptInstallation.mockImplementation(() => {
throw new Error();
});
await expect(ExternalCommand('info')).resolves.not.toThrow();
});
});