materialuiupgraded
Version:
Material-UI's workspace package
36 lines (26 loc) • 748 B
JavaScript
/* eslint-disable no-console */
import { spy } from 'sinon';
class ConsoleErrorMock {
consoleErrorContainer;
spy = () => {
this.consoleErrorContainer = console.error;
console.error = spy();
};
reset = () => {
console.error = this.consoleErrorContainer;
delete this.consoleErrorContainer;
};
callCount = () => {
if (this.consoleErrorContainer) {
return console.error.callCount;
}
throw new Error('Requested call count before spy() was called');
};
args = () => {
if (this.consoleErrorContainer) {
return console.error.args;
}
throw new Error('Requested call count before spy() was called');
};
}
export default new ConsoleErrorMock();