jscodeshift-ava-to-jest
v0.2.0
Published
Transforms test files from AVA to Jest
Downloads
16
Maintainers
Readme
jscodeshift-ava-to-jest
A jscodeshift codemod that transforms test files from AVA to Jest.
Deprecation Warning
I no longer maintain this package. As a great, more feature complete alternative, I recommend https://github.com/skovhus/jest-codemods.
Install
Get jscodeshift-ava-to-jest from NPM
npm install --save-dev jscodeshift-ava-to-jestUsage
TBD: Explain how this module can be used in an existing project.
Why?
It all started with a tweet, followed by a suggestion by Christoph Pojer.
Supported AVA Assertions
- [ ]
.pass([message]) - [ ]
.fail([message]) - [x]
.truthy(value, [message]) - [x]
.falsy(value, [message]) - [x]
.true(value, [message]) - [x]
.false(value, [message]) - [x]
.is(value, expected, [message]) - [x]
.not(value, expected, [message]) - [x]
.deepEqual(value, expected, [message]) - [x]
.notDeepEqual(value, expected, [message]) - [ ]
.throws(function|promise, [error, [message]]) - [ ]
.notThrows(function|promise, [message]) - [x]
.regex(contents, regex, [message]) - [x]
.notRegex(contents, regex, [message]) - [ ]
.ifError(error, [message])
Contributing
Project structure
ava-tests: Contains tests written in AVA.
jest-tests: Contains generated Jest files.
src: Contains jscodeshift helper functions.
transform.js: The entry point for jscodeshift.
Run tests
npm test: Transforms tests from AVA to Jest. In more detail:
- Runs
avaon all files inava-teststo make sure the AVA tests are valid. - Deletes all files in
jest-tests. - Copies all files from
ava-teststojest-tests. - Runs
jscodeshifton all files injest-tests. - Runs
jeston all files injest-teststo make sure the Jest tests are valid.
