Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sinon codemod #242

Merged
merged 4 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update the “ Usage (jscodeshift)” section?

we should also add sinon to the cli. Let me know if you need any help doing that. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated both

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