Skip to content

Commit

Permalink
Add sinon codemod (#242)
Browse files Browse the repository at this point in the history
* add sinon mod

* update readme, update sinon warning

* udpate readme, add sinon option to cli

Co-authored-by: Kenneth Skovhus <[email protected]>
  • Loading branch information
catc and skovhus authored Apr 11, 2022
1 parent 23885ea commit 47a8124
Show file tree
Hide file tree
Showing 8 changed files with 1,217 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Codemods that simplify migrating JavaScript and TypeScript test files from
[Mocha](https://github.com/mochajs/mocha),
[proxyquire](https://github.com/thlorenz/proxyquire),
[Should.js](https://github.com/tj/should.js/),
[Tape](https://github.com/substack/tape)
[Tape](https://github.com/substack/tape),
[Sinon](https://github.com/sinonjs/),
and
[Node-Tap](https://github.com/tapjs/node-tap)
to [Jest](https://facebook.github.io/jest/).
Expand Down Expand Up @@ -82,6 +83,7 @@ $ jscodeshift -t node_modules/jest-codemods/dist/transformers/jasmine-this.js te
$ jscodeshift -t node_modules/jest-codemods/dist/transformers/mocha.js test-folder
$ jscodeshift -t node_modules/jest-codemods/dist/transformers/should.js test-folder
$ jscodeshift -t node_modules/jest-codemods/dist/transformers/tape.js test-folder
$ jscodeshift -t node_modules/jest-codemods/dist/transformers/sinon.js test-folder
```

## Test environment: Jest on Node.js or other
Expand Down
6 changes: 6 additions & 0 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const TRANSFORMER_JASMINE_THIS = 'jasmine-this'
const TRANSFORMER_MOCHA = 'mocha'
const TRANSFORMER_SHOULD = 'should'
const TRANSFORMER_TAPE = 'tape'
const TRANSFORMER_SINON = 'sinon'

const ALL_TRANSFORMERS = [
// TRANSFORMER_CHAI_SHOULD & TRANSFORMER_SHOULD doesn't have import detection
Expand All @@ -70,6 +71,7 @@ const ALL_TRANSFORMERS = [
TRANSFORMER_MOCHA,
TRANSFORMER_TAPE,
TRANSFORMER_JASMINE_THIS,
TRANSFORMER_SINON,
]

const TRANSFORMER_INQUIRER_CHOICES = [
Expand Down Expand Up @@ -113,6 +115,10 @@ const TRANSFORMER_INQUIRER_CHOICES = [
name: 'Tape / Node-Tap',
value: TRANSFORMER_TAPE,
},
{
name: 'Sinon',
value: TRANSFORMER_SINON,
},
{
name: 'All of the above (use with care)!',
value: 'all',
Expand Down
Loading

0 comments on commit 47a8124

Please sign in to comment.