@putout/plugin-tape
Version:
🐊Putout plugin helps with tests
22 lines (15 loc) • 713 B
JavaScript
import {operator} from 'putout';
const {compare} = operator;
export const report = (path) => {
if (compare(path, 't.ok(__args)'))
return `Use 't.calledWith()' instead of 't.ok()'`;
return `Use 't.notCalledWith()' instead of 't.notOk()'`;
};
export const replace = () => ({
't.ok(__a.calledWith(__args))': 't.calledWith(__a, [__args])',
't.ok(__a.calledWith(__args), __b)': 't.calledWith(__a, [__args], __b)',
't.ok(__a.calledWith(...__b))': 't.calledWith(__a, __b)',
't.ok(__a.calledWith(...__b), __c)': 't.calledWith(__a, __b, __c)',
't.notOk(__a.called, __b)': 't.notCalled(__a, __b)',
't.ok(__a.calledWith(), __b)': 't.calledWithNoArgs(__a, __b)',
});