Given sources with similar content:
anySymbolHere.stub(anObject, stringRef, hoistedFn);
anySymbolHere.stub(anObject, 'anyMethodCallAsString', () => true);
Execute the following command in your terminal:
sed -i '' 's/.stub(\(.*\), \(.*\));/.stub(\1).callsFake(\2);/g' *.js
Note: ensure the glob for
*.js
matches the desired files you want modify!
Once done, you'll get something like this:
anySymbolHere.stub(anObject, stringRef).callsFake(hoistedFn);
anySymbolHere.stub(anObject, 'anyMethodCallAsString').callsFake(() => true);