Skip to content

Fuco1/sinon-codemod

 
 

Repository files navigation

sinon-codemod

Build Status Code Style: prettier

This repository contains a collection of codemod scripts based for use with JSCodeshift that help update Sinon APIs.

Setup & Run

  • npm install -g jscodeshift
  • git clone https://github.com/hurrymaplelad/sinon-codemod.git or download a zip file from https://github.com/hurrymaplelad/sinon-codemod/archive/master.zip
  • Run npm install in the sinon-codemod directory
    • Alternatively, run yarn to install in the sinon-codemod directory for a reliable dependency resolution
  • jscodeshift -t <codemod-script> <path>
  • Use the -d option for a dry-run and use -p to print the output for comparison

Included Scripts

extract-calls-fake

Converts 3-argument calls to sinon.stub(x,y,z) into `sinon.stub(x,y).callsFake(z).

jscodeshift -t sinon-codemod/extract-calls-fake.js <path>

About

Codemod scripts that update Sinon APIs

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%