0.2.0 • Published 9 years ago
jscodeshift-ava-to-jest v0.2.0
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]).truthy(value, [message]).falsy(value, [message]).true(value, [message]).false(value, [message]).is(value, expected, [message]).not(value, expected, [message]).deepEqual(value, expected, [message]).notDeepEqual(value, expected, [message]).throws(function|promise, [error, [message]]).notThrows(function|promise, [message]).regex(contents, regex, [message]).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.