An open API service indexing awesome lists of open source software.

https://github.com/ideadapt/babel-plugin-transform-controlflow-asyncawait

Transform Control Flow based Selenium tests to async await syntax using a babel plugin.
https://github.com/ideadapt/babel-plugin-transform-controlflow-asyncawait

Last synced: 19 days ago
JSON representation

Transform Control Flow based Selenium tests to async await syntax using a babel plugin.

Awesome Lists containing this project

README

          

[![Build Status](https://travis-ci.com/ideadapt/babel-plugin-transform-controlflow-asyncawait.svg?branch=master)](https://travis-ci.com/ideadapt/babel-plugin-transform-controlflow-asyncawait)

## Usage:

To migrate code.js in place: \
`npx codemod --plugin build/src/main.js __fixtures__/jasmine/code.js`

To read code.js and write migrated output to migrated.js \
`cat __fixtures__/jasmine/code.js | npx codemod --plugin build/src/main.js --stdio --plugin-options transformAsyncAwait='{"customCalls": "get|open|enter|confirm|clear"}' > migrated.js`

### Plugin Options

#### customCalls
Provide substrings of function names that return most probably a promise. \
For example you might have a convention, that your page objects have getter methods that are to be prefixed with "get". \
For instance `new HeaderPO().getMenu();`. If you provide "get" as option value, this would be transformed to `await new HeaderPO().getMenu();`.
To provide multiple prefixes, concatenate them via pipe | (see example in usage chapter). \
\
Default: 'get|open|enter|clear'

## Development:

`npm run test:watch` \
`npm run build`