My bee's knees module
$ npm install --save babel-plugin-ava-test-data
import * as babel from 'babel-core';
import plugin from 'babel-plugin-test-data';
const result = babel.transform(
`
import test from 'ava';
test(t => {}); // adds empty array to metadata
test.skip('foo', t => {}); // adds array ['skip'] to metadata
test.serial.cb('foo', t => {}); // adds array ['serial', 'cb'] to metadata
`,
{plugins: [plugin]}
);
//
const metadata = plugin.metadata(result);
Resulting metadata is:
metadata = [
[],
['skip'],
['serial', 'cb']
]
Extract the test call metadata from the babel result.
Type: Babel transform result
The result from calling babel.transform
.
Type: boolean
Default: false
If true
and no test calls were found, create and return an empty array. This guarantees the result is always an array. Otherwise it will return null
if no test calls are found.
MIT © James Talmage